uasername commited on
Commit
1bee480
·
verified ·
1 Parent(s): b9d84de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
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
- import requests
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: