Spaces:
Sleeping
Sleeping
Initial commit with full functionality extend app req tools
Browse files- tools/final_answer.py +10 -1
tools/final_answer.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
# tools/final_answer.py
|
| 2 |
from smolagents import Tool
|
| 3 |
-
from typing import Optional
|
| 4 |
|
| 5 |
class FinalAnswerTool(Tool):
|
| 6 |
"""Tool for providing final answers to user queries."""
|
|
@@ -8,6 +8,15 @@ class FinalAnswerTool(Tool):
|
|
| 8 |
name = "final_answer"
|
| 9 |
description = "Tool for providing the final answer to the agent's task"
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
def __init__(self, description: Optional[str] = None):
|
| 12 |
super().__init__()
|
| 13 |
self.description = description or self.description
|
|
|
|
| 1 |
# tools/final_answer.py
|
| 2 |
from smolagents import Tool
|
| 3 |
+
from typing import Optional, List, Dict, Any
|
| 4 |
|
| 5 |
class FinalAnswerTool(Tool):
|
| 6 |
"""Tool for providing final answers to user queries."""
|
|
|
|
| 8 |
name = "final_answer"
|
| 9 |
description = "Tool for providing the final answer to the agent's task"
|
| 10 |
|
| 11 |
+
# Define inputs as a class attribute
|
| 12 |
+
inputs: List[Dict[str, Any]] = [
|
| 13 |
+
{
|
| 14 |
+
"name": "answer",
|
| 15 |
+
"type": "str",
|
| 16 |
+
"description": "The final answer to be returned"
|
| 17 |
+
}
|
| 18 |
+
]
|
| 19 |
+
|
| 20 |
def __init__(self, description: Optional[str] = None):
|
| 21 |
super().__init__()
|
| 22 |
self.description = description or self.description
|