Spaces:
Sleeping
Sleeping
Commit ·
4bca6c5
1
Parent(s): a422271
update
Browse files
app.py
CHANGED
|
@@ -50,6 +50,24 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 50 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 51 |
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
final_answer = FinalAnswerTool()
|
| 54 |
|
| 55 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
|
@@ -73,7 +91,8 @@ agent = CodeAgent(
|
|
| 73 |
model=model,
|
| 74 |
tools=[final_answer,
|
| 75 |
calculator,
|
| 76 |
-
get_current_time_in_timezone
|
|
|
|
| 77 |
max_steps=6,
|
| 78 |
verbosity_level=1,
|
| 79 |
grammar=None,
|
|
|
|
| 50 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 51 |
|
| 52 |
|
| 53 |
+
@tool
|
| 54 |
+
def guess_winnie_mood(date: str) -> str:
|
| 55 |
+
"""A tool that guess Winnie Tung's current mood. Assume Winnie's mood changes based on current date
|
| 56 |
+
Args:
|
| 57 |
+
date: A string representing current date: (e.g., 'Monday', 'A day before exam').
|
| 58 |
+
"""
|
| 59 |
+
if date == 'Monday':
|
| 60 |
+
return 'energetic'
|
| 61 |
+
elif date == 'Friday':
|
| 62 |
+
return 'happy'
|
| 63 |
+
elif date == 'A day before exam':
|
| 64 |
+
return 'anxious and nervous'
|
| 65 |
+
elif date == 'Sunday evenning':
|
| 66 |
+
return 'Wanna do something naughty'
|
| 67 |
+
else:
|
| 68 |
+
raise Exception(f"Invalid date: {date}")
|
| 69 |
+
|
| 70 |
+
|
| 71 |
final_answer = FinalAnswerTool()
|
| 72 |
|
| 73 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
|
|
|
| 91 |
model=model,
|
| 92 |
tools=[final_answer,
|
| 93 |
calculator,
|
| 94 |
+
get_current_time_in_timezone,
|
| 95 |
+
guess_winnie_mood], ## add your tools here (don't remove final answer)
|
| 96 |
max_steps=6,
|
| 97 |
verbosity_level=1,
|
| 98 |
grammar=None,
|