HugeFighter commited on
Commit
1db95ee
·
verified ·
1 Parent(s): 6977344

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -19
app.py CHANGED
@@ -9,25 +9,18 @@ from Gradio_UI import GradioUI
9
 
10
 
11
  @tool
12
- def sum_tool(num1: int, num2: int) -> int:
13
- """ A tool that adds up the two integers
14
- Args:
15
- num1: The first integer to add
16
- num2: The second integer to add
17
- Returns:
18
- int: A integer contains the sum of the two integers.
19
-
20
- Raises:
21
- TypeError: If either num1 or num2 is not an integer.
22
- """
23
- if not isinstance(num1, int) or not isinstance(num2, int):
24
- raise TypeError("Both inputs must be integers")
25
-
26
- try:
27
- res = num1 + num2
28
- return f"The sum of two integers is: {res}"
29
- except Exception as e:
30
- return f"An error occurred: {str(e)}"
31
 
32
 
33
  @tool
 
9
 
10
 
11
  @tool
12
+ {
13
+ "name": "sum_tool",
14
+ "type": "Code",
15
+ "function": "calculate",
16
+ "input_parameters": {
17
+ "math_expression": "string"
18
+ },
19
+ "output": {
20
+ "result": "number"
21
+ },
22
+ "code": "return eval(math_expression)"
23
+ }
 
 
 
 
 
 
 
24
 
25
 
26
  @tool