Update app.py
Browse files
app.py
CHANGED
|
@@ -66,33 +66,53 @@ class BasicAgent:
|
|
| 66 |
message=f"""
|
| 67 |
Solve this GAIA benchmark task carefully.
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
Question: {question}
|
| 85 |
Attachment path: {file_path}
|
| 86 |
"""
|
| 87 |
result = self.agent.run(message)
|
| 88 |
if result is None:
|
| 89 |
return ""
|
|
|
|
| 90 |
result = str(result).strip()
|
|
|
|
| 91 |
if "Final Answer" in result:
|
| 92 |
result = result.split("Final Answer:")[-1].strip()
|
| 93 |
-
|
|
|
|
| 94 |
lines = result.splitlines()
|
| 95 |
result = lines[-1].strip()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
return result
|
| 97 |
|
| 98 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
|
|
| 66 |
message=f"""
|
| 67 |
Solve this GAIA benchmark task carefully.
|
| 68 |
|
| 69 |
+
CRITICAL RULES:
|
| 70 |
+
1. Return ONLY the exact answer.
|
| 71 |
+
2. Never explain reasoning.
|
| 72 |
+
3. Never write thoughts.
|
| 73 |
+
4. Never say "After searching"
|
| 74 |
+
5. Never include "Final Answer:"
|
| 75 |
+
6. Never output sentences unless requested.
|
| 76 |
+
7. If they ask for:
|
| 77 |
+
-a number: return only the number
|
| 78 |
+
-first name: return only first name
|
| 79 |
+
-surname: return only surname
|
| 80 |
+
-chess move: return only algebraic notation
|
| 81 |
+
-comma-separated list: only the list
|
| 82 |
+
8. If an attachment exists, ALWAYS read it.
|
| 83 |
+
9. Use web search for factual questions.
|
| 84 |
+
10. If uncertain, still give best concise answer.
|
| 85 |
+
11. NEVER include any extra text before or after the answer.
|
| 86 |
+
|
| 87 |
+
BAD:
|
| 88 |
+
"The answer is 485"
|
| 89 |
+
|
| 90 |
+
Good:
|
| 91 |
+
485
|
| 92 |
+
|
| 93 |
Question: {question}
|
| 94 |
Attachment path: {file_path}
|
| 95 |
"""
|
| 96 |
result = self.agent.run(message)
|
| 97 |
if result is None:
|
| 98 |
return ""
|
| 99 |
+
|
| 100 |
result = str(result).strip()
|
| 101 |
+
|
| 102 |
if "Final Answer" in result:
|
| 103 |
result = result.split("Final Answer:")[-1].strip()
|
| 104 |
+
|
| 105 |
+
if "Here is the final answer" in result:
|
| 106 |
lines = result.splitlines()
|
| 107 |
result = lines[-1].strip()
|
| 108 |
+
|
| 109 |
+
if "Thoughts:" in result:
|
| 110 |
+
result = result.split("Thoughts:")[-1].strip()
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
result = result.split("\n")[0].strip()
|
| 115 |
+
result = result.strip('"').strip("'")
|
| 116 |
return result
|
| 117 |
|
| 118 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|