Spaces:
Sleeping
Sleeping
Update tools/final_answer.py
Browse files- tools/final_answer.py +11 -4
tools/final_answer.py
CHANGED
|
@@ -1,14 +1,21 @@
|
|
| 1 |
-
from typing import Any, Optional
|
| 2 |
from smolagents.tools import Tool
|
| 3 |
|
| 4 |
class FinalAnswerTool(Tool):
|
| 5 |
name = "final_answer"
|
| 6 |
description = "Provides a final answer to the given problem."
|
| 7 |
-
inputs = {'answer': {'type': 'any', 'description': 'The final answer to the problem'}}
|
| 8 |
-
output_type = "any"
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
return answer
|
| 12 |
|
| 13 |
def __init__(self, *args, **kwargs):
|
|
|
|
| 14 |
self.is_initialized = False
|
|
|
|
|
|
|
| 1 |
from smolagents.tools import Tool
|
| 2 |
|
| 3 |
class FinalAnswerTool(Tool):
|
| 4 |
name = "final_answer"
|
| 5 |
description = "Provides a final answer to the given problem."
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
inputs = {
|
| 8 |
+
"answer": {
|
| 9 |
+
"type": "string",
|
| 10 |
+
"description": "The final answer to the problem"
|
| 11 |
+
}
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
output_type = "string"
|
| 15 |
+
|
| 16 |
+
def forward(self, answer: str) -> str:
|
| 17 |
return answer
|
| 18 |
|
| 19 |
def __init__(self, *args, **kwargs):
|
| 20 |
+
super().__init__(*args, **kwargs)
|
| 21 |
self.is_initialized = False
|