Skip to content

Commit 94c173d

Browse files
fix: update Pydantic schema access (crewAIInc#337)
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
1 parent a491d61 commit 94c173d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/base_tool_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def my_tool(question: str) -> str:
1616
my_tool.description
1717
== "Tool Name: Name of my tool\nTool Arguments: {'question': {'description': None, 'type': 'str'}}\nTool Description: Clear description for what this tool is useful for, you agent will need this information to use it."
1818
)
19-
assert my_tool.args_schema.schema()["properties"] == {
19+
assert my_tool.args_schema.model_json_schema()["properties"] == {
2020
"question": {"title": "Question", "type": "string"}
2121
}
2222
assert (
@@ -30,7 +30,7 @@ def my_tool(question: str) -> str:
3030
converted_tool.description
3131
== "Tool Name: Name of my tool\nTool Arguments: {'question': {'description': None, 'type': 'str'}}\nTool Description: Clear description for what this tool is useful for, you agent will need this information to use it."
3232
)
33-
assert converted_tool.args_schema.schema()["properties"] == {
33+
assert converted_tool.args_schema.model_json_schema()["properties"] == {
3434
"question": {"title": "Question", "type": "string"}
3535
}
3636
assert (
@@ -54,7 +54,7 @@ def _run(self, question: str) -> str:
5454
my_tool.description
5555
== "Tool Name: Name of my tool\nTool Arguments: {'question': {'description': None, 'type': 'str'}}\nTool Description: Clear description for what this tool is useful for, you agent will need this information to use it."
5656
)
57-
assert my_tool.args_schema.schema()["properties"] == {
57+
assert my_tool.args_schema.model_json_schema()["properties"] == {
5858
"question": {"title": "Question", "type": "string"}
5959
}
6060
assert (
@@ -68,7 +68,7 @@ def _run(self, question: str) -> str:
6868
converted_tool.description
6969
== "Tool Name: Name of my tool\nTool Arguments: {'question': {'description': None, 'type': 'str'}}\nTool Description: Clear description for what this tool is useful for, you agent will need this information to use it."
7070
)
71-
assert converted_tool.args_schema.schema()["properties"] == {
71+
assert converted_tool.args_schema.model_json_schema()["properties"] == {
7272
"question": {"title": "Question", "type": "string"}
7373
}
7474
assert (

0 commit comments

Comments
 (0)