dankushner commited on
Commit
fffb3db
·
verified ·
1 Parent(s): ae7a494

Update app.py

Browse files

my first tool fun fact

Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -33,6 +33,23 @@ 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
+ # ==============================
37
+ # New Tools Section
38
+ # ==============================
39
+
40
+ @tool
41
+ def random_fun_fact() -> str:
42
+ """Fetches a random fun fact from an online API."""
43
+ try:
44
+ url = "https://uselessfacts.jsph.pl/random.json?language=en"
45
+ response = requests.get(url).json()
46
+ return response["text"]
47
+ except Exception as e:
48
+ return f"Error fetching fun fact: {str(e)}"
49
+
50
+ # ==============================
51
+ # Final Answer Tool and Model
52
+ # ==============================
53
 
54
  final_answer = FinalAnswerTool()
55