Spaces:
Sleeping
Sleeping
Update tools/FinalAnswerTool.py
Browse files- tools/FinalAnswerTool.py +2 -2
tools/FinalAnswerTool.py
CHANGED
|
@@ -10,7 +10,7 @@ settings = Settings()
|
|
| 10 |
print(settings.llm_model_id)
|
| 11 |
class FinalAnswerTool(Tool):
|
| 12 |
name = "final_answer"
|
| 13 |
-
description = "Provides the exact, few comma separated words or a single final answer to the given question."
|
| 14 |
inputs = {
|
| 15 |
"answer": {"type": "string", "description": "The final, correctly formatted answer string."},
|
| 16 |
}
|
|
@@ -26,7 +26,7 @@ class FinalAnswerTool(Tool):
|
|
| 26 |
answer = match.group(1)
|
| 27 |
# Remove LaTeX symbols and keep letters, digits, commas
|
| 28 |
answer = re.sub(r'[\$\{\}\\]', '', answer)
|
| 29 |
-
answer = re.sub(r'[^A-Za-z0-9
|
| 30 |
answer = " ".join(answer.split()) # Remove extra spaces
|
| 31 |
|
| 32 |
if not answer:
|
|
|
|
| 10 |
print(settings.llm_model_id)
|
| 11 |
class FinalAnswerTool(Tool):
|
| 12 |
name = "final_answer"
|
| 13 |
+
description = "Return only the final answer as a clean string. Provides the exact, few comma separated words or a single final answer to the given question."
|
| 14 |
inputs = {
|
| 15 |
"answer": {"type": "string", "description": "The final, correctly formatted answer string."},
|
| 16 |
}
|
|
|
|
| 26 |
answer = match.group(1)
|
| 27 |
# Remove LaTeX symbols and keep letters, digits, commas
|
| 28 |
answer = re.sub(r'[\$\{\}\\]', '', answer)
|
| 29 |
+
answer = re.sub(r'[^A-Za-z0-9,\.\-\+/ ]', ' ', answer)
|
| 30 |
answer = " ".join(answer.split()) # Remove extra spaces
|
| 31 |
|
| 32 |
if not answer:
|