from smolagents import tool import wikipedia @tool def multiply(a: int, b: int) -> int: """Multiply two numbers. Args: a: first int b: second int """ return a * b @tool def add(a: int, b: int) -> int: """Add two numbers. Args: a: first int b: second int """ return a + b @tool def subtract(a: int, b: int) -> int: """Subtract two numbers. Args: a: first int b: second int """ return a - b @tool def divide(a: int, b: int) -> int: """Divide two numbers. Args: a: first int b: second int """ if b == 0: raise ValueError("Cannot divide by zero.") return a / b @tool def modulus(a: int, b: int) -> int: """Get the modulus of two numbers. Args: a: first int b: second int """ return a % b @tool def get_wikipedia_summary(query: str, sentences: int = 2) -> str: """ Get a summary from Wikipedia for a given query. Args: query: The search term. sentences: Number of sentences for the summary. Returns: The summary as a string. """ try: summary = wikipedia.summary(query, sentences=sentences) return summary except Exception as e: return f"Error retrieving Wikipedia summary: {e}"