Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,6 +33,12 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
final_answer = FinalAnswerTool()
|
| 38 |
|
|
|
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
+
@tool
|
| 37 |
+
def get_random_joke() -> str:
|
| 38 |
+
"""Gets a random joke from an open API."""
|
| 39 |
+
response = requests.get("https://official-joke-api.appspot.com/random_joke")
|
| 40 |
+
data = response.json()
|
| 41 |
+
return f"{data.get('setup')} - {data.get('punchline')}"
|
| 42 |
|
| 43 |
final_answer = FinalAnswerTool()
|
| 44 |
|