Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,21 +8,42 @@ from tools.final_answer import FinalAnswerTool
|
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
@tool
|
| 12 |
-
def
|
| 13 |
-
|
| 14 |
-
|
| 15 |
Args:
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
| 18 |
"""
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 23 |
"""A tool that fetches the current local time in a specified timezone.
|
| 24 |
Args:
|
| 25 |
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
|
|
|
|
|
|
| 26 |
"""
|
| 27 |
try:
|
| 28 |
# Create timezone object
|
|
@@ -55,7 +76,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|
|
|
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
+
# @tool
|
| 12 |
+
# def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
| 13 |
+
# #Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
+
# """A tool that does nothing yet
|
| 15 |
+
# Args:
|
| 16 |
+
# arg1: the first argument
|
| 17 |
+
# arg2: the second argument
|
| 18 |
+
# """
|
| 19 |
+
# return "What magic will you build ?"
|
| 20 |
+
|
| 21 |
@tool
|
| 22 |
+
def get_tourist_attractions_in_your_zone(zone:str) -> str:
|
| 23 |
+
""" A tool that searches for top 3 tourist attractions in the specified zone.
|
| 24 |
+
|
| 25 |
Args:
|
| 26 |
+
zone: A string representing a valid zone (e.g., 'Pakistan/Karachi')
|
| 27 |
+
|
| 28 |
+
Returns:
|
| 29 |
+
str: a string containing 3 names of the top 3 tourist places in that zone
|
| 30 |
+
|
| 31 |
"""
|
| 32 |
+
|
| 33 |
+
search = f"List top 3 tourist attractions in {Args}"
|
| 34 |
+
results = DuckDuckGoSearchTool(search)
|
| 35 |
+
if results:
|
| 36 |
+
return results
|
| 37 |
+
else:
|
| 38 |
+
return f"Unable to find attractions for {Args}"
|
| 39 |
|
| 40 |
@tool
|
| 41 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 42 |
"""A tool that fetches the current local time in a specified timezone.
|
| 43 |
Args:
|
| 44 |
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
| 45 |
+
|
| 46 |
+
|
| 47 |
"""
|
| 48 |
try:
|
| 49 |
# Create timezone object
|
|
|
|
| 76 |
|
| 77 |
agent = CodeAgent(
|
| 78 |
model=model,
|
| 79 |
+
tools=[final_answer, get_tourist_attractions_in_your_zone], ## add your tools here (don't remove final answer)
|
| 80 |
max_steps=6,
|
| 81 |
verbosity_level=1,
|
| 82 |
grammar=None,
|