Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -28,7 +28,11 @@ class BasicAgent:
28
  login(token=api_key)
29
 
30
  # Create the search tool
31
- self.search_tool = DuckDuckGoSearchTool()
 
 
 
 
32
 
33
  # Create the model
34
  self.model = InferenceClientModel()
@@ -38,7 +42,7 @@ class BasicAgent:
38
 
39
  # Create the agent with tools
40
  self.agent = CodeAgent(
41
- tools=[self.search_tool],
42
  model=self.model,
43
  system_prompt=self.system_prompt,
44
  max_steps=5 # Limit reasoning steps
@@ -65,7 +69,7 @@ class BasicAgent:
65
  print(f"Agent error: {e}")
66
  fixed_answer = f"I encountered an error: {str(e)}"
67
 
68
- return fixed_answer.strip()
69
 
70
  def run_and_submit_all( profile: gr.OAuthProfile | None):
71
  """
@@ -142,7 +146,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
142
  for future in as_completed(futures):
143
  task_id, question_text, submitted_answer = future.result()
144
  if task_id is None:
145
- continue
146
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
147
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
148
  # results_log = []
 
28
  login(token=api_key)
29
 
30
  # Create the search tool
31
+ self.web_search = DuckDuckGoSearchTool()
32
+
33
+ self.visit_webpage = VisitWebpageTool()
34
+
35
+ self.final_answer = FinalAnswerTool()
36
 
37
  # Create the model
38
  self.model = InferenceClientModel()
 
42
 
43
  # Create the agent with tools
44
  self.agent = CodeAgent(
45
+ tools=[self.web_search, self.visit_webpage, self.final_answer],
46
  model=self.model,
47
  system_prompt=self.system_prompt,
48
  max_steps=5 # Limit reasoning steps
 
69
  print(f"Agent error: {e}")
70
  fixed_answer = f"I encountered an error: {str(e)}"
71
 
72
+ return fixed_answer
73
 
74
  def run_and_submit_all( profile: gr.OAuthProfile | None):
75
  """
 
146
  for future in as_completed(futures):
147
  task_id, question_text, submitted_answer = future.result()
148
  if task_id is None:
149
+ continue
150
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
151
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
152
  # results_log = []