fermaat commited on
Commit
9979bb6
·
verified ·
1 Parent(s): 8c5c24b

Added comere jokes tool

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -3,9 +3,11 @@ import datetime
3
  import requests
4
  import pytz
5
  import yaml
 
6
  from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
@@ -18,6 +20,19 @@ 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.
@@ -55,7 +70,7 @@ with open("prompts.yaml", 'r') as stream:
55
 
56
  agent = CodeAgent(
57
  model=model,
58
- tools=[final_answer], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,
 
3
  import requests
4
  import pytz
5
  import yaml
6
+
7
  from tools.final_answer import FinalAnswerTool
8
 
9
  from Gradio_UI import GradioUI
10
+ import random
11
 
12
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
13
  @tool
 
20
  """
21
  return "What magic will you build ?"
22
 
23
+ @tool
24
+ def cosmere_random_jokes_tool()-> str:
25
+ """A tool that would return a random joke from the Cosmere universe.
26
+ """
27
+ jokes = [
28
+ "Why did the Shardblade break up with the Honorblade? It just couldn't handle the commitment!",
29
+ "Why did the Allomancer bring a ladder to the fight? Because he heard the stakes were high!",
30
+ "Why did the Kandra refuse to play cards? Because he was afraid of being 'read'!",
31
+ "Why did the Elantrian get kicked out of the bakery? He kept trying to Awaken the bread!",
32
+ "Why did the Mistborn refuse to play hide and seek? Because good luck hiding when you can burn pewter!",
33
+ ]
34
+ return random.choice(jokes)
35
+
36
  @tool
37
  def get_current_time_in_timezone(timezone: str) -> str:
38
  """A tool that fetches the current local time in a specified timezone.
 
70
 
71
  agent = CodeAgent(
72
  model=model,
73
+ tools=[final_answer, cosmere_random_jokes_tool], ## add your tools here (don't remove final answer)
74
  max_steps=6,
75
  verbosity_level=1,
76
  grammar=None,