from smolagents import tool import cmath @tool def add(a:int, b:int) -> int: """ This tool returns the sum of two numbers. Args: a: first number b: second number """ return a+b @tool def subtract(a:int, b:int) -> int: """ This tool returns the difference between two numbers. Args: a: first number b: second number """ return a-b @tool def multiply(a:int, b:int) -> int: """ This tool multiplies two numbers. Args: a: first number b: second number """ return a*b @tool def divide(a:int, b:int) -> float: """ This tool divides two numbers. Args: a: first number b: second number """ if b==0: raise ValueError('Cannot divide by zero') return a/b @tool def modulus(a:int, b:int) -> int: """ This tool returns the modulus of two numbers. Args: a: first number b: second number """ return a%b @tool def rounder(a:float, n:int) -> float: """ This tool return a number rounded to a certain number of decimals. Args: a: number to be rounded n: number of decimals to use when rounding the number """ return round(a,n) @tool def power(a: float, b: float) -> float: """ Get the power of two numbers. Args: a: the first number b: the second number """ return a**b @tool def square_root(a: float) -> float | complex: """ Get the square root of a number. Args: a: the number to get the square root of """ if a >= 0: return a**0.5 return cmath.sqrt(a)