Spaces:
Configuration error
Configuration error
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -11,30 +11,21 @@ from smolagents import (
|
|
| 11 |
|
| 12 |
MODEL_ID = "o4-mini"
|
| 13 |
|
| 14 |
-
def run_agent(
|
| 15 |
-
if level == 1:
|
| 16 |
-
max_steps = 10
|
| 17 |
-
elif level == 2:
|
| 18 |
-
max_steps = 25
|
| 19 |
-
elif level == 3:
|
| 20 |
-
max_steps = 50
|
| 21 |
-
|
| 22 |
agent = CodeAgent(
|
| 23 |
add_base_tools = True,
|
| 24 |
additional_authorized_imports = ["pandas", "numpy"],
|
| 25 |
-
max_steps =
|
| 26 |
model = OpenAIServerModel(model_id = MODEL_ID),
|
| 27 |
#planning_interval=3,
|
| 28 |
tools = [#DuckDuckGoSearchTool(),
|
| 29 |
WikipediaSearchTool()],
|
| 30 |
-
verbosity_level =
|
| 31 |
)
|
| 32 |
|
| 33 |
-
agent.logger.console.width = 66
|
| 34 |
-
|
| 35 |
answer = agent.run(question)
|
| 36 |
|
| 37 |
-
return
|
| 38 |
|
| 39 |
def get_final_answer(question, answer):
|
| 40 |
client = OpenAI()
|
|
@@ -52,6 +43,4 @@ You are a GAIA benchmark assistant, who is given a question and an answer. Read
|
|
| 52 |
model = MODEL_ID
|
| 53 |
)
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
return final_answer
|
|
|
|
| 11 |
|
| 12 |
MODEL_ID = "o4-mini"
|
| 13 |
|
| 14 |
+
def run_agent(question, file_name):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
agent = CodeAgent(
|
| 16 |
add_base_tools = True,
|
| 17 |
additional_authorized_imports = ["pandas", "numpy"],
|
| 18 |
+
max_steps = 25,
|
| 19 |
model = OpenAIServerModel(model_id = MODEL_ID),
|
| 20 |
#planning_interval=3,
|
| 21 |
tools = [#DuckDuckGoSearchTool(),
|
| 22 |
WikipediaSearchTool()],
|
| 23 |
+
verbosity_level = 0
|
| 24 |
)
|
| 25 |
|
|
|
|
|
|
|
| 26 |
answer = agent.run(question)
|
| 27 |
|
| 28 |
+
return get_final_answer(question, answer)
|
| 29 |
|
| 30 |
def get_final_answer(question, answer):
|
| 31 |
client = OpenAI()
|
|
|
|
| 43 |
model = MODEL_ID
|
| 44 |
)
|
| 45 |
|
| 46 |
+
return completion.choices[0].message.content
|
|
|
|
|
|