Spaces:
Sleeping
Sleeping
Create tools.py
Browse files
tools.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
tools.py
|
2 |
+
from typing import Any
|
3 |
+
from smolagents.tools import Tool
|
4 |
+
|
5 |
+
class FinalAnswerTool(Tool):
|
6 |
+
name = "final_answer"
|
7 |
+
description = "Returns the final answer generated by the LLM."
|
8 |
+
inputs = {"answer": {"type": "any", "description": "The final answer to output"}}
|
9 |
+
output_type = "any"
|
10 |
+
|
11 |
+
def forward(self, answer: Any) -> Any:
|
12 |
+
# Just pass through whatever the LLM returns.
|
13 |
+
return answer
|
14 |
+
|
15 |
+
def __init__(self, *args, **kwargs):
|
16 |
+
self.is_initialized = False
|