Spaces:
Running
Running
crcdng
commited on
Commit
·
25d4d84
1
Parent(s):
14bf86e
avoid circular import
Browse files- Gradio_UI.py +13 -1
Gradio_UI.py
CHANGED
@@ -25,7 +25,19 @@ from smolagents.agents import ActionStep, MultiStepAgent
|
|
25 |
from smolagents.memory import MemoryStep
|
26 |
from smolagents.utils import _is_package_available
|
27 |
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
def pull_messages_from_step(
|
31 |
step_log: MemoryStep,
|
|
|
25 |
from smolagents.memory import MemoryStep
|
26 |
from smolagents.utils import _is_package_available
|
27 |
|
28 |
+
def get_current_time_in_timezone(timezone: str) -> str:
|
29 |
+
"""A tool that fetches the current local time in a specified timezone.
|
30 |
+
Args:
|
31 |
+
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
32 |
+
"""
|
33 |
+
try:
|
34 |
+
# Create timezone object
|
35 |
+
tz = pytz.timezone(timezone)
|
36 |
+
# Get current time in that timezone
|
37 |
+
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
38 |
+
return f"The current local time in {timezone} is: {local_time}"
|
39 |
+
except Exception as e:
|
40 |
+
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
41 |
|
42 |
def pull_messages_from_step(
|
43 |
step_log: MemoryStep,
|