Paperbag commited on
Commit
b36ab47
·
1 Parent(s): d4fac05

feat: update system prompt for improved research strategy and enhance answer normalization in response processing

Browse files
Homework.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:200f767e732b49efef5c05d128903ee4d2c34e66fdce7f5593ac123b2e637673
3
+ size 280868
__pycache__/agent.cpython-39.pyc CHANGED
Binary files a/__pycache__/agent.cpython-39.pyc and b/__pycache__/agent.cpython-39.pyc differ
 
agent.py CHANGED
@@ -37,9 +37,31 @@ def is_reversed_text(question: str) -> bool:
37
  return rev_valid > orig_valid
38
 
39
 
40
- SYSTEM_PROMPT = """Answer with FINAL ANSWER: <value>.
41
- Use tools to research. Read full Wikipedia pages (browse_url) rather than just searching.
42
- Never repeat the same tool call."""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
 
45
  def call_model(state: AgentState):
@@ -102,6 +124,16 @@ def call_tool(state: AgentState):
102
  ))
103
  continue
104
 
 
 
 
 
 
 
 
 
 
 
105
  tool = tools_by_name[tool_name]
106
  print(f"Calling tool: {tool_name} with args: {tool_args}", flush=True)
107
  try:
 
37
  return rev_valid > orig_valid
38
 
39
 
40
+ SYSTEM_PROMPT = """RESEARCH STRATEGY:
41
+ 1. Search (web_search or wiki_search) to find sources
42
+ 2. Read full pages (wiki_page for Wikipedia, browse_url for other sites)
43
+ 3. Process data (python_repl for calculations, parse_spreadsheet for xlsx/csv)
44
+ 4. Answer with FINAL ANSWER: <value>
45
+
46
+ TOOL SELECTION:
47
+ - web_search: General web search for facts, URLs, news. Returns 5 results with title+URL.
48
+ - wiki_search: Find Wikipedia pages on a topic (returns 2 short snippets only).
49
+ - wiki_page: Read a FULL Wikipedia article by exact title. Use AFTER wiki_search when you need complete content.
50
+ - browse_url: Read any webpage's full text content from a URL.
51
+ - read_file: Text files (.txt, .py, .md), PDFs. NOT for spreadsheets, audio, or images.
52
+ - parse_spreadsheet: Excel (.xlsx) and CSV files. Always use this for spreadsheets.
53
+ - transcribe_audio: Audio files (.mp3, .wav). The ONLY tool for audio — use it immediately.
54
+ - python_repl: Calculations, data analysis, PDF parsing, file processing. Variables persist between calls. Use libraries already installed (pandas, numpy, PIL, PyPDF2).
55
+ - get_youtube_transcript: YouTube video transcripts only.
56
+
57
+ RULES:
58
+ - Never call the same tool with the same arguments twice.
59
+ - When wiki_search returns short snippets, follow up with wiki_page for full content.
60
+ - After getting tool results, analyze them — don't immediately search again with slightly different queries.
61
+ - Audio files can ONLY be read with transcribe_audio. Do not use read_file on .mp3/.wav.
62
+ - Images (.png/.jpg) cannot be analyzed — no vision model. Skip file-based analysis.
63
+ - For spreadsheets: parse_spreadsheet to view, then python_repl to compute if needed.
64
+ - Don't install packages in python_repl — use what's already available."""
65
 
66
 
67
  def call_model(state: AgentState):
 
124
  ))
125
  continue
126
 
127
+ # Anti-loop: if exact same tool+args already called, warn instead
128
+ previous_same = [h for h in tool_call_history[:-1] if h == key]
129
+ if len(previous_same) > 0:
130
+ tool_outputs.append(ToolMessage(
131
+ content=f"SKIPPED: You already called {key}. Try a different tool or query.",
132
+ tool_call_id=tool_call["id"],
133
+ name=tool_name
134
+ ))
135
+ continue
136
+
137
  tool = tools_by_name[tool_name]
138
  print(f"Calling tool: {tool_name} with args: {tool_args}", flush=True)
139
  try:
gaia_results.csv CHANGED
@@ -1,7 +1,7 @@
1
  task_id,question,submitted_answer,ground_truth,correct
2
  8e867cd7-cff9-4e6c-867a-ff5ddc2550be,How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia.,,3,False
3
  a1e91b78-d3d8-4675-bb8d-62741b4b68a6,"In the video https://www.youtube.com/watch?v=L1vXCYZAYYM, what is the highest number of bird species to be on camera simultaneously?",,3,False
4
- 2d83110e-a098-4ebb-9987-066c06fa42d0,".rewsna eht sa ""tfel"" drow eht fo etisoppo eht etirw ,ecnetnes siht dnatsrednu uoy fI",left,Right,False
5
  cca530fc-4052-43b2-b130-b30968d8aa44,Review the chess position provided in the image. It is black's turn. Provide the correct next move for black which guarantees a win. Please provide your response in algebraic notation.,,Rd5,False
6
  4fc2f1ae-8625-45b5-ab34-ad4433bc21f8,Who nominated the only Featured Article on English Wikipedia about a dinosaur that was promoted in November 2016?,,FunkMonk,False
7
  6f37996b-2ac7-44b0-8e68-6d28256631b4,"Given this table defining * on the set S = {a, b, c, d, e}
@@ -14,11 +14,11 @@ cca530fc-4052-43b2-b130-b30968d8aa44,Review the chess position provided in the i
14
  |d|b|e|b|e|d|
15
  |e|d|b|a|d|c|
16
 
17
- provide the subset of S involved in any possible counter-examples that prove * is not commutative. Provide your answer as a comma separated list of the elements in the set in alphabetical order.","b,e","b, e",False
18
  9d191bce-651d-4746-be2d-7ef8ecadb9c2,"Examine the video at https://www.youtube.com/watch?v=1htKBjuUWec.
19
 
20
- What does Teal'c say in response to the question ""Isn't that hot?""",,Extremely,False
21
- cabe07ed-9eca-40ea-8ead-410ef5e83f91,What is the surname of the equine veterinarian mentioned in 1.E Exercises from the chemistry materials licensed by Marisa Alviar-Agnew & Henry Agnew under the CK-12 license in LibreText's Introductory Chemistry materials as compiled 08/21/2023?,,Louvrier,False
22
  3cef3a44-215e-4aed-8e3b-b1e3f08063b7,"I'm making a grocery list for my mom, but she's a professor of botany and she's a real stickler when it comes to categorizing things. I need to add different foods to different categories on the grocery list, but if I make a mistake, she won't buy anything inserted in the wrong category. Here's the list I have so far:
23
 
24
  milk, eggs, flour, whole bean coffee, Oreos, sweet potatoes, fresh basil, plums, green beans, rice, corn, bell pepper, whole allspice, acorns, broccoli, celery, zucchini, lettuce, peanuts
@@ -30,14 +30,14 @@ In your response, please only list the ingredients, not any measurements. So if
30
 
31
  Please format your response as a comma separated list of ingredients. Also, please alphabetize the ingredients.",,"cornstarch, freshly squeezed lemon juice, granulated sugar, pure vanilla extract, ripe strawberries",False
32
  305ac316-eef6-4446-960a-92d80d542f82,Who did the actor who played Ray in the Polish-language version of Everybody Loves Raymond play in Magda M.? Give only the first name.,,Wojciech,False
33
- f918266a-b3e0-4914-865d-4faa564f1aef,What is the final numeric output from the attached Python code?,,0,False
34
- 3f57289b-8c60-48be-bd80-01f8099ca449,How many at bats did the Yankee with the most walks in the 1977 regular season have that same season?,519,519,True
35
  1f975693-876d-457b-a649-393859e79bf3,"Hi, I was out sick from my classes on Friday, so I'm trying to figure out what I need to study for my Calculus mid-term next week. My friend from class sent me an audio recording of Professor Willowbrook giving out the recommended reading for the test, but my headphones are broken :(
36
 
37
  Could you please listen to the recording for me and tell me the page numbers I'm supposed to go over? I've attached a file called Homework.mp3 that has the recording. Please provide just the page numbers as a comma-delimited list. And please provide the list in ascending order.",,"132, 133, 134, 197, 245",False
38
- 840bfca7-4f7b-481a-8794-c560c340185d,"On June 6, 2023, an article by Carolyn Collins Petersen was published in Universe Today. This article mentions a team that produced a paper about their observations, linked at the bottom of the article. Find this paper. Under what NASA award number was the work performed by R. G. Arendt supported by?",,80GSFC21M0002,False
39
  bda648d7-d618-4883-88f4-3466eabd860e,Where were the Vietnamese specimens described by Kuznetzov in Nedoshivina's 2010 paper eventually deposited? Just give me the city name without abbreviations.,Saint Petersburg,Saint Petersburg,True
40
- cf106601-ab4f-4af9-b045-5295fe67b37d,"What country had the least number of athletes at the 1928 Summer Olympics? If there's a tie for a number of athletes, return the first in alphabetical order. Give the IOC country code as your answer.",,CUB,False
41
  a0c07678-e491-4bbc-8f0b-07405144218f,"Who are the pitchers with the number before and after Taishō Tamai's number as of July 2023? Give them to me in the form Pitcher Before, Pitcher After, use their last names only, in Roman characters.",,"Yoshida, Uehara",False
42
  7bd855d8-463d-4ed5-93ca-5fe35145f733,The attached Excel file contains the sales of menu items for a local fast-food chain. What were the total sales that the chain made from food (not including drinks)? Express your answer in USD with two decimal places.,89706.00,89706.00,True
43
  5a0c1adf-205e-4841-a666-7c3ef95def9d,What is the first name of the only Malko Competition recipient from the 20th Century (after 1977) whose nationality on record is a country that no longer exists?,,Claus,False
 
1
  task_id,question,submitted_answer,ground_truth,correct
2
  8e867cd7-cff9-4e6c-867a-ff5ddc2550be,How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia.,,3,False
3
  a1e91b78-d3d8-4675-bb8d-62741b4b68a6,"In the video https://www.youtube.com/watch?v=L1vXCYZAYYM, what is the highest number of bird species to be on camera simultaneously?",,3,False
4
+ 2d83110e-a098-4ebb-9987-066c06fa42d0,".rewsna eht sa ""tfel"" drow eht fo etisoppo eht etirw ,ecnetnes siht dnatsrednu uoy fI",right,Right,True
5
  cca530fc-4052-43b2-b130-b30968d8aa44,Review the chess position provided in the image. It is black's turn. Provide the correct next move for black which guarantees a win. Please provide your response in algebraic notation.,,Rd5,False
6
  4fc2f1ae-8625-45b5-ab34-ad4433bc21f8,Who nominated the only Featured Article on English Wikipedia about a dinosaur that was promoted in November 2016?,,FunkMonk,False
7
  6f37996b-2ac7-44b0-8e68-6d28256631b4,"Given this table defining * on the set S = {a, b, c, d, e}
 
14
  |d|b|e|b|e|d|
15
  |e|d|b|a|d|c|
16
 
17
+ provide the subset of S involved in any possible counter-examples that prove * is not commutative. Provide your answer as a comma separated list of the elements in the set in alphabetical order.","b, e","b, e",True
18
  9d191bce-651d-4746-be2d-7ef8ecadb9c2,"Examine the video at https://www.youtube.com/watch?v=1htKBjuUWec.
19
 
20
+ What does Teal'c say in response to the question ""Isn't that hot?""","Teal'c responds with **""Extremely.""**",Extremely,False
21
+ cabe07ed-9eca-40ea-8ead-410ef5e83f91,What is the surname of the equine veterinarian mentioned in 1.E Exercises from the chemistry materials licensed by Marisa Alviar-Agnew & Henry Agnew under the CK-12 license in LibreText's Introductory Chemistry materials as compiled 08/21/2023?,Louvrier,Louvrier,True
22
  3cef3a44-215e-4aed-8e3b-b1e3f08063b7,"I'm making a grocery list for my mom, but she's a professor of botany and she's a real stickler when it comes to categorizing things. I need to add different foods to different categories on the grocery list, but if I make a mistake, she won't buy anything inserted in the wrong category. Here's the list I have so far:
23
 
24
  milk, eggs, flour, whole bean coffee, Oreos, sweet potatoes, fresh basil, plums, green beans, rice, corn, bell pepper, whole allspice, acorns, broccoli, celery, zucchini, lettuce, peanuts
 
30
 
31
  Please format your response as a comma separated list of ingredients. Also, please alphabetize the ingredients.",,"cornstarch, freshly squeezed lemon juice, granulated sugar, pure vanilla extract, ripe strawberries",False
32
  305ac316-eef6-4446-960a-92d80d542f82,Who did the actor who played Ray in the Polish-language version of Everybody Loves Raymond play in Magda M.? Give only the first name.,,Wojciech,False
33
+ f918266a-b3e0-4914-865d-4faa564f1aef,What is the final numeric output from the attached Python code?,None,0,False
34
+ 3f57289b-8c60-48be-bd80-01f8099ca449,How many at bats did the Yankee with the most walks in the 1977 regular season have that same season?,,519,False
35
  1f975693-876d-457b-a649-393859e79bf3,"Hi, I was out sick from my classes on Friday, so I'm trying to figure out what I need to study for my Calculus mid-term next week. My friend from class sent me an audio recording of Professor Willowbrook giving out the recommended reading for the test, but my headphones are broken :(
36
 
37
  Could you please listen to the recording for me and tell me the page numbers I'm supposed to go over? I've attached a file called Homework.mp3 that has the recording. Please provide just the page numbers as a comma-delimited list. And please provide the list in ascending order.",,"132, 133, 134, 197, 245",False
38
+ 840bfca7-4f7b-481a-8794-c560c340185d,"On June 6, 2023, an article by Carolyn Collins Petersen was published in Universe Today. This article mentions a team that produced a paper about their observations, linked at the bottom of the article. Find this paper. Under what NASA award number was the work performed by R. G. Arendt supported by?",The work performed by R. G. Arendt was supported by NASA award number **80GSFC21M0002**.,80GSFC21M0002,False
39
  bda648d7-d618-4883-88f4-3466eabd860e,Where were the Vietnamese specimens described by Kuznetzov in Nedoshivina's 2010 paper eventually deposited? Just give me the city name without abbreviations.,Saint Petersburg,Saint Petersburg,True
40
+ cf106601-ab4f-4af9-b045-5295fe67b37d,"What country had the least number of athletes at the 1928 Summer Olympics? If there's a tie for a number of athletes, return the first in alphabetical order. Give the IOC country code as your answer.",CUB,CUB,True
41
  a0c07678-e491-4bbc-8f0b-07405144218f,"Who are the pitchers with the number before and after Taishō Tamai's number as of July 2023? Give them to me in the form Pitcher Before, Pitcher After, use their last names only, in Roman characters.",,"Yoshida, Uehara",False
42
  7bd855d8-463d-4ed5-93ca-5fe35145f733,The attached Excel file contains the sales of menu items for a local fast-food chain. What were the total sales that the chain made from food (not including drinks)? Express your answer in USD with two decimal places.,89706.00,89706.00,True
43
  5a0c1adf-205e-4841-a666-7c3ef95def9d,What is the first name of the only Malko Competition recipient from the 20th Century (after 1977) whose nationality on record is a country that no longer exists?,,Claus,False
gaia_results.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
- "score": 20.0,
3
- "correct": 4,
4
  "total": 20,
5
  "results": [
6
  {
@@ -20,9 +20,9 @@
20
  {
21
  "task_id": "2d83110e-a098-4ebb-9987-066c06fa42d0",
22
  "question": ".rewsna eht sa \"tfel\" drow eht fo etisoppo eht etirw ,ecnetnes siht dnatsrednu uoy fI",
23
- "submitted_answer": "left",
24
  "ground_truth": "Right",
25
- "correct": false
26
  },
27
  {
28
  "task_id": "cca530fc-4052-43b2-b130-b30968d8aa44",
@@ -41,23 +41,23 @@
41
  {
42
  "task_id": "6f37996b-2ac7-44b0-8e68-6d28256631b4",
43
  "question": "Given this table defining * on the set S = {a, b, c, d, e}\n\n|*|a|b|c|d|e|\n|---|---|---|---|---|---|\n|a|a|b|c|b|d|\n|b|b|c|a|e|c|\n|c|c|a|b|b|a|\n|d|b|e|b|e|d|\n|e|d|b|a|d|c|\n\nprovide the subset of S involved in any possible counter-examples that prove * is not commutative. Provide your answer as a comma separated list of the elements in the set in alphabetical order.",
44
- "submitted_answer": "b,e",
45
  "ground_truth": "b, e",
46
- "correct": false
47
  },
48
  {
49
  "task_id": "9d191bce-651d-4746-be2d-7ef8ecadb9c2",
50
  "question": "Examine the video at https://www.youtube.com/watch?v=1htKBjuUWec.\n\nWhat does Teal'c say in response to the question \"Isn't that hot?\"",
51
- "submitted_answer": "",
52
  "ground_truth": "Extremely",
53
  "correct": false
54
  },
55
  {
56
  "task_id": "cabe07ed-9eca-40ea-8ead-410ef5e83f91",
57
  "question": "What is the surname of the equine veterinarian mentioned in 1.E Exercises from the chemistry materials licensed by Marisa Alviar-Agnew & Henry Agnew under the CK-12 license in LibreText's Introductory Chemistry materials as compiled 08/21/2023?",
58
- "submitted_answer": "",
59
  "ground_truth": "Louvrier",
60
- "correct": false
61
  },
62
  {
63
  "task_id": "3cef3a44-215e-4aed-8e3b-b1e3f08063b7",
@@ -83,16 +83,16 @@
83
  {
84
  "task_id": "f918266a-b3e0-4914-865d-4faa564f1aef",
85
  "question": "What is the final numeric output from the attached Python code?",
86
- "submitted_answer": "",
87
  "ground_truth": "0",
88
  "correct": false
89
  },
90
  {
91
  "task_id": "3f57289b-8c60-48be-bd80-01f8099ca449",
92
  "question": "How many at bats did the Yankee with the most walks in the 1977 regular season have that same season?",
93
- "submitted_answer": "519",
94
  "ground_truth": "519",
95
- "correct": true
96
  },
97
  {
98
  "task_id": "1f975693-876d-457b-a649-393859e79bf3",
@@ -104,7 +104,7 @@
104
  {
105
  "task_id": "840bfca7-4f7b-481a-8794-c560c340185d",
106
  "question": "On June 6, 2023, an article by Carolyn Collins Petersen was published in Universe Today. This article mentions a team that produced a paper about their observations, linked at the bottom of the article. Find this paper. Under what NASA award number was the work performed by R. G. Arendt supported by?",
107
- "submitted_answer": "",
108
  "ground_truth": "80GSFC21M0002",
109
  "correct": false
110
  },
@@ -118,9 +118,9 @@
118
  {
119
  "task_id": "cf106601-ab4f-4af9-b045-5295fe67b37d",
120
  "question": "What country had the least number of athletes at the 1928 Summer Olympics? If there's a tie for a number of athletes, return the first in alphabetical order. Give the IOC country code as your answer.",
121
- "submitted_answer": "",
122
  "ground_truth": "CUB",
123
- "correct": false
124
  },
125
  {
126
  "task_id": "a0c07678-e491-4bbc-8f0b-07405144218f",
 
1
  {
2
+ "score": 35.0,
3
+ "correct": 7,
4
  "total": 20,
5
  "results": [
6
  {
 
20
  {
21
  "task_id": "2d83110e-a098-4ebb-9987-066c06fa42d0",
22
  "question": ".rewsna eht sa \"tfel\" drow eht fo etisoppo eht etirw ,ecnetnes siht dnatsrednu uoy fI",
23
+ "submitted_answer": "right",
24
  "ground_truth": "Right",
25
+ "correct": true
26
  },
27
  {
28
  "task_id": "cca530fc-4052-43b2-b130-b30968d8aa44",
 
41
  {
42
  "task_id": "6f37996b-2ac7-44b0-8e68-6d28256631b4",
43
  "question": "Given this table defining * on the set S = {a, b, c, d, e}\n\n|*|a|b|c|d|e|\n|---|---|---|---|---|---|\n|a|a|b|c|b|d|\n|b|b|c|a|e|c|\n|c|c|a|b|b|a|\n|d|b|e|b|e|d|\n|e|d|b|a|d|c|\n\nprovide the subset of S involved in any possible counter-examples that prove * is not commutative. Provide your answer as a comma separated list of the elements in the set in alphabetical order.",
44
+ "submitted_answer": "b, e",
45
  "ground_truth": "b, e",
46
+ "correct": true
47
  },
48
  {
49
  "task_id": "9d191bce-651d-4746-be2d-7ef8ecadb9c2",
50
  "question": "Examine the video at https://www.youtube.com/watch?v=1htKBjuUWec.\n\nWhat does Teal'c say in response to the question \"Isn't that hot?\"",
51
+ "submitted_answer": "Teal'c responds with **\"Extremely.\"**",
52
  "ground_truth": "Extremely",
53
  "correct": false
54
  },
55
  {
56
  "task_id": "cabe07ed-9eca-40ea-8ead-410ef5e83f91",
57
  "question": "What is the surname of the equine veterinarian mentioned in 1.E Exercises from the chemistry materials licensed by Marisa Alviar-Agnew & Henry Agnew under the CK-12 license in LibreText's Introductory Chemistry materials as compiled 08/21/2023?",
58
+ "submitted_answer": "Louvrier",
59
  "ground_truth": "Louvrier",
60
+ "correct": true
61
  },
62
  {
63
  "task_id": "3cef3a44-215e-4aed-8e3b-b1e3f08063b7",
 
83
  {
84
  "task_id": "f918266a-b3e0-4914-865d-4faa564f1aef",
85
  "question": "What is the final numeric output from the attached Python code?",
86
+ "submitted_answer": "None",
87
  "ground_truth": "0",
88
  "correct": false
89
  },
90
  {
91
  "task_id": "3f57289b-8c60-48be-bd80-01f8099ca449",
92
  "question": "How many at bats did the Yankee with the most walks in the 1977 regular season have that same season?",
93
+ "submitted_answer": "",
94
  "ground_truth": "519",
95
+ "correct": false
96
  },
97
  {
98
  "task_id": "1f975693-876d-457b-a649-393859e79bf3",
 
104
  {
105
  "task_id": "840bfca7-4f7b-481a-8794-c560c340185d",
106
  "question": "On June 6, 2023, an article by Carolyn Collins Petersen was published in Universe Today. This article mentions a team that produced a paper about their observations, linked at the bottom of the article. Find this paper. Under what NASA award number was the work performed by R. G. Arendt supported by?",
107
+ "submitted_answer": "The work performed by R.\u202fG.\u202fArendt was supported by NASA award number **80GSFC21M0002**.",
108
  "ground_truth": "80GSFC21M0002",
109
  "correct": false
110
  },
 
118
  {
119
  "task_id": "cf106601-ab4f-4af9-b045-5295fe67b37d",
120
  "question": "What country had the least number of athletes at the 1928 Summer Olympics? If there's a tie for a number of athletes, return the first in alphabetical order. Give the IOC country code as your answer.",
121
+ "submitted_answer": "CUB",
122
  "ground_truth": "CUB",
123
+ "correct": true
124
  },
125
  {
126
  "task_id": "a0c07678-e491-4bbc-8f0b-07405144218f",
llm/providers/opencode_zen.py CHANGED
@@ -121,4 +121,4 @@ def invoke(messages, tools, model_name: str = None):
121
 
122
 
123
  def get_models():
124
- return ["deepseek-v4-flash-free", "nemotron-3-super-free", "big-pickle"]
 
121
 
122
 
123
  def get_models():
124
+ return ["nemotron-3-super-free", "deepseek-v4-flash-free", "big-pickle"]
run_local.py CHANGED
@@ -19,25 +19,30 @@ def extract_answer(content) -> str:
19
  cleaned = content.strip()
20
  if not cleaned:
21
  return ""
22
- # Try FINAL ANSWER: pattern (most specific first)
23
  match = re.search(r'FINAL ANSWER:\s*(.+?)(?:\n|$)', cleaned, re.IGNORECASE)
24
  if match:
25
  return match.group(1).strip()
26
- # Try "Answer:" pattern
27
  match = re.search(r'Answer:\s*(.+?)(?:\n|$)', cleaned, re.IGNORECASE)
28
  if match:
29
  return match.group(1).strip()
30
- # Try "answer is" pattern
31
  match = re.search(r'(?:the\s+)?answer\s+is\s*:?\s*(.+?)(?:\.|$)', cleaned, re.IGNORECASE)
32
  if match:
33
  return match.group(1).strip()
34
- # Use last non-empty line
35
  lines = [l.strip() for l in cleaned.split('\n') if l.strip()]
36
  if lines:
37
  return lines[-1]
38
  return cleaned
39
  return str(content)
40
 
 
 
 
 
 
 
 
 
 
41
  class BasicAgent:
42
  def __init__(self):
43
  print("BasicAgent initialized.")
@@ -109,7 +114,22 @@ def main():
109
  if file_name:
110
  resolved_path = file_extract(file_name, task_id)
111
  if resolved_path:
112
- question_text += f"\n\n[Attached File Local Path: {resolved_path}]"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
 
114
  print(f"\n[{i+1}/{len(questions_data)}] Task: {task_id[:20]}...")
115
 
@@ -119,7 +139,7 @@ def main():
119
  answer = f"ERROR: {e}"
120
 
121
  ground_truth = answer_map.get(task_id, "NOT FOUND")
122
- is_correct = str(answer).strip().lower() == str(ground_truth).strip().lower()
123
 
124
  results.append({
125
  "task_id": task_id,
 
19
  cleaned = content.strip()
20
  if not cleaned:
21
  return ""
 
22
  match = re.search(r'FINAL ANSWER:\s*(.+?)(?:\n|$)', cleaned, re.IGNORECASE)
23
  if match:
24
  return match.group(1).strip()
 
25
  match = re.search(r'Answer:\s*(.+?)(?:\n|$)', cleaned, re.IGNORECASE)
26
  if match:
27
  return match.group(1).strip()
 
28
  match = re.search(r'(?:the\s+)?answer\s+is\s*:?\s*(.+?)(?:\.|$)', cleaned, re.IGNORECASE)
29
  if match:
30
  return match.group(1).strip()
 
31
  lines = [l.strip() for l in cleaned.split('\n') if l.strip()]
32
  if lines:
33
  return lines[-1]
34
  return cleaned
35
  return str(content)
36
 
37
+
38
+ def normalize_answer(s: str) -> str:
39
+ s = s.strip().lower()
40
+ s = re.sub(r'^[\$€£¥]', '', s)
41
+ s = s.replace(',', '')
42
+ s = s.rstrip('*')
43
+ s = s.strip()
44
+ return s
45
+
46
  class BasicAgent:
47
  def __init__(self):
48
  print("BasicAgent initialized.")
 
114
  if file_name:
115
  resolved_path = file_extract(file_name, task_id)
116
  if resolved_path:
117
+ import os as _os
118
+ _ext = _os.path.splitext(resolved_path)[1].lower()
119
+ _tips = {
120
+ ".xlsx": "Tip: This is a spreadsheet. Use parse_spreadsheet to read it.",
121
+ ".xls": "Tip: This is a spreadsheet. Use parse_spreadsheet to read it.",
122
+ ".csv": "Tip: This is a CSV file. Use parse_spreadsheet to read it.",
123
+ ".mp3": "Tip: This is an audio file. Use transcribe_audio to transcribe it.",
124
+ ".wav": "Tip: This is an audio file. Use transcribe_audio to transcribe it.",
125
+ ".png": "Tip: This is an image — no vision model available. Skip file-based analysis.",
126
+ ".jpg": "Tip: This is an image — no vision model available. Skip file-based analysis.",
127
+ ".jpeg": "Tip: This is an image — no vision model available. Skip file-based analysis.",
128
+ ".py": "Tip: This is a Python script. Use read_file to view, then python_repl to run it.",
129
+ ".pdf": "Tip: This is a PDF. Use read_file or python_repl with PyPDF2 to read it.",
130
+ }
131
+ _hint = _tips.get(_ext, "")
132
+ question_text += f"\n\n[Attached File Local Path: {resolved_path}]\n{_hint}"
133
 
134
  print(f"\n[{i+1}/{len(questions_data)}] Task: {task_id[:20]}...")
135
 
 
139
  answer = f"ERROR: {e}"
140
 
141
  ground_truth = answer_map.get(task_id, "NOT FOUND")
142
+ is_correct = normalize_answer(str(answer)) == normalize_answer(str(ground_truth))
143
 
144
  results.append({
145
  "task_id": task_id,