mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
Update test for multiplication
This commit is contained in:
@@ -1814,15 +1814,11 @@ def test_agent_streaming_with_tool_calling():
|
|||||||
|
|
||||||
# Define a tool that will be called
|
# Define a tool that will be called
|
||||||
@tool
|
@tool
|
||||||
def calculator(expression: str) -> str:
|
def calculator(first_number: int, second_number: int) -> float:
|
||||||
"""Calculate the result of a mathematical expression."""
|
"""Calculate the product of two numbers."""
|
||||||
nonlocal tool_called
|
nonlocal tool_called
|
||||||
tool_called = True
|
tool_called = True
|
||||||
try:
|
return first_number * second_number
|
||||||
result = eval(expression)
|
|
||||||
return f"The result of {expression} is {result}"
|
|
||||||
except Exception as e:
|
|
||||||
return f"Error calculating {expression}: {str(e)}"
|
|
||||||
|
|
||||||
# Create an agent with streaming enabled
|
# Create an agent with streaming enabled
|
||||||
agent = Agent(
|
agent = Agent(
|
||||||
|
|||||||
Reference in New Issue
Block a user