Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,13 +19,31 @@ class BasicAgent:
|
|
| 19 |
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 20 |
custom_role_conversions=None,
|
| 21 |
)
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
def __call__(self, question: str) -> str:
|
| 24 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 25 |
fixed_answer = "This is a default answer."
|
| 26 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 27 |
return fixed_answer
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
|
| 31 |
|
|
|
|
| 19 |
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 20 |
custom_role_conversions=None,
|
| 21 |
)
|
| 22 |
+
|
| 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:
|
| 35 |
+
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 36 |
+
|
| 37 |
def __call__(self, question: str) -> str:
|
| 38 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 39 |
fixed_answer = "This is a default answer."
|
| 40 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 41 |
return fixed_answer
|
| 42 |
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
| 47 |
|
| 48 |
|
| 49 |
|