PydanticAIInteroperabilityInteroperable
protocol for converting Pydantic AI tools
into a general Tool
format.PydanticAITool
and converts it into a standard Tool
object,
ensuring compatibility between Pydantic AI tools and other systems that expect
the Tool
format. It also provides a mechanism for injecting context parameters
into the tool’s function.
Tool
format.PydanticAITool
,
handles context dependencies if necessary, and returns a standardized Tool
object.Name | Description |
---|---|
cls | |
tool | The tool to convert, expected to be an instance of PydanticAITool .Type: Any |
deps | The dependencies to inject into the context, required if the tool takes a context. Defaults to None. Type: Any Default: None |
**kwargs | Additional arguments that are not used in this method. Type: Any |
Type | Description |
---|---|
Tool | Tool: A standardized Tool object converted from the Pydantic AI tool. |
Name | Description |
---|---|
ctx | The run context, which may include dependencies and retry information. Type: Any |
tool | The Pydantic AI tool whose function is to be wrapped. Type: Any |
Type | Description |
---|---|
Callable[…, Any] | Callable[…, Any]: A wrapped function that includes context injection and retry handling. |