Spaces:
Runtime error
Runtime error
fix
Browse files
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
|
| 193 |
response = re.sub(r'^(answer:|the answer is:?|answer is:?)\s*', '', response, flags=re.IGNORECASE)
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|