mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-03 08:12:39 +00:00
Merge branch 'lorenze/imp/native-tool-calling' into gl/feat/native-multimodal-files
This commit is contained in:
@@ -17,7 +17,7 @@ def test_creating_a_tool_using_annotation():
|
||||
|
||||
# Assert all the right attributes were defined
|
||||
assert my_tool.name == "Name of my tool"
|
||||
assert "Tool Name: Name of my tool" in my_tool.description
|
||||
assert "Tool Name: name_of_my_tool" in my_tool.description
|
||||
assert "Tool Arguments:" in my_tool.description
|
||||
assert '"question"' in my_tool.description
|
||||
assert '"type": "string"' in my_tool.description
|
||||
@@ -32,7 +32,7 @@ def test_creating_a_tool_using_annotation():
|
||||
converted_tool = my_tool.to_structured_tool()
|
||||
assert converted_tool.name == "Name of my tool"
|
||||
|
||||
assert "Tool Name: Name of my tool" in converted_tool.description
|
||||
assert "Tool Name: name_of_my_tool" in converted_tool.description
|
||||
assert "Tool Arguments:" in converted_tool.description
|
||||
assert '"question"' in converted_tool.description
|
||||
assert converted_tool.args_schema.model_json_schema()["properties"] == {
|
||||
@@ -56,7 +56,7 @@ def test_creating_a_tool_using_baseclass():
|
||||
# Assert all the right attributes were defined
|
||||
assert my_tool.name == "Name of my tool"
|
||||
|
||||
assert "Tool Name: Name of my tool" in my_tool.description
|
||||
assert "Tool Name: name_of_my_tool" in my_tool.description
|
||||
assert "Tool Arguments:" in my_tool.description
|
||||
assert '"question"' in my_tool.description
|
||||
assert '"type": "string"' in my_tool.description
|
||||
@@ -69,7 +69,7 @@ def test_creating_a_tool_using_baseclass():
|
||||
converted_tool = my_tool.to_structured_tool()
|
||||
assert converted_tool.name == "Name of my tool"
|
||||
|
||||
assert "Tool Name: Name of my tool" in converted_tool.description
|
||||
assert "Tool Name: name_of_my_tool" in converted_tool.description
|
||||
assert "Tool Arguments:" in converted_tool.description
|
||||
assert '"question"' in converted_tool.description
|
||||
assert converted_tool.args_schema.model_json_schema()["properties"] == {
|
||||
|
||||
@@ -108,7 +108,7 @@ def test_tool_usage_render():
|
||||
rendered = tool_usage._render()
|
||||
|
||||
# Check that the rendered output contains the expected tool information
|
||||
assert "Tool Name: Random Number Generator" in rendered
|
||||
assert "Tool Name: random_number_generator" in rendered
|
||||
assert "Tool Arguments:" in rendered
|
||||
assert (
|
||||
"Tool Description: Generates a random number within a specified range"
|
||||
@@ -488,7 +488,7 @@ def test_tool_selection_error_event_direct():
|
||||
assert event.agent_role == "test_role"
|
||||
assert event.tool_name == "Non Existent Tool"
|
||||
assert event.tool_args == {}
|
||||
assert "Tool Name: Test Tool" in event.tool_class
|
||||
assert "Tool Name: test_tool" in event.tool_class
|
||||
assert "A test tool" in event.tool_class
|
||||
assert "don't exist" in event.error
|
||||
|
||||
@@ -503,7 +503,7 @@ def test_tool_selection_error_event_direct():
|
||||
assert event.agent_role == "test_role"
|
||||
assert event.tool_name == ""
|
||||
assert event.tool_args == {}
|
||||
assert "Test Tool" in event.tool_class
|
||||
assert "test_tool" in event.tool_class
|
||||
assert "forgot the Action name" in event.error
|
||||
|
||||
|
||||
@@ -654,7 +654,7 @@ def test_tool_usage_finished_event_with_result():
|
||||
# Verify event attributes
|
||||
assert event.agent_key == "test_agent_key"
|
||||
assert event.agent_role == "test_agent_role"
|
||||
assert event.tool_name == "Test Tool"
|
||||
assert event.tool_name == "test_tool"
|
||||
assert event.tool_args == {"arg1": "value1"}
|
||||
assert event.tool_class == "TestTool"
|
||||
assert event.run_attempts == 1 # Default value from ToolUsage
|
||||
@@ -734,7 +734,7 @@ def test_tool_usage_finished_event_with_cached_result():
|
||||
# Verify event attributes
|
||||
assert event.agent_key == "test_agent_key"
|
||||
assert event.agent_role == "test_agent_role"
|
||||
assert event.tool_name == "Test Tool"
|
||||
assert event.tool_name == "test_tool"
|
||||
assert event.tool_args == {"arg1": "value1"}
|
||||
assert event.tool_class == "TestTool"
|
||||
assert event.run_attempts == 1 # Default value from ToolUsage
|
||||
|
||||
Reference in New Issue
Block a user