Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,20 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 23 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
+
@tool
|
| 22 |
+
def get_joke(category: str) -> str:
|
| 23 |
+
"""Returns a random joke from a specified category.
|
| 24 |
+
Args:
|
| 25 |
+
category: A joke category, e.g. 'dad' or 'programming'.
|
| 26 |
+
"""
|
| 27 |
+
# Here you could call an external API or just pick from a dictionary.
|
| 28 |
+
jokes = {
|
| 29 |
+
"dad": "Why did the scarecrow get promoted? Because he was outstanding in his field!",
|
| 30 |
+
"programming": "Why do programmers prefer dark mode? Because light attracts bugs."
|
| 31 |
+
}
|
| 32 |
+
return jokes.get(category.lower(), "No jokes in that category.")
|
| 33 |
+
|
| 34 |
+
|
| 35 |
@tool
|
| 36 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 37 |
"""A tool that fetches the current local time in a specified timezone.
|