mmichiels13 commited on
Commit
cfefd14
·
verified ·
1 Parent(s): e9d70d9

from smolagents import CodeAgent, InferenceClientModel

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -5,6 +5,7 @@ import inspect
5
  import pandas as pd
6
 
7
  # Import our custom tools from their modules
 
8
  from tools import DuckDuckGoSearchTool, WeatherInfoTool, HubStatsTool
9
  from retriever import load_guest_dataset
10
 
@@ -17,6 +18,19 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
17
  class BasicAgent:
18
  def __init__(self):
19
  print("BasicAgent initialized.")
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  def __call__(self, question: str) -> str:
21
  print(f"Agent received question (first 50 chars): {question[:50]}...")
22
  fixed_answer = "This is a default answer."
 
5
  import pandas as pd
6
 
7
  # Import our custom tools from their modules
8
+ from smolagents import CodeAgent, InferenceClientModel
9
  from tools import DuckDuckGoSearchTool, WeatherInfoTool, HubStatsTool
10
  from retriever import load_guest_dataset
11
 
 
18
  class BasicAgent:
19
  def __init__(self):
20
  print("BasicAgent initialized.")
21
+
22
+ # Create the search tool
23
+ self.search_tool = DuckDuckGoSearchTool()
24
+
25
+ # Create the model
26
+ self.model = InferenceClientModel()
27
+
28
+ # Create the agent with tools
29
+ self.agent = CodeAgent(
30
+ tools=[self.search_tool],
31
+ model=self.model,
32
+ max_steps=5 # Limit reasoning steps
33
+ )
34
  def __call__(self, question: str) -> str:
35
  print(f"Agent received question (first 50 chars): {question[:50]}...")
36
  fixed_answer = "This is a default answer."