Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -56,7 +56,9 @@ class TestAgent:
|
|
| 56 |
from smolagents import CodeAgent, OpenAIServerModel, DuckDuckGoSearchTool, FinalAnswerTool, VisitWebpageTool, MCPClient
|
| 57 |
|
| 58 |
# import additional tool from langchain @ https://docs.langchain.com/oss/python/integrations/tools
|
| 59 |
-
from langchain_community.agent_toolkits import load_tools
|
|
|
|
|
|
|
| 60 |
from smolagents import Tool
|
| 61 |
wikipedia_tool = Tool.from_langchain(load_tools(["wikipedia"])[0])
|
| 62 |
wikipedia_tool.top_k_results=3
|
|
@@ -74,11 +76,11 @@ class TestAgent:
|
|
| 74 |
# Instantiate the agent
|
| 75 |
self.agent = CodeAgent(
|
| 76 |
tools=[real_number_calculator, # homemade tool
|
| 77 |
-
DuckDuckGoSearchTool, # basic tools from smolagent
|
| 78 |
-
VisitWebpageTool,
|
| 79 |
wikipedia_tool, # tool from langchain with extra parmaeters
|
| 80 |
#youtube_tools, # tool from MCP server
|
| 81 |
-
FinalAnswerTool],
|
| 82 |
model=model,
|
| 83 |
max_steps=3,
|
| 84 |
verbosity_level=2
|
|
|
|
| 56 |
from smolagents import CodeAgent, OpenAIServerModel, DuckDuckGoSearchTool, FinalAnswerTool, VisitWebpageTool, MCPClient
|
| 57 |
|
| 58 |
# import additional tool from langchain @ https://docs.langchain.com/oss/python/integrations/tools
|
| 59 |
+
#from langchain_community.agent_toolkits import load_tools
|
| 60 |
+
from langchain_community.agent_toolkits.load_tools import load_tools
|
| 61 |
+
|
| 62 |
from smolagents import Tool
|
| 63 |
wikipedia_tool = Tool.from_langchain(load_tools(["wikipedia"])[0])
|
| 64 |
wikipedia_tool.top_k_results=3
|
|
|
|
| 76 |
# Instantiate the agent
|
| 77 |
self.agent = CodeAgent(
|
| 78 |
tools=[real_number_calculator, # homemade tool
|
| 79 |
+
DuckDuckGoSearchTool(), # basic tools from smolagent
|
| 80 |
+
VisitWebpageTool(),
|
| 81 |
wikipedia_tool, # tool from langchain with extra parmaeters
|
| 82 |
#youtube_tools, # tool from MCP server
|
| 83 |
+
FinalAnswerTool()],
|
| 84 |
model=model,
|
| 85 |
max_steps=3,
|
| 86 |
verbosity_level=2
|