INNER CODE UNIT · Python
Message
victordibia/designing-multiagent-systems · course/samples/hello_world/autogen_core/app.py:21
class Message:
content: str
# Calculator function to be used as a tool
async def calculator(a: float, b: float, operator: str) -> str:
"""Perform basic arithmetic operations."""
try:
if operator == '+':
return str(a + b)
elif operator == '-':
return str(a - b)
elif operator == '*':
return str(a * b)
elif operator == '/':
if b == 0:
return 'Error: Division by zero'