MCPcopy Create free account

hub / github.com/pydantic/pydantic-ai / types & classes

Types & classes3,079 in github.com/pydantic/pydantic-ai

↓ 4,212 callersClassAgent
Class for defining "agents" - a way to have a specific type of "conversation" with an LLM. Agents are generic in the dependency type they take [`
pydantic_ai_slim/pydantic_ai/agent/__init__.py:446
↓ 1,598 callersClassModelResponse
A response from a model, e.g. a message from the model to the Pydantic AI app.
pydantic_ai_slim/pydantic_ai/messages.py:2799
↓ 1,457 callersClassModelRequest
A request generated by Pydantic AI and sent to a model, e.g. a message from the Pydantic AI app to the model.
pydantic_ai_slim/pydantic_ai/messages.py:2091
↓ 1,374 callersClassFunctionModel
A model controlled by a local function. Apart from `__init__`, all methods are private or match those of the base class.
pydantic_ai_slim/pydantic_ai/models/function.py:51
↓ 1,283 callersClassUserPromptPart
A user prompt, generally written by the end user. Content comes from the `user_prompt` parameter of [`Agent.run`][pydantic_ai.agent.AbstractAgent
pydantic_ai_slim/pydantic_ai/messages.py:1125
↓ 1,139 callersClassTextPart
A plain text response from a model.
pydantic_ai_slim/pydantic_ai/messages.py:2150
↓ 958 callersClassTestModel
tests/models/test_model_test.py:474
↓ 811 callersClassRequestUsage
LLM usage associated with a single request. This is an implementation of `genai_prices.types.AbstractUsage` so it can be used to calculate the pr
pydantic_ai_slim/pydantic_ai/usage.py:274
↓ 752 callersClassModelRequestParameters
Configuration for an agent's request to a model, specifically related to tools and output handling.
pydantic_ai_slim/pydantic_ai/models/__init__.py:178
↓ 736 callersClassToolCallPart
A tool call from a model.
pydantic_ai_slim/pydantic_ai/messages.py:2536
↓ 606 callersClassOpenAIProvider
Provider for OpenAI API. Changing `base_url` does not change the OpenAI model profile selection. For another service, use its dedicated provi
pydantic_ai_slim/pydantic_ai/providers/openai.py:28
↓ 466 callersClassToolReturnPart
A tool return message, this encodes the result of running a tool.
pydantic_ai_slim/pydantic_ai/messages.py:1705
↓ 381 callersClassAnthropicModel
A model that uses the Anthropic API. Internally, this uses the [Anthropic Python client](https://github.com/anthropics/anthropic-sdk-python) to i
pydantic_ai_slim/pydantic_ai/models/anthropic.py:815
↓ 380 callersClassAnthropicProvider
Provider for Anthropic API.
pydantic_ai_slim/pydantic_ai/providers/anthropic.py:76
↓ 345 callersClassOpenAIResponsesModel
A model that uses the OpenAI Responses API. The [OpenAI Responses API](https://platform.openai.com/docs/api-reference/responses) is the new A
pydantic_ai_slim/pydantic_ai/models/openai.py:1974
↓ 331 callersClassUserError
Error caused by a usage mistake by the application developer — You!
pydantic_ai_slim/pydantic_ai/exceptions.py:229
↓ 262 callersClassToolDefinition
Definition of a tool passed to a model. This is used for both function tools and output tools.
pydantic_ai_slim/pydantic_ai/tools.py:587
↓ 254 callersClassFunctionToolset
A toolset that lets Python functions be used as tools. See [toolset docs](../toolsets.md#function-toolset) for more information.
pydantic_ai_slim/pydantic_ai/toolsets/function.py:50
↓ 251 callersClassFakeRealtimeConnection
A connection that replays a fixed list of events and records what is sent.
tests/realtime/test_session.py:273
↓ 250 callersClassResponseDone
The provider reported that its current response is done. This codec event is consumed by the session to finalize a [`ModelResponse`][pydantic
pydantic_ai_slim/pydantic_ai/realtime/codec.py:251
↓ 249 callersClassRunUsage
LLM usage associated with an agent run. Responsibility for calculating request usage is on the model; Pydantic AI simply sums the usage informati
pydantic_ai_slim/pydantic_ai/usage.py:342
↓ 244 callersClassOpenAIChatModel
A model that uses the OpenAI API. Internally, this uses the [OpenAI Python client](https://github.com/openai/openai-python) to interact with the
pydantic_ai_slim/pydantic_ai/models/openai.py:957
↓ 240 callersClassBedrockConverseModel
A model that uses the Bedrock Converse API.
pydantic_ai_slim/pydantic_ai/models/bedrock.py:601
↓ 214 callersClassThinkingPart
A thinking response from a model.
pydantic_ai_slim/pydantic_ai/messages.py:2188
↓ 207 callersClassGoogleModel
A model that uses Gemini via `generativelanguage.googleapis.com` API. This is implemented from scratch rather than using a dedicated SDK, good AP
pydantic_ai_slim/pydantic_ai/models/google.py:500
↓ 204 callersClassNativeTool
A capability that registers a native tool with the agent. Wraps a single [`AgentNativeTool`][pydantic_ai.tools.AgentNativeTool] — either a static
pydantic_ai_slim/pydantic_ai/capabilities/native_tool.py:18
↓ 184 callersClassXaiProvider
Provider for xAI API (native xAI SDK).
pydantic_ai_slim/pydantic_ai/providers/xai.py:53
↓ 181 callersClassNativeToolCallPart
A tool call to a native tool. For native tools with a stable cross-provider shape (currently `tool_search`), this base class can be promoted
pydantic_ai_slim/pydantic_ai/messages.py:2558
↓ 172 callersClassNativeToolReturnPart
A tool return message from a native tool. For native tools with a stable cross-provider shape (currently `tool_search`), a `NativeToolReturnP
pydantic_ai_slim/pydantic_ai/messages.py:1727
↓ 171 callersClassMCPToolset
A toolset for connecting to an MCP server. `MCPToolset` is the recommended way to use [Model Context Protocol](https://modelcontextprotocol.io)
pydantic_ai_slim/pydantic_ai/mcp.py:717
↓ 166 callersClassXaiModel
A model that uses the xAI SDK to interact with xAI models.
pydantic_ai_slim/pydantic_ai/models/xai.py:303
↓ 156 callersClassToolCall
The model is requesting a tool call.
pydantic_ai_slim/pydantic_ai/realtime/codec.py:214
↓ 152 callersClassRetryPromptPart
A message back to a model asking it to try again. This can be sent for a number of reasons: * Pydantic validation of tool arguments failed,
pydantic_ai_slim/pydantic_ai/messages.py:1770
↓ 147 callersClassModelSettings
Settings to configure an LLM. Includes only settings which apply to multiple models / model providers, though not all of these settings are s
pydantic_ai_slim/pydantic_ai/settings.py:90
↓ 146 callersClassGraphBuilder
A builder for constructing executable graph definitions. GraphBuilder provides a fluent interface for defining nodes, edges, and routing in a
pydantic_graph/pydantic_graph/graph_builder.py:1139
↓ 142 callersClassAnthropicModelSettings
Settings used for an Anthropic model request.
pydantic_ai_slim/pydantic_ai/models/anthropic.py:431
↓ 140 callersClassBinaryContent
Binary content, e.g. an audio or image file.
pydantic_ai_slim/pydantic_ai/messages.py:576
↓ 140 callersClassModelProfile
Describes how requests to and responses from specific models or families of models need to be constructed and processed to get the best results, indep
pydantic_ai_slim/pydantic_ai/profiles/__init__.py:47
↓ 137 callersClassInstrumentationSettings
Options for instrumenting models and agents with OpenTelemetry. Used in: - [`Instrumentation`][pydantic_ai.capabilities.Instrumentation] cap
pydantic_ai_slim/pydantic_ai/models/instrumented.py:63
↓ 134 callersClassOutputTranscript
The model's textual output (partial or final): an audio transcript, or plain text output.
pydantic_ai_slim/pydantic_ai/realtime/codec.py:166
↓ 133 callersClassAgentPlugin
Temporal worker plugin for a specific Pydantic AI agent. Accepts either a regular `Agent` carrying a [`TemporalDurability`][pydantic_ai.durab
pydantic_ai_slim/pydantic_ai/durable_exec/temporal/__init__.py:239
↓ 133 callersClassSystemPromptPart
A system prompt, generally written by the application developer. This gives the model context and guidance on how to respond.
pydantic_ai_slim/pydantic_ai/messages.py:209
↓ 132 callersClassModelRetry
Exception to raise to request a model retry. Can be raised from tool functions, output validators, and capability hooks (such as `after_model
pydantic_ai_slim/pydantic_ai/exceptions.py:57
↓ 131 callersClassUIMessage
A message as displayed in the UI by Vercel AI Elements.
pydantic_ai_slim/pydantic_ai/ui/vercel_ai/request_types.py:389
↓ 131 callersClassWebSearchTool
A native tool that allows your agent to search the web for information. The parameters that PydanticAI passes depend on the model, as some parame
pydantic_ai_slim/pydantic_ai/native_tools/__init__.py:140
↓ 127 callersClassOpenAIResponsesModelSettings
Settings used for an OpenAI Responses model request. ALL FIELDS MUST BE `openai_` PREFIXED SO YOU CAN MERGE THEM WITH OTHER MODELS.
pydantic_ai_slim/pydantic_ai/models/openai.py:749
↓ 122 callersClassImageUrl
A URL to an image.
pydantic_ai_slim/pydantic_ai/messages.py:448
↓ 118 callersClassBedrockModelSettings
Settings for Bedrock models. See [the Bedrock Converse API docs](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.htm
pydantic_ai_slim/pydantic_ai/models/bedrock.py:498
↓ 115 callersClassFakeRealtimeModel
A model that yields a pre-built connection and records connect arguments.
tests/realtime/test_session.py:329
↓ 113 callersClassInstructionPart
A single instruction part with metadata about its origin. Instructions are composed of one or more parts, each of which can be static (from a lit
pydantic_ai_slim/pydantic_ai/messages.py:1979
↓ 113 callersClassInstrumentation
Capability that instruments agent runs with OpenTelemetry/Logfire tracing. When added to an agent via `capabilities=[Instrumentation(...)]`, this
pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py:72
↓ 113 callersClassTextUIPart
A text part of a message.
pydantic_ai_slim/pydantic_ai/ui/vercel_ai/request_types.py:26
↓ 112 callersClassOpenAIRealtimeModel
OpenAI Realtime API model. Authentication and the base URL come from a [`Provider`][pydantic_ai.providers.Provider], mirroring [`OpenAIChatMo
pydantic_ai_slim/pydantic_ai/realtime/openai.py:892
↓ 110 callersClassFallbackModel
A model that uses one or more fallback models upon failure. Apart from `__init__`, all methods are private or match those of the base class.
pydantic_ai_slim/pydantic_ai/models/fallback.py:90
↓ 110 callersClassUsageLimits
Limits on model usage. The request count is tracked by pydantic_ai, and the request limit is checked before each request to the model. Token
pydantic_ai_slim/pydantic_ai/usage.py:446
↓ 109 callersClassPath
A sequence of path items defining data flow through the graph. Paths represent the route that data takes through the graph, including transfo
pydantic_graph/pydantic_graph/paths.py:130
↓ 107 callersClassPartStartEvent
An event indicating that a new part has started. If multiple `PartStartEvent`s are received with the same index, the new one should fully rep
pydantic_ai_slim/pydantic_ai/messages.py:4077
↓ 102 callersClassBinaryImage
Binary content that's guaranteed to be an image.
pydantic_ai_slim/pydantic_ai/messages.py:738
↓ 99 callersClassOnlineEvalConfig
Holds cross-evaluator defaults for online evaluation. Create instances for different evaluation configurations, or use the global `DEFAULT_CO
pydantic_evals/pydantic_evals/online.py:416
↓ 98 callersClassSpeechPart
Spoken audio exchanged during a realtime session, paired with its transcript. This part is a member of both [`ModelRequestPart`][pydantic_ai.mess
pydantic_ai_slim/pydantic_ai/messages.py:2338
↓ 98 callersClassSubmitMessage
Submit message request.
pydantic_ai_slim/pydantic_ai/ui/vercel_ai/request_types.py:411
↓ 97 callersClassCachePoint
A cache point marker for prompt caching. Can be inserted into UserPromptPart.content to mark cache boundaries. Models that don't support cach
pydantic_ai_slim/pydantic_ai/messages.py:790
↓ 96 callersClassFakeWebSocket
A minimal stand-in for a `websockets` client connection. Running out of scripted frames stands in for the server closing the connection normally,
tests/realtime/test_openai.py:816
↓ 96 callersClassGoogleProvider
Provider for the Gemini API (formerly Google AI Studio / Google GLA).
pydantic_ai_slim/pydantic_ai/providers/google.py:99
↓ 96 callersClassOpenAIModelProfile
Profile for models used with `OpenAIChatModel`. ALL FIELDS MUST BE `openai_` PREFIXED SO YOU CAN MERGE THEM WITH OTHER MODELS.
pydantic_ai_slim/pydantic_ai/profiles/openai.py:179
↓ 96 callersClassOpenRouterProvider
Provider for OpenRouter API.
pydantic_ai_slim/pydantic_ai/providers/openrouter.py:124
↓ 96 callersClassToolAvailabilityDeltaPart
Records that the set of tools available to the model changed at this point. Additions only. Withdrawing a tool is not supported yet, because no p
pydantic_ai_slim/pydantic_ai/messages.py:2050
↓ 94 callersClassToolOutput
Marker class to use a tool for output and optionally customize the tool. Example: ```python {title="tool_output.py"} from pydantic import
pydantic_ai_slim/pydantic_ai/output.py:83
↓ 92 callersClassNativeOutput
Marker class to use the model's native structured outputs functionality for outputs and optionally customize the name and description. Example:
pydantic_ai_slim/pydantic_ai/output.py:159
↓ 91 callersClassHooks
Register hook functions via decorators or constructor kwargs. For extension developers building reusable capabilities, subclass [`AbstractCap
pydantic_ai_slim/pydantic_ai/capabilities/hooks.py:757
↓ 91 callersClassMistralProvider
Provider for Mistral API.
pydantic_ai_slim/pydantic_ai/providers/mistral.py:48
↓ 91 callersClassUploadedFile
A reference to a file uploaded to a provider's file storage by ID. This allows referencing files that have been uploaded via provider-specific fi
pydantic_ai_slim/pydantic_ai/messages.py:839
↓ 87 callersClassPromptedOutput
Marker class to use a prompt to tell the model what to output and optionally customize the prompt. Example: ```python {title="prompted_output
pydantic_ai_slim/pydantic_ai/output.py:214
↓ 86 callersClassMistralModel
A model that uses Mistral. Internally, this uses the [Mistral Python client](https://github.com/mistralai/client-python) to interact with the API
pydantic_ai_slim/pydantic_ai/models/mistral.py:184
↓ 84 callersClassRunContext
Information about the current call.
pydantic_ai_slim/pydantic_ai/_run_context.py:133
↓ 82 callersClassDBOSDurability
Capability that makes an agent durable by routing I/O through DBOS steps. The capability routes model requests, MCP I/O, and optionally event-str
pydantic_ai_slim/pydantic_ai/durable_exec/dbos/_durability.py:32
↓ 79 callersClassTool
A tool function for an agent.
pydantic_ai_slim/pydantic_ai/tools.py:334
↓ 78 callersClassInputTranscript
A transcription of the user's audio input (partial or final). Providers with per-item IDs use `item_id` to associate interleaved transcripts with
pydantic_ai_slim/pydantic_ai/realtime/codec.py:185
↓ 76 callersClassPartDeltaEvent
An event indicating a delta update for an existing part.
pydantic_ai_slim/pydantic_ai/messages.py:4115
↓ 75 callersClassOpenRouterModel
Extends OpenAIChatModel to capture extra metadata for Openrouter.
pydantic_ai_slim/pydantic_ai/models/openrouter.py:662
↓ 74 callersClassPartEndEvent
An event indicating that a part is complete.
pydantic_ai_slim/pydantic_ai/messages.py:4131
↓ 73 callersClassAudioDelta
A chunk of audio output from the model.
pydantic_ai_slim/pydantic_ai/realtime/codec.py:153
↓ 71 callersClassPrefectDurability
Capability that makes an agent durable by routing I/O through Prefect tasks. Built on the declarative base: the base owns toolset/model/event ass
pydantic_ai_slim/pydantic_ai/durable_exec/prefect/_durability.py:32
↓ 70 callersClassCombinedCapability
A capability that combines multiple capabilities. When any child returns a fresh instance from [`for_agent`][pydantic_ai.capabilities.Abstrac
pydantic_ai_slim/pydantic_ai/capabilities/combined.py:53
↓ 68 callersClassEmbedder
High-level interface for generating text embeddings. The `Embedder` class provides a convenient way to generate vector embeddings from text u
pydantic_ai_slim/pydantic_ai/embeddings/__init__.py:143
↓ 67 callersClassImageGeneration
Image generation capability. Uses the model's native image generation when available. When the model doesn't support it, the [direct image ge
pydantic_ai_slim/pydantic_ai/capabilities/image_generation.py:104
↓ 66 callersClassDeferredToolResults
Results for deferred tool calls from a previous run that required approval or external execution. The tool call IDs need to match those from the
pydantic_ai_slim/pydantic_ai/_deferred.py:158
↓ 66 callersClassDocumentUrl
The URL of the document.
pydantic_ai_slim/pydantic_ai/messages.py:494
↓ 66 callersClassOpenAIRealtimeConnection
A live WebSocket connection to the OpenAI Realtime API.
pydantic_ai_slim/pydantic_ai/realtime/openai.py:344
↓ 65 callersClassFilePart
A file response from a model.
pydantic_ai_slim/pydantic_ai/messages.py:2300
↓ 63 callersClassCodeExecutionTool
A native tool that allows your agent to execute code. Supported by: * Anthropic * OpenAI Responses * Google * Bedrock (Nova2.0)
pydantic_ai_slim/pydantic_ai/native_tools/__init__.py:357
↓ 63 callersClassCollector
Collects sink submissions for test assertions.
tests/evals/test_online.py:116
↓ 61 callersClassDynamicToolset
A toolset that dynamically builds a toolset using a function that takes the run context.
pydantic_ai_slim/pydantic_ai/toolsets/_dynamic.py:21
↓ 61 callersClassTemporalDurability
Capability that makes an agent durable by routing I/O through Temporal activities. When added to an agent, this capability intercepts model reque
pydantic_ai_slim/pydantic_ai/durable_exec/temporal/_durability.py:119
↓ 59 callersClassTestImageGenerationModel
A deterministic image generation model for testing. This model returns a single 1x1 PNG without making any API calls, and records the reference i
pydantic_ai_slim/pydantic_ai/images/test.py:24
↓ 59 callersClassVercelAIAdapter
UI adapter for the Vercel AI protocol.
pydantic_ai_slim/pydantic_ai/ui/vercel_ai/_adapter.py:152
↓ 57 callersClassAzureProvider
Provider for Azure OpenAI API. See <https://azure.microsoft.com/en-us/products/ai-foundry> for more information.
pydantic_ai_slim/pydantic_ai/providers/azure.py:50
↓ 57 callersClassMyOutput
tests/test_tools.py:1872
↓ 56 callersClassCompactionPart
A compaction part that summarizes previous conversation history. Compaction parts contain an opaque or readable summary of prior messages, pr
pydantic_ai_slim/pydantic_ai/messages.py:2249
↓ 56 callersClassEmbeddingResult
The result of an embedding operation. This class contains the generated embeddings along with metadata about the operation, including the ori
pydantic_ai_slim/pydantic_ai/embeddings/result.py:22
next →1–100 of 3,079, ranked by callers