Skip to content

Commit 933cd10

Browse files
Update Pydantic Example
1 parent 02f7396 commit 933cd10

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

examples/pydantic_ai_integration.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,17 @@
2727

2828

2929
def _to_pydantic_ai_tool(stackone_tool) -> Tool:
30-
"""Convert a StackOneTool to a Pydantic AI Tool using the public API."""
30+
"""Convert a StackOneTool to a Pydantic AI Tool with the proper JSON schema."""
31+
params_schema = stackone_tool.to_openai_function()["function"]["parameters"]
3132

3233
def execute(**kwargs: object) -> str:
3334
return json.dumps(stackone_tool.execute(kwargs))
3435

35-
return Tool(
36+
return Tool.from_schema(
3637
execute,
3738
name=stackone_tool.name,
3839
description=stackone_tool.description,
40+
json_schema=params_schema,
3941
)
4042

4143

0 commit comments

Comments
 (0)