Spaces:
Runtime error
Runtime error
Scott Cogan commited on
Commit ·
32d0c27
1
Parent(s): d688122
fix: pass tools as a dictionary to CodeAgent
Browse files
app.py
CHANGED
|
@@ -154,9 +154,20 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 154 |
raise
|
| 155 |
|
| 156 |
# Create the agent with the templates
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
agent = CodeAgent(
|
| 158 |
model=model,
|
| 159 |
-
tools=
|
| 160 |
max_steps=15,
|
| 161 |
verbosity_level=2,
|
| 162 |
grammar=None,
|
|
|
|
| 154 |
raise
|
| 155 |
|
| 156 |
# Create the agent with the templates
|
| 157 |
+
tools = [
|
| 158 |
+
final_answer,
|
| 159 |
+
DuckDuckGoSearchTool(),
|
| 160 |
+
calculate_min_price,
|
| 161 |
+
extract_price_from_snippet,
|
| 162 |
+
get_current_time_in_timezone
|
| 163 |
+
]
|
| 164 |
+
|
| 165 |
+
# Convert tools to a dictionary format that smolagents expects
|
| 166 |
+
tools_dict = {tool.name: tool for tool in tools}
|
| 167 |
+
|
| 168 |
agent = CodeAgent(
|
| 169 |
model=model,
|
| 170 |
+
tools=tools_dict, # Pass tools as a dictionary
|
| 171 |
max_steps=15,
|
| 172 |
verbosity_level=2,
|
| 173 |
grammar=None,
|