Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,14 +9,21 @@ 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:
|
|
@@ -55,7 +62,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,
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def get_event(place: str) -> str:
|
| 13 |
+
"""A tool that fetches upcoming events happening in a given location.
|
| 14 |
+
|
| 15 |
Args:
|
| 16 |
+
place: A string representing a valid location (e.g., 'America/New_York').
|
| 17 |
+
|
| 18 |
+
Returns:
|
| 19 |
+
A string describing the upcoming events in the specified location.
|
| 20 |
"""
|
| 21 |
+
try:
|
| 22 |
+
# Fetch events happening this week in the specified place
|
| 23 |
+
local_time = DuckDuckGoSearchTool(f"What are the events happening this week in {place}")
|
| 24 |
+
return f"The current events in {place} are: {local_time}"
|
| 25 |
+
except Exception as e:
|
| 26 |
+
return f"Error fetching events happening in {place}: {e}"
|
| 27 |
|
| 28 |
@tool
|
| 29 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 62 |
|
| 63 |
agent = CodeAgent(
|
| 64 |
model=model,
|
| 65 |
+
tools=[final_answer, get_event, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
|
| 66 |
max_steps=6,
|
| 67 |
verbosity_level=1,
|
| 68 |
grammar=None,
|