Francesco-A commited on
Commit
a92388a
·
1 Parent(s): 720cb5b

Agent and app update

Browse files

Agent:
1 - switched back to gemini-2.5-flash-lite
2 - FINAL ANSWER format clarification

App:
implemented question filter logic

Files changed (2) hide show
  1. agent.py +7 -5
  2. app.py +10 -1
agent.py CHANGED
@@ -81,18 +81,20 @@ Follow a **PLAN → ACT → OBSERVE** loop:
81
 
82
  ### 4. Additional instructions for the following tasks provided by GAIA team
83
  - You are a general AI assistant. I will ask you a question. Do not reveal your internal reasoning. Only the content inside FinalAnswerTool will be evaluated.
84
- - Finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
 
85
 
86
  ### 5. To provide the final answer, you MUST call the final_answer tool inside a <code> block.
87
 
88
  - Example of how to end the task:
89
 
 
90
  Thought: I have found the answer. I will now provide it.
 
91
  <code>
92
- final_answer("FINAL ANSWER: The capital of France is Paris")
93
  </code>
94
 
95
- \n\n
96
  """
97
 
98
  # Instruction for Tool-Based Agents (BasicAgent and Gemini-Standard)
@@ -146,8 +148,8 @@ class BasicAgent:
146
  return self.basic_agent.run(prompt)
147
 
148
  class GeminiAgent:
149
- # def __init__(self, native_multimodal: bool = True, model_id: str = "gemini/gemini-2.5-flash-lite"):
150
- def __init__(self, native_multimodal: bool = True, model_id: str = "gemini/gemini-3-flash-preview"):
151
  self.native_multimodal = native_multimodal
152
  if self.native_multimodal:
153
  client = genai.Client(api_key=os.environ.get("GOOGLE_API_KEY"))
 
81
 
82
  ### 4. Additional instructions for the following tasks provided by GAIA team
83
  - You are a general AI assistant. I will ask you a question. Do not reveal your internal reasoning. Only the content inside FinalAnswerTool will be evaluated.
84
+ - YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
85
+ - Do NOT include "FINAL ANSWER:" in your final answer text. For example: if the question is "What is the capital of Spain?", respond with "Madrid". It is exact and expected answer.
86
 
87
  ### 5. To provide the final answer, you MUST call the final_answer tool inside a <code> block.
88
 
89
  - Example of how to end the task:
90
 
91
+ Question: "What is the capital of France?"
92
  Thought: I have found the answer. I will now provide it.
93
+
94
  <code>
95
+ final_answer("Paris")
96
  </code>
97
 
 
98
  """
99
 
100
  # Instruction for Tool-Based Agents (BasicAgent and Gemini-Standard)
 
148
  return self.basic_agent.run(prompt)
149
 
150
  class GeminiAgent:
151
+ def __init__(self, native_multimodal: bool = True, model_id: str = "gemini/gemini-2.5-flash-lite"):
152
+ # def __init__(self, native_multimodal: bool = True, model_id: str = "gemini/gemini-3-flash-preview"):
153
  self.native_multimodal = native_multimodal
154
  if self.native_multimodal:
155
  client = genai.Client(api_key=os.environ.get("GOOGLE_API_KEY"))
app.py CHANGED
@@ -94,12 +94,21 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
94
  print("🛑 STOP BUTTON PRESSED: Breaking loop and submitting partial results.")
95
  results_log.append({"Task ID": "MANUAL_STOP", "Question": "N/A", "Submitted Answer": "USER INTERRUPTED"})
96
  break
97
-
98
  task_id = item.get("task_id")
99
  question_text = item.get("question")
100
  if not task_id or question_text is None:
101
  print(f"Skipping item with missing task_id or question: {item}")
102
  continue
 
 
 
 
 
 
 
 
 
103
  try:
104
  submitted_answer = agent(question_text)
105
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
 
94
  print("🛑 STOP BUTTON PRESSED: Breaking loop and submitting partial results.")
95
  results_log.append({"Task ID": "MANUAL_STOP", "Question": "N/A", "Submitted Answer": "USER INTERRUPTED"})
96
  break
97
+
98
  task_id = item.get("task_id")
99
  question_text = item.get("question")
100
  if not task_id or question_text is None:
101
  print(f"Skipping item with missing task_id or question: {item}")
102
  continue
103
+
104
+ # CONTENT FILTER SKIP (using .lower() for case-insensitivity)
105
+ filter_keywords = ["chess"]
106
+ question_words = set(question_text.lower().split()) # Only matches if the exact word is used
107
+ if any(word in question_words for word in filter_keywords):
108
+ print(f"Skipping filtered question: {item}")
109
+ results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": "SKIPPED: KEYWORD FILTER LOGIC"})
110
+ continue
111
+
112
  try:
113
  submitted_answer = agent(question_text)
114
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})