HugeFighter commited on
Commit
ddbd559
·
verified ·
1 Parent(s): 1d984db

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -12,14 +12,22 @@ from Gradio_UI import GradioUI
12
  def sum_tool(num1: int, num2: int) -> int:
13
  """ A tool that adds up the two integers
14
  Args:
15
- num1: An integer representing a first argument num1
16
- num2: An integer representing a second argument num2
 
 
 
 
 
17
  """
 
 
 
18
  try:
19
  res = num1 + num2
20
  return f"The sum of two integers is: {res}"
21
  except Exception as e:
22
- return f"The argument passed is not an integer"
23
 
24
 
25
  @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