LamiaYT commited on
Commit
5041bd8
·
1 Parent(s): 5dd6ab9
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -189,9 +189,14 @@ class ImprovedGAIAAgent:
189
 
190
  # Clean up response to be GAIA-compliant (short, exact)
191
  if response:
192
- # Remove common prefixes/suffixes
193
  response = re.sub(r'^(answer:|the answer is:?|answer is:?)\s*', '', response, flags=re.IGNORECASE)
194
- response = re.sub(r'\s*(\.|\?|!)*
 
 
 
 
 
195
 
196
  return response if response else ""
197
 
 
189
 
190
  # Clean up response to be GAIA-compliant (short, exact)
191
  if response:
192
+ # Remove common prefixes
193
  response = re.sub(r'^(answer:|the answer is:?|answer is:?)\s*', '', response, flags=re.IGNORECASE)
194
+
195
+ # Remove common trailing punctuation or padding
196
+ response = re.sub(r'\s*(\.*|\?+|!+)\s*$', '', response)
197
+
198
+ # Optional: Collapse excessive whitespace inside the response
199
+ response = re.sub(r'\s+', ' ', response).strip()
200
 
201
  return response if response else ""
202