Spaces:
Sleeping
Sleeping
Stoyan Georgiev
commited on
Commit
·
226f3de
1
Parent(s):
80a9436
Updated the Space with new features
Browse files
app.py
CHANGED
@@ -21,17 +21,14 @@ def my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
21 |
|
22 |
@tool
|
23 |
def get_current_time_in_timezone(timezone: str) -> str:
|
24 |
-
"""
|
25 |
-
Get the current time in a specified timezone.
|
26 |
-
|
27 |
Args:
|
28 |
-
timezone
|
29 |
-
|
30 |
-
Returns:
|
31 |
-
str: The current time in the specified timezone in ISO 8601 format.
|
32 |
"""
|
33 |
try:
|
|
|
34 |
tz = pytz.timezone(timezone)
|
|
|
35 |
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
36 |
return f"The current local time in {timezone} is: {local_time}"
|
37 |
except Exception as e:
|
|
|
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.
|
|
|
|
|
25 |
Args:
|
26 |
+
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
|
|
|
|
|
|
27 |
"""
|
28 |
try:
|
29 |
+
# Create timezone object
|
30 |
tz = pytz.timezone(timezone)
|
31 |
+
# Get current time in that timezone
|
32 |
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
33 |
return f"The current local time in {timezone} is: {local_time}"
|
34 |
except Exception as e:
|