Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,23 @@ 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
@tool
|
24 |
def get_random_cocktail() -> str:
|
|
|
18 |
"""
|
19 |
return "What magic will you build ?"
|
20 |
|
21 |
+
|
22 |
+
@tool
|
23 |
+
def get_random_excuse() -> str:
|
24 |
+
"""A tool that fetches a random excuse.
|
25 |
+
"""
|
26 |
+
try:
|
27 |
+
response = requests.get('https://excuser.herokuapp.com/')
|
28 |
+
data = response.json()
|
29 |
+
if data and 'excuse' in data:
|
30 |
+
excuse = data['excuse']
|
31 |
+
return f"Here's a random excuse: {excuse}"
|
32 |
+
else:
|
33 |
+
return "No excuse found. Please try again."
|
34 |
+
except Exception as e:
|
35 |
+
return f"Error fetching random excuse: {str(e)}"
|
36 |
+
|
37 |
+
|
38 |
|
39 |
@tool
|
40 |
def get_random_cocktail() -> str:
|