Shaukat39 commited on
Commit
15479b8
·
verified ·
1 Parent(s): 3f6e91d

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +26 -0
agent.py CHANGED
@@ -21,26 +21,52 @@ load_dotenv()
21
  # ------------------ Arithmetic Tools ------------------
22
  @tool
23
  def multiply(a: int, b: int) -> str:
 
24
  return str(a * b)
25
 
 
26
  @tool
27
  def add(a: int, b: int) -> str:
 
28
  return str(a + b)
29
 
30
  @tool
31
  def subtract(a: int, b: int) -> str:
 
32
  return str(a - b)
33
 
34
  @tool
35
  def divide(a: int, b: int) -> str:
 
 
 
 
 
 
 
 
 
 
36
  if b == 0:
37
  return "Error: Cannot divide by zero."
38
  return str(a / b)
39
 
 
40
  @tool
41
  def modulus(a: int, b: int) -> str:
 
 
 
 
 
 
 
 
 
 
42
  return str(a % b)
43
 
 
44
  # ------------------ Retrieval Tools ------------------
45
  @tool
46
  def wiki_search(query: str) -> str:
 
21
  # ------------------ Arithmetic Tools ------------------
22
  @tool
23
  def multiply(a: int, b: int) -> str:
24
+ """Multiply two integers and return the product as a string."""
25
  return str(a * b)
26
 
27
+
28
  @tool
29
  def add(a: int, b: int) -> str:
30
+ """Add two integers and return the sum as a string."""
31
  return str(a + b)
32
 
33
  @tool
34
  def subtract(a: int, b: int) -> str:
35
+ """Subtract two integers and return the difference as a string."""
36
  return str(a - b)
37
 
38
  @tool
39
  def divide(a: int, b: int) -> str:
40
+ """
41
+ Divide two integers and return the result as a string.
42
+
43
+ Args:
44
+ a: The numerator (dividend).
45
+ b: The denominator (divisor). Must not be zero.
46
+
47
+ Returns:
48
+ A string representation of the division result, or an error message if b is zero.
49
+ """
50
  if b == 0:
51
  return "Error: Cannot divide by zero."
52
  return str(a / b)
53
 
54
+
55
  @tool
56
  def modulus(a: int, b: int) -> str:
57
+ """
58
+ Compute the modulus (remainder) of two integers and return the result as a string.
59
+
60
+ Args:
61
+ a: The numerator.
62
+ b: The denominator.
63
+
64
+ Returns:
65
+ A string representation of the remainder when a is divided by b.
66
+ """
67
  return str(a % b)
68
 
69
+
70
  # ------------------ Retrieval Tools ------------------
71
  @tool
72
  def wiki_search(query: str) -> str: