rin23 commited on
Commit
556c7ca
·
verified ·
1 Parent(s): c17edaf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -17
app.py CHANGED
@@ -9,23 +9,25 @@ from Gradio_UI import GradioUI
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
- def get_converted_speed(unit:str, speed:float)-> float: #it's import to specify the return type
13
- #Keep this format for the description / args / args description but feel free to modify the tool
14
- """A tool that converts the speed from kilometers per hour to miles per hour. Or from miles per hour to kilometers per hour.
15
- Args:
16
- unit: A string representing the unit speed is supplied in. Can be either "kph" or "mph".
17
- speed: A float representing the speed.
18
  """
19
- factor = 0.621371;
20
-
21
- if unit == "kph":
22
- converted_speed = speed * factor
23
- elif unit == "mph":
24
- converted_speed = speed / factor
25
- else:
26
- raise ValueError(f"Invalid unit: {unit}. Please use 'kph' or 'mph'.")
27
-
28
- return converted_speed
 
 
 
29
 
30
  @tool
31
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -64,7 +66,7 @@ with open("prompts.yaml", 'r') as stream:
64
 
65
  agent = CodeAgent(
66
  model=model,
67
- tools=[final_answer, get_converted_speed, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
68
  max_steps=6,
69
  verbosity_level=1,
70
  grammar=None,
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def generate_quote() -> str:
13
+ """A tool that generates a random inspirational quote from Bruce Lee, 'The Art of War', or samurai philosophy.
14
+
15
+ Returns:
16
+ A string containing an inspirational quote.
 
17
  """
18
+ quotes = [
19
+ "Knowing is not enough; we must apply. Wishing is not enough; we must do. - Bruce Lee",
20
+ "The successful warrior is the average man, with laser-like focus. - Bruce Lee",
21
+ "In the midst of chaos, there is also opportunity. - Sun Tzu, The Art of War",
22
+ "All warfare is based on deception. - Sun Tzu, The Art of War",
23
+ "The ultimate aim of martial arts is not having to use them. - Miyamoto Musashi, Samurai Philosopher",
24
+ "A samurai should be as swift as a bird and as strong as a lion. - Unknown Samurai",
25
+ "It is not the strongest of the species that survive, nor the most intelligent, but the one most responsive to change. - Charles Darwin (often quoted in samurai philosophy)",
26
+ "The sword is a weapon of the mind. - Unknown Samurai",
27
+ "To know your Enemy, you must become your Enemy. - Sun Tzu, The Art of War",
28
+ "The mind is everything. What you think you become. - Buddha (often referenced in samurai teachings)"
29
+ ]
30
+ return random.choice(quotes)
31
 
32
  @tool
33
  def get_current_time_in_timezone(timezone: str) -> str:
 
66
 
67
  agent = CodeAgent(
68
  model=model,
69
+ tools=[final_answer, generate_quote, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
70
  max_steps=6,
71
  verbosity_level=1,
72
  grammar=None,