Spaces:
Sleeping
Sleeping
remg1997
commited on
Commit
·
b6dba3d
1
Parent(s):
b18d2b0
Include other tools
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 |
-
"""A tool that does nothing yet
|
15 |
Args:
|
16 |
-
|
17 |
-
arg2: the second argument
|
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, image_generation_tool, get_current_time_in_timezone], ## 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 is_it_monday(timezone: str) -> str:
|
13 |
+
"""A tool that tells you if it is monday in a specific timezone.
|
|
|
14 |
Args:
|
15 |
+
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
|
|
16 |
"""
|
17 |
+
try:
|
18 |
+
# Create timezone object
|
19 |
+
tz = pytz.timezone(timezone)
|
20 |
+
# Get current time in that timezone
|
21 |
+
current_time = datetime.datetime.now(tz)
|
22 |
+
# Check if it's Monday
|
23 |
+
is_monday = current_time.weekday() == 0
|
24 |
+
return f"It is {is_monday} that it is Monday in {timezone}."
|
25 |
+
except Exception as e:
|
26 |
+
return f"Error checking if it is Monday in {timezone}: {str(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, image_generation_tool, get_current_time_in_timezone, is_it_monday], ## add your tools here (don't remove final answer)
|
66 |
max_steps=6,
|
67 |
verbosity_level=1,
|
68 |
grammar=None,
|