Spaces:
Configuration error
Configuration error
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -7,7 +7,8 @@ from smolagents import (
|
|
| 7 |
WikipediaSearchTool
|
| 8 |
)
|
| 9 |
|
| 10 |
-
|
|
|
|
| 11 |
|
| 12 |
def run_agent(level, question, file_name):
|
| 13 |
if level == 1:
|
|
@@ -21,11 +22,11 @@ def run_agent(level, question, file_name):
|
|
| 21 |
add_base_tools = True,
|
| 22 |
additional_authorized_imports = ["pandas", "numpy"],
|
| 23 |
max_steps = max_steps,
|
| 24 |
-
model = OpenAIServerModel(model_id =
|
| 25 |
-
planning_interval=3,
|
| 26 |
tools = [DuckDuckGoSearchTool(),
|
| 27 |
WikipediaSearchTool()],
|
| 28 |
-
verbosity_level = 2
|
| 29 |
)
|
| 30 |
|
| 31 |
answer = agent.run(question)
|
|
@@ -36,10 +37,9 @@ def get_final_answer(question, answer):
|
|
| 36 |
client = OpenAI()
|
| 37 |
|
| 38 |
prompt_template = """
|
| 39 |
-
You are a GAIA benchmark assistant, who is given a question and an answer
|
| 40 |
**Question:** """ + str(question) + """
|
| 41 |
**Answer:** """ + str(answer) + """
|
| 42 |
-
**Instructions:** Read the question carefully. You must only give the final answer requested. Do not include explanations, steps, reasoning, or additional text. Be direct and specific.
|
| 43 |
**Example:** If asked "What is the capital of France?", respond with "Paris".
|
| 44 |
**Final answer:**:
|
| 45 |
|
|
@@ -48,7 +48,7 @@ You are a GAIA benchmark assistant, who is given a question and an answer:
|
|
| 48 |
completion = client.chat.completions.create(
|
| 49 |
max_tokens = 100,
|
| 50 |
messages = [{"role": "user", "content": [{"type": "text", "text": prompt_template}]}],
|
| 51 |
-
model =
|
| 52 |
temperature = 0
|
| 53 |
)
|
| 54 |
|
|
|
|
| 7 |
WikipediaSearchTool
|
| 8 |
)
|
| 9 |
|
| 10 |
+
MODEL_ID_1 = "gpt-4o"
|
| 11 |
+
MODEL_ID_2 = "o3-mini"
|
| 12 |
|
| 13 |
def run_agent(level, question, file_name):
|
| 14 |
if level == 1:
|
|
|
|
| 22 |
add_base_tools = True,
|
| 23 |
additional_authorized_imports = ["pandas", "numpy"],
|
| 24 |
max_steps = max_steps,
|
| 25 |
+
model = OpenAIServerModel(model_id = MODEL_ID_1),
|
| 26 |
+
#planning_interval=3,
|
| 27 |
tools = [DuckDuckGoSearchTool(),
|
| 28 |
WikipediaSearchTool()],
|
| 29 |
+
#verbosity_level = 2
|
| 30 |
)
|
| 31 |
|
| 32 |
answer = agent.run(question)
|
|
|
|
| 37 |
client = OpenAI()
|
| 38 |
|
| 39 |
prompt_template = """
|
| 40 |
+
You are a GAIA benchmark assistant, who is given a question and an answer. Read the question carefully. You must only give the final answer requested. Do not include explanations, steps, reasoning, or additional text. Be direct and specific.
|
| 41 |
**Question:** """ + str(question) + """
|
| 42 |
**Answer:** """ + str(answer) + """
|
|
|
|
| 43 |
**Example:** If asked "What is the capital of France?", respond with "Paris".
|
| 44 |
**Final answer:**:
|
| 45 |
|
|
|
|
| 48 |
completion = client.chat.completions.create(
|
| 49 |
max_tokens = 100,
|
| 50 |
messages = [{"role": "user", "content": [{"type": "text", "text": prompt_template}]}],
|
| 51 |
+
model = MODEL_ID_2,
|
| 52 |
temperature = 0
|
| 53 |
)
|
| 54 |
|