Anren commited on
Commit
a174921
·
verified ·
1 Parent(s): 6620163

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -1
app.py CHANGED
@@ -27,6 +27,34 @@ def num_of_letters_in_a_word(word : str) -> int:
27
  """
28
  return len(word)
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  @tool
31
  def get_current_time_in_timezone(timezone: str) -> str:
32
  """A tool that fetches the current local time in a specified timezone.
@@ -65,7 +93,7 @@ with open("prompts.yaml", 'r') as stream:
65
 
66
  agent = CodeAgent(
67
  model=model,
68
- tools=[final_answer, num_of_letters_in_a_word, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
69
  max_steps=6,
70
  verbosity_level=1,
71
  grammar=None,
 
27
  """
28
  return len(word)
29
 
30
+
31
+ @tool
32
+ def calculate_between_two_numbers(num1 : float, num2 : float, operation : str) -> float:
33
+ """
34
+ A tool that takes in two different number and a specified operation as its inputs and then returns a result as a number
35
+ operation should be one of the following: (+, -, /, *)
36
+ Args:
37
+ num1: first number
38
+ num2: second number
39
+ operation: the operation that will be performed between these two numbers
40
+ """
41
+ if(operation == "+"):
42
+ return num1 + num2
43
+
44
+ elif(operation == "-"):
45
+ return num1 - num2
46
+
47
+ elif(operation == "/"):
48
+ return num1 / num2
49
+
50
+ elif(operation == "*"):
51
+ return num1 * num2
52
+
53
+ else:
54
+ print("You either entered a wrong operation or something else went wrong")
55
+ return -1.0
56
+
57
+
58
  @tool
59
  def get_current_time_in_timezone(timezone: str) -> str:
60
  """A tool that fetches the current local time in a specified timezone.
 
93
 
94
  agent = CodeAgent(
95
  model=model,
96
+ tools=[final_answer, num_of_letters_in_a_word, get_current_time_in_timezone, calculate_between_two_numbers], ## add your tools here (don't remove final answer)
97
  max_steps=6,
98
  verbosity_level=1,
99
  grammar=None,