Commit ·
36cc9c4
1
Parent(s): b3c29a7
Fix task_id/read_pdf bugs, upgrade model, tighten answer formatting for GAIA scoring
Browse files- agent.run() was called with the raw question, never full_prompt, so
the agent never saw task_id and could not call fetch_task_file for
any GAIA question with an attached file.
- read_pdf was instantiated but commented out of the tools list, so
the agent had no way to actually read PDFs despite instructions
telling it to.
- Swap Qwen2.5-Coder-32B-Instruct for Qwen3-235B-A22B-Instruct-2507
(via novita) with temperature=0.3 for stronger general reasoning
alongside code generation.
- Add explicit answer-formatting guidance matching GAIA's quasi-exact
match grader (bare numbers, minimal strings, comma-separated lists).
app.py
CHANGED
|
@@ -156,22 +156,24 @@ class BasicAgent:
|
|
| 156 |
read_pdf = ReadPDFTool()
|
| 157 |
analyze_image = AnalyzeImageTool()
|
| 158 |
transcribe_audio = TranscribeAudioTool()
|
| 159 |
-
#read_pdf = ReadPDFTool()
|
| 160 |
self.agent = CodeAgent(
|
| 161 |
tools=[
|
| 162 |
DuckDuckGoSearchTool(),
|
| 163 |
VisitWebpageTool(),
|
| 164 |
PythonInterpreterTool(),
|
| 165 |
FinalAnswerTool(),
|
| 166 |
-
#pdf_tool,
|
| 167 |
fetch_task_file,
|
| 168 |
-
|
| 169 |
read_spreadsheet,
|
| 170 |
get_youtube_transcript,
|
| 171 |
analyze_image,
|
| 172 |
transcribe_audio,
|
| 173 |
],
|
| 174 |
-
model= InferenceClientModel(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
additional_authorized_imports=["pandas", "requests", "re"],
|
| 176 |
instructions = ("You are an advanced CodeAgent that will show your capabilities to work in the real world by being tested in GAIA, the agent testing platform. If the question includes a task_id and mentions a file, call fetch_task_file first; route YouTube URLs to get_youtube_transcript, other URLs to visit_webpage, PDFs to read_pdf, and spreadsheets to read_spreadsheet, using web_search only when no URL or file is given,then respond with only the exact final answer value, no explanation, no prefix."
|
| 177 |
"Use the Thought Action observation to produce high quality results and only answer when you are sure you have performed the necessary steps for the task and question"
|
|
@@ -180,7 +182,12 @@ class BasicAgent:
|
|
| 180 |
"Use the PythonInterpreterTool for code interpretation in python"
|
| 181 |
"NEVER invent, guess, or simulate data you have not actually retrieved. If a "
|
| 182 |
"file cannot be fetched or a page cannot be read, say so explicitly rather "
|
| 183 |
-
"than fabricating plausible-looking data or answers."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
max_steps=20,
|
| 185 |
)
|
| 186 |
#answering questions
|
|
@@ -190,8 +197,8 @@ class BasicAgent:
|
|
| 190 |
if task_id:
|
| 191 |
full_prompt = f"{question}\n\n(task_id for this question: {task_id})"
|
| 192 |
try:
|
| 193 |
-
# Pass the
|
| 194 |
-
answer = self.agent.run(
|
| 195 |
return str(answer).strip()
|
| 196 |
except Exception as e:
|
| 197 |
import traceback
|
|
|
|
| 156 |
read_pdf = ReadPDFTool()
|
| 157 |
analyze_image = AnalyzeImageTool()
|
| 158 |
transcribe_audio = TranscribeAudioTool()
|
|
|
|
| 159 |
self.agent = CodeAgent(
|
| 160 |
tools=[
|
| 161 |
DuckDuckGoSearchTool(),
|
| 162 |
VisitWebpageTool(),
|
| 163 |
PythonInterpreterTool(),
|
| 164 |
FinalAnswerTool(),
|
|
|
|
| 165 |
fetch_task_file,
|
| 166 |
+
read_pdf,
|
| 167 |
read_spreadsheet,
|
| 168 |
get_youtube_transcript,
|
| 169 |
analyze_image,
|
| 170 |
transcribe_audio,
|
| 171 |
],
|
| 172 |
+
model= InferenceClientModel(
|
| 173 |
+
"Qwen/Qwen3-235B-A22B-Instruct-2507",
|
| 174 |
+
provider="novita",
|
| 175 |
+
temperature=0.3,
|
| 176 |
+
),
|
| 177 |
additional_authorized_imports=["pandas", "requests", "re"],
|
| 178 |
instructions = ("You are an advanced CodeAgent that will show your capabilities to work in the real world by being tested in GAIA, the agent testing platform. If the question includes a task_id and mentions a file, call fetch_task_file first; route YouTube URLs to get_youtube_transcript, other URLs to visit_webpage, PDFs to read_pdf, and spreadsheets to read_spreadsheet, using web_search only when no URL or file is given,then respond with only the exact final answer value, no explanation, no prefix."
|
| 179 |
"Use the Thought Action observation to produce high quality results and only answer when you are sure you have performed the necessary steps for the task and question"
|
|
|
|
| 182 |
"Use the PythonInterpreterTool for code interpretation in python"
|
| 183 |
"NEVER invent, guess, or simulate data you have not actually retrieved. If a "
|
| 184 |
"file cannot be fetched or a page cannot be read, say so explicitly rather "
|
| 185 |
+
"than fabricating plausible-looking data or answers. "
|
| 186 |
+
"The grader does an exact string match after light normalization, so format "
|
| 187 |
+
"the final answer exactly as the question asks: a bare number with no commas, "
|
| 188 |
+
"units, or currency symbols unless explicitly requested; as few words as "
|
| 189 |
+
"possible for a string answer, with no articles or explanatory text; and a "
|
| 190 |
+
"comma-separated list (no surrounding brackets) if multiple items are asked for."),
|
| 191 |
max_steps=20,
|
| 192 |
)
|
| 193 |
#answering questions
|
|
|
|
| 197 |
if task_id:
|
| 198 |
full_prompt = f"{question}\n\n(task_id for this question: {task_id})"
|
| 199 |
try:
|
| 200 |
+
# Pass the full prompt (including task_id) so the agent knows to fetch attached files
|
| 201 |
+
answer = self.agent.run(full_prompt)
|
| 202 |
return str(answer).strip()
|
| 203 |
except Exception as e:
|
| 204 |
import traceback
|