Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from smolagents import CodeAgent, LiteLLMModel, tool, Tool, load_tool, DuckDuckGoSearchTool, WikipediaSearchTool
|
| 2 |
import asyncio
|
| 3 |
import os
|
| 4 |
import re
|
|
@@ -201,11 +201,11 @@ class MagAgent:
|
|
| 201 |
]
|
| 202 |
|
| 203 |
self.tools = [
|
| 204 |
-
RetryDuckDuckGoSearchTool(),
|
| 205 |
-
WikipediaSearchTool(),
|
| 206 |
SpeechToTextTool(),
|
| 207 |
ExcelReaderTool(),
|
| 208 |
-
VisitWebpageTool(),
|
| 209 |
PythonCodeReaderTool(),
|
| 210 |
search_arxiv,
|
| 211 |
]
|
|
@@ -235,8 +235,21 @@ class MagAgent:
|
|
| 235 |
"""
|
| 236 |
)
|
| 237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
self.agent = CodeAgent(
|
| 239 |
model=model,
|
|
|
|
| 240 |
tools=self.tools,
|
| 241 |
add_base_tools=True,
|
| 242 |
additional_authorized_imports=self.imports,
|
|
|
|
| 1 |
+
from smolagents import CodeAgent, ToolCallingAgent, LiteLLMModel, tool, Tool, load_tool, DuckDuckGoSearchTool, WikipediaSearchTool
|
| 2 |
import asyncio
|
| 3 |
import os
|
| 4 |
import re
|
|
|
|
| 201 |
]
|
| 202 |
|
| 203 |
self.tools = [
|
| 204 |
+
# RetryDuckDuckGoSearchTool(),
|
| 205 |
+
# WikipediaSearchTool(),
|
| 206 |
SpeechToTextTool(),
|
| 207 |
ExcelReaderTool(),
|
| 208 |
+
# VisitWebpageTool(),
|
| 209 |
PythonCodeReaderTool(),
|
| 210 |
search_arxiv,
|
| 211 |
]
|
|
|
|
| 235 |
"""
|
| 236 |
)
|
| 237 |
|
| 238 |
+
web_agent = ToolCallingAgent(
|
| 239 |
+
tools=[RetryDuckDuckGoSearchTool(),
|
| 240 |
+
WikipediaSearchTool(),
|
| 241 |
+
SpeechToTextTool(),
|
| 242 |
+
VisitWebpageTool(),
|
| 243 |
+
],
|
| 244 |
+
model=model,
|
| 245 |
+
max_steps=15,
|
| 246 |
+
name="web_search_agent",
|
| 247 |
+
description="Runs web searches for you.",
|
| 248 |
+
)
|
| 249 |
+
|
| 250 |
self.agent = CodeAgent(
|
| 251 |
model=model,
|
| 252 |
+
managed_agents=[web_agent],
|
| 253 |
tools=self.tools,
|
| 254 |
add_base_tools=True,
|
| 255 |
additional_authorized_imports=self.imports,
|