Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,13 +18,13 @@ def calculate_age(birthdate:str)-> int:
|
|
| 18 |
Returns:
|
| 19 |
The user's age as an integer.
|
| 20 |
"""
|
| 21 |
-
|
| 22 |
birth_date = datetime.strptime(birthdate, "%Y-%m-%d") # Convert string to datetime
|
| 23 |
today = datetime.today()
|
| 24 |
age = today.year - birth_date.year - ((today.month, today.day) < (birth_date.month, birth_date.day))
|
| 25 |
return age
|
| 26 |
except ValueError:
|
| 27 |
-
return "LLM failed to retrive birthday
|
| 28 |
|
| 29 |
@tool
|
| 30 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 18 |
Returns:
|
| 19 |
The user's age as an integer.
|
| 20 |
"""
|
| 21 |
+
try:
|
| 22 |
birth_date = datetime.strptime(birthdate, "%Y-%m-%d") # Convert string to datetime
|
| 23 |
today = datetime.today()
|
| 24 |
age = today.year - birth_date.year - ((today.month, today.day) < (birth_date.month, birth_date.day))
|
| 25 |
return age
|
| 26 |
except ValueError:
|
| 27 |
+
return "LLM failed to retrive birthday info, Please use YYYY-MM-DD."
|
| 28 |
|
| 29 |
@tool
|
| 30 |
def get_current_time_in_timezone(timezone: str) -> str:
|