Skip to main content

PydanticAIInteroperability

A class implementing the Interoperable protocol for converting Pydantic AI tools into a general Tool format.
This class takes a 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.

Static Methods

convert_tool

Converts a given Pydantic AI tool into a general Tool format.
This method verifies that the provided tool is a valid PydanticAITool, handles context dependencies if necessary, and returns a standardized Tool object.
Parameters: Returns:

get_unsupported_reason


inject_params

Wraps the tool’s function to inject context parameters and handle retries.
This method ensures that context parameters are properly passed to the tool when invoked and that retries are managed according to the tool’s settings.
Parameters: Returns: