DevairMd commited on
Commit
d8eed58
·
verified ·
1 Parent(s): 8c5c24b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -6
app.py CHANGED
@@ -9,14 +9,42 @@ 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 my_custom_tool(arg1:str, arg2:int)-> str: #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 does nothing yet
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  Args:
16
- arg1: the first argument
17
- arg2: the second argument
 
 
18
  """
19
- return "What magic will you build ?"
 
 
 
 
 
 
20
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def basic_calculator(a: int, b: int, operation: str) -> int:
13
+ """
14
+ A basic arithmetic calculator.
15
+ Args:
16
+ a: The first integer.
17
+ b: The second integer.
18
+ operation: The operation to perform ('add', 'multiply', 'divide', or 'subtract').
19
+ """
20
+ if operation == "add":
21
+ return a + b
22
+ elif operation == "multiply":
23
+ return a * b
24
+ elif operation == "divide":
25
+ return a // b if b != 0 else "Error: Division by zero"
26
+ elif operation == "subtract":
27
+ return a - b
28
+ else:
29
+ return "Unknown operation"
30
+
31
+ @tool
32
+ def get_weather(place: str, time: int) -> str:
33
+ """
34
+ A Wether tool, that returns the weather conditon of a place, at a given time.
35
  Args:
36
+ place: The name of the place or location
37
+ time: The hour of the day(0-23)
38
+
39
+ You take the Place, and the time of the day, and return the weather.
40
  """
41
+
42
+ # Using an f-string is the best way to combine variables and text in Python
43
+ return f"The weather condition for {place} at {time}:00 is sunny with a light breeze."
44
+
45
+
46
+ @tool
47
+
48
 
49
  @tool
50
  def get_current_time_in_timezone(timezone: str) -> str: