Spaces:
Sleeping
Sleeping
update a tool
Browse filesa city sight seeing tool has been added
app.py
CHANGED
|
@@ -8,15 +8,38 @@ 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 my_custom_tool(
|
| 13 |
-
|
| 14 |
-
|
| 15 |
Args:
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
| 18 |
"""
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 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 my_custom_tool(city1: str, city2: str) -> str:
|
| 23 |
+
"""
|
| 24 |
+
A tool that searches for the top 5 sightseeing locations in two cities.
|
| 25 |
Args:
|
| 26 |
+
city1: The name of the first city.
|
| 27 |
+
city2: The name of the second city.
|
| 28 |
+
Returns:
|
| 29 |
+
A string listing the top 5 sightseeing locations in each city.
|
| 30 |
"""
|
| 31 |
+
# Search for top 5 sightseeing locations in city1
|
| 32 |
+
results_city1 = DuckDuckGoSearchTool(f"top 5 sightseeing locations in {city1}")
|
| 33 |
+
# Search for top 5 sightseeing locations in city2
|
| 34 |
+
results_city2 = DuckDuckGoSearchTool(f"top 5 sightseeing locations in {city2}")
|
| 35 |
+
|
| 36 |
+
# Format the results as a string
|
| 37 |
+
output = f"Top 5 sightseeing locations in {city1}:\n"
|
| 38 |
+
output += "\n".join(results_city1[:5]) + "\n\n"
|
| 39 |
+
output += f"Top 5 sightseeing locations in {city2}:\n"
|
| 40 |
+
output += "\n".join(results_city2[:5])
|
| 41 |
+
return output
|
| 42 |
+
|
| 43 |
|
| 44 |
@tool
|
| 45 |
def get_current_time_in_timezone(timezone: str) -> str:
|