Spaces:
Runtime error
Runtime error
Scott Cogan commited on
Commit ·
2059320
1
Parent(s): deb41f8
Update app.py and requirements.txt
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, load_tool, tool
|
| 2 |
-
from
|
| 3 |
import datetime
|
| 4 |
import requests
|
| 5 |
import pytz
|
|
@@ -53,12 +53,16 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 53 |
|
| 54 |
final_answer = FinalAnswerTool()
|
| 55 |
|
| 56 |
-
#
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
)
|
| 63 |
|
| 64 |
# Import tool from Hub
|
|
|
|
| 1 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, load_tool, tool
|
| 2 |
+
from smolagents.models import OpenAIModel
|
| 3 |
import datetime
|
| 4 |
import requests
|
| 5 |
import pytz
|
|
|
|
| 53 |
|
| 54 |
final_answer = FinalAnswerTool()
|
| 55 |
|
| 56 |
+
# Load configuration from agent.json
|
| 57 |
+
with open("agent.json", 'r') as f:
|
| 58 |
+
config = yaml.safe_load(f)
|
| 59 |
+
|
| 60 |
+
# Initialize OpenAI model using the configuration
|
| 61 |
+
model = OpenAIModel(
|
| 62 |
+
model=config["model"]["data"]["model_id"],
|
| 63 |
+
max_tokens=config["model"]["data"]["max_tokens"],
|
| 64 |
+
temperature=config["model"]["data"]["temperature"],
|
| 65 |
+
api_key=os.getenv("OPENAI_API_KEY")
|
| 66 |
)
|
| 67 |
|
| 68 |
# Import tool from Hub
|