zonca commited on
Commit
33d4a53
·
1 Parent(s): c57f869

use duckduckgo search

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -4,9 +4,8 @@ import requests
4
  import inspect
5
  import pandas as pd
6
 
7
- # Add smolagents import
8
- import smolagents
9
- from smolagents.tools import WebSearchTool
10
 
11
  # (Keep Constants as is)
12
  # --- Constants ---
@@ -16,12 +15,10 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
16
  class MyAgent:
17
  def __init__(self):
18
  print("MyAgent initialized.")
19
- # Standard tools from smolagents
20
- self.tools = smolagents.get_standard_tools()
21
- # Add web search tool
22
- self.tools.append(WebSearchTool())
23
- # Create the agent with tools
24
- self.agent = smolagents.Agent(tools=self.tools)
25
 
26
  def __call__(self, question: str) -> str:
27
  # Use the agent to answer the question
 
4
  import inspect
5
  import pandas as pd
6
 
7
+ # Updated smolagents import
8
+ from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel
 
9
 
10
  # (Keep Constants as is)
11
  # --- Constants ---
 
15
  class MyAgent:
16
  def __init__(self):
17
  print("MyAgent initialized.")
18
+ # Standard tools for CodeAgent
19
+ self.tools = [DuckDuckGoSearchTool()]
20
+ # You can add more tools if needed
21
+ self.agent = CodeAgent(tools=self.tools, model=HfApiModel())
 
 
22
 
23
  def __call__(self, question: str) -> str:
24
  # Use the agent to answer the question