pydantic_ai.models.test
Utilities for testing apps built with PydanticAI.
TestModel
dataclass
Bases: Model
A model specifically for testing purposes.
This will (by default) call all retrievers in the agent model, then return a tool response if possible, otherwise a plain response.
How useful this function will be is unknown, it may be useless, it may require significant changes to be useful.
Apart from __init__
derived by the dataclass
decorator, all methods are private or match those
of the base class.
call_retrievers
class-attribute
instance-attribute
List of retrievers to call. If 'all'
, all retrievers will be called.
custom_result_text
class-attribute
instance-attribute
custom_result_text: str | None = None
If set, this text is return as teh final result.
custom_result_args
class-attribute
instance-attribute
custom_result_args: Any | None = None
If set, these args will be passed to the result tool.