RCaz commited on
Commit
eb84627
·
verified ·
1 Parent(s): cbbbfb4

removed mcp tool

Browse files
Files changed (1) hide show
  1. agent.py +9 -8
agent.py CHANGED
@@ -53,7 +53,7 @@ class TestAgent:
53
  def __init__(self):
54
 
55
  # import code agent and basic tool from smolagent
56
- from smolagents import CodeAgent, OpenAIServerModel, DuckDuckGoSearchTool, FinalAnswerTool, VisitWebpageTool, MCPServerTool
57
 
58
  # import additional tool from langchain @ https://docs.langchain.com/oss/python/integrations/tools
59
  from langchain.agents import load_tools
@@ -62,12 +62,12 @@ class TestAgent:
62
  wikipedia_tool.top_k_results=3
63
 
64
  # import tools from MCP servers @ https://github.com/mcp
65
- from mcp import StdioServerParameters
66
- server_parameters = StdioServerParameters(command="uvx",
67
- args=["--quiet", "youtubeqa@0.2.1"],
68
- env={"UV_PYTHON": "3.12", **os.environ},
69
- )
70
- youtube_tools = MCPServerTool(server_params=server_parameters)
71
 
72
  model = OpenAIServerModel(model_id="gpt-4o")
73
  #model = InferenceClientModel("Qwen/Qwen2.5-Coder-32B-Instruct")
@@ -77,7 +77,7 @@ class TestAgent:
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,
@@ -85,6 +85,7 @@ class TestAgent:
85
  )
86
 
87
  def __call__(self, question: str) -> str:
 
88
  print(f"Agent received question (first 50 chars): {question[:50]}...")
89
  answer = self.agent.invoke(question)
90
  print(f"Agent returning his answer: {answer}")
 
53
  def __init__(self):
54
 
55
  # import code agent and basic tool from smolagent
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.agents import load_tools
 
62
  wikipedia_tool.top_k_results=3
63
 
64
  # import tools from MCP servers @ https://github.com/mcp
65
+ #from mcp import StdioServerParameters
66
+ #server_parameters = StdioServerParameters(command="uvx",
67
+ # args=["--quiet", "youtubeqa@0.2.1"],
68
+ # env={"UV_PYTHON": "3.12", **os.environ},
69
+ # )
70
+ #youtube_tools = MCPServerTool(server_params=server_parameters)
71
 
72
  model = OpenAIServerModel(model_id="gpt-4o")
73
  #model = InferenceClientModel("Qwen/Qwen2.5-Coder-32B-Instruct")
 
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,
 
85
  )
86
 
87
  def __call__(self, question: str) -> str:
88
+
89
  print(f"Agent received question (first 50 chars): {question[:50]}...")
90
  answer = self.agent.invoke(question)
91
  print(f"Agent returning his answer: {answer}")