petrov826 commited on
Commit
5bedb52
·
verified ·
1 Parent(s): a612e3f

set argument name explicitly in agent.run()

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -9,6 +9,7 @@ from smolagents import (
9
  LiteLLMModel,
10
  PythonInterpreterTool,
11
  VisitWebpageTool,
 
12
  GoogleSearchTool,
13
  WikipediaSearchTool,
14
  SpeechToTextTool
@@ -36,6 +37,7 @@ class BasicAgent:
36
  PythonInterpreterTool(),
37
  VisitWebpageTool(),
38
  GoogleSearchTool(provider="serper"),
 
39
  WikipediaSearchTool(),
40
  YoutubeTranscriptTool(),
41
  SpeechToTextTool(),
@@ -47,7 +49,7 @@ class BasicAgent:
47
 
48
  def __call__(self, question: str, additional_args: dict = {}) -> str:
49
  print(f"Agent received question (first 50 chars): {question[:50]}...")
50
- answer = self.agent.run(question, additional_args)
51
  print(f"Agent returning answer: {answer}")
52
  return answer
53
 
@@ -121,7 +123,10 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
121
  print(f"Skipping item with missing task_id or question: {item}")
122
  continue
123
  try:
124
- submitted_answer = agent(question_text, file_name_to_url)
 
 
 
125
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
126
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
127
  except Exception as e:
 
9
  LiteLLMModel,
10
  PythonInterpreterTool,
11
  VisitWebpageTool,
12
+ DuckDuckGoSearchTool,
13
  GoogleSearchTool,
14
  WikipediaSearchTool,
15
  SpeechToTextTool
 
37
  PythonInterpreterTool(),
38
  VisitWebpageTool(),
39
  GoogleSearchTool(provider="serper"),
40
+ DuckDuckGoSearchTool(),
41
  WikipediaSearchTool(),
42
  YoutubeTranscriptTool(),
43
  SpeechToTextTool(),
 
49
 
50
  def __call__(self, question: str, additional_args: dict = {}) -> str:
51
  print(f"Agent received question (first 50 chars): {question[:50]}...")
52
+ answer = self.agent.run(task=question, additional_args=additional_args)
53
  print(f"Agent returning answer: {answer}")
54
  return answer
55
 
 
123
  print(f"Skipping item with missing task_id or question: {item}")
124
  continue
125
  try:
126
+ submitted_answer = agent(
127
+ question=question_text,
128
+ additional_args=file_name_to_url
129
+ )
130
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
131
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
132
  except Exception as e: