Alopezcordero commited on
Commit
dd1cb61
·
verified ·
1 Parent(s): 4fd4786

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -16
app.py CHANGED
@@ -66,33 +66,53 @@ class BasicAgent:
66
  message=f"""
67
  Solve this GAIA benchmark task carefully.
68
 
69
- Rules:
70
- - Use web search only when necessary.
71
- - Use python if useful.
72
- - Use read_files if an attachment exists.
73
- - Think step by step internally.
74
- - NEVER reveal reasoning.
75
- - NEVER output thoughts.
76
- - NEVER explain your answer.
77
- - Return ONLY the exact final answer.
78
- - If numberic, return only the number.
79
- - If text, return only the text.
80
- - If comma-separated list requested, output ONLY the list.
81
- - If unsure, still attempt the best possible answer.
82
- - Never say "I don't know".
83
- - Never refuse.
 
 
 
 
 
 
 
 
 
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
- if "Thoughts" in result:
 
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):