prige commited on
Commit
6a8d3fe
·
verified ·
1 Parent(s): 1b2f5a4

Upload tool

Browse files
Files changed (3) hide show
  1. app.py +6 -0
  2. requirements.txt +1 -0
  3. tool.py +14 -0
app.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ from smolagents import launch_gradio_demo
2
+ from tool import FinalAnswerTool
3
+
4
+ tool = FinalAnswerTool()
5
+
6
+ launch_gradio_demo(tool)
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ smolagents
tool.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Optional
2
+ from smolagents.tools import Tool
3
+
4
+ class FinalAnswerTool(Tool):
5
+ name = "final_answer"
6
+ description = "This is a tool sends the final answer to the given problem, towards the user. This tool does not format the answer, it just sends it as is."
7
+ inputs = {'answer': {'type': 'any', 'description': 'The well formated, short, and conversational final answer to the user`s problem or request.'}}
8
+ output_type = "any"
9
+
10
+ def forward(self, answer: Any) -> Any:
11
+ return answer
12
+
13
+ def __init__(self, *args, **kwargs):
14
+ self.is_initialized = False