Spaces:
Sleeping
Sleeping
added quote_tool
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ import requests
|
|
| 5 |
import pytz
|
| 6 |
import yaml
|
| 7 |
from tools.final_answer import FinalAnswerTool
|
|
|
|
| 8 |
|
| 9 |
from Gradio_UI import GradioUI
|
| 10 |
|
|
@@ -19,6 +20,16 @@ def my_cutom_tool(arg1:int, arg2:int)-> str: #it's import to specify the return
|
|
| 19 |
"""
|
| 20 |
return str(arg1*arg2)
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
@tool
|
| 23 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 24 |
"""A tool that fetches the current local time in a specified timezone.
|
|
@@ -51,7 +62,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 51 |
|
| 52 |
agent = CodeAgent(
|
| 53 |
model=model,
|
| 54 |
-
tools=[my_cutom_tool, get_current_time_in_timezone, final_answer, image_generation_tool], ## add your tools here (don't remove final answer)
|
| 55 |
max_steps=6,
|
| 56 |
verbosity_level=1,
|
| 57 |
grammar=None,
|
|
|
|
| 5 |
import pytz
|
| 6 |
import yaml
|
| 7 |
from tools.final_answer import FinalAnswerTool
|
| 8 |
+
import requests
|
| 9 |
|
| 10 |
from Gradio_UI import GradioUI
|
| 11 |
|
|
|
|
| 20 |
"""
|
| 21 |
return str(arg1*arg2)
|
| 22 |
|
| 23 |
+
@tool
|
| 24 |
+
def quote_tool()-> str: #it's import to specify the return type
|
| 25 |
+
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 26 |
+
"""A tool that generates a random quote and returns the result
|
| 27 |
+
Args:
|
| 28 |
+
|
| 29 |
+
"""
|
| 30 |
+
quote = requests.get"https://thequoteshub.com/api").json()
|
| 31 |
+
return quote['text']
|
| 32 |
+
|
| 33 |
@tool
|
| 34 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 35 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 62 |
|
| 63 |
agent = CodeAgent(
|
| 64 |
model=model,
|
| 65 |
+
tools=[my_cutom_tool, get_current_time_in_timezone, final_answer, image_generation_tool, quote_tool], ## add your tools here (don't remove final answer)
|
| 66 |
max_steps=6,
|
| 67 |
verbosity_level=1,
|
| 68 |
grammar=None,
|