pydantic-ai 1.14.0__py3-none-any.whl → 1.44.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pydantic-ai
3
- Version: 1.14.0
3
+ Version: 1.44.0
4
4
  Summary: Agent Framework / shim to use Pydantic with LLMs
5
5
  Project-URL: Homepage, https://ai.pydantic.dev
6
6
  Project-URL: Source, https://github.com/pydantic/pydantic-ai
@@ -26,25 +26,27 @@ Classifier: Topic :: Internet
26
26
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
27
27
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
28
28
  Requires-Python: >=3.10
29
- Requires-Dist: pydantic-ai-slim[ag-ui,anthropic,bedrock,cli,cohere,evals,fastmcp,google,groq,huggingface,logfire,mcp,mistral,openai,retries,temporal,ui,vertexai]==1.14.0
29
+ Requires-Dist: pydantic-ai-slim[ag-ui,anthropic,bedrock,cli,cohere,evals,fastmcp,google,groq,huggingface,logfire,mcp,mistral,openai,retries,temporal,ui,vertexai]==1.44.0
30
30
  Provides-Extra: a2a
31
31
  Requires-Dist: fasta2a>=0.4.1; extra == 'a2a'
32
32
  Provides-Extra: dbos
33
- Requires-Dist: pydantic-ai-slim[dbos]==1.14.0; extra == 'dbos'
33
+ Requires-Dist: pydantic-ai-slim[dbos]==1.44.0; extra == 'dbos'
34
34
  Provides-Extra: examples
35
- Requires-Dist: pydantic-ai-examples==1.14.0; extra == 'examples'
35
+ Requires-Dist: pydantic-ai-examples==1.44.0; extra == 'examples'
36
36
  Provides-Extra: outlines-llamacpp
37
- Requires-Dist: pydantic-ai-slim[outlines-llamacpp]==1.14.0; extra == 'outlines-llamacpp'
37
+ Requires-Dist: pydantic-ai-slim[outlines-llamacpp]==1.44.0; extra == 'outlines-llamacpp'
38
38
  Provides-Extra: outlines-mlxlm
39
- Requires-Dist: pydantic-ai-slim[outlines-mlxlm]==1.14.0; extra == 'outlines-mlxlm'
39
+ Requires-Dist: pydantic-ai-slim[outlines-mlxlm]==1.44.0; (platform_system == 'Darwin' and platform_machine == 'arm64') and extra == 'outlines-mlxlm'
40
40
  Provides-Extra: outlines-sglang
41
- Requires-Dist: pydantic-ai-slim[outlines-sglang]==1.14.0; extra == 'outlines-sglang'
41
+ Requires-Dist: pydantic-ai-slim[outlines-sglang]==1.44.0; extra == 'outlines-sglang'
42
42
  Provides-Extra: outlines-transformers
43
- Requires-Dist: pydantic-ai-slim[outlines-transformers]==1.14.0; extra == 'outlines-transformers'
43
+ Requires-Dist: pydantic-ai-slim[outlines-transformers]==1.44.0; extra == 'outlines-transformers'
44
44
  Provides-Extra: outlines-vllm-offline
45
- Requires-Dist: pydantic-ai-slim[outlines-vllm-offline]==1.14.0; extra == 'outlines-vllm-offline'
45
+ Requires-Dist: pydantic-ai-slim[outlines-vllm-offline]==1.44.0; extra == 'outlines-vllm-offline'
46
46
  Provides-Extra: prefect
47
- Requires-Dist: pydantic-ai-slim[prefect]==1.14.0; extra == 'prefect'
47
+ Requires-Dist: pydantic-ai-slim[prefect]==1.44.0; extra == 'prefect'
48
+ Provides-Extra: sentence-transformers
49
+ Requires-Dist: pydantic-ai-slim[sentence-transformers]==1.44.0; extra == 'sentence-transformers'
48
50
  Description-Content-Type: text/markdown
49
51
 
50
52
  <div align="center">
@@ -88,7 +90,7 @@ We built Pydantic AI with one simple aim: to bring that FastAPI feeling to GenAI
88
90
  [Pydantic Validation](https://docs.pydantic.dev/latest/) is the validation layer of the OpenAI SDK, the Google ADK, the Anthropic SDK, LangChain, LlamaIndex, AutoGPT, Transformers, CrewAI, Instructor and many more. _Why use the derivative when you can go straight to the source?_ :smiley:
89
91
 
90
92
  2. **Model-agnostic**:
91
- Supports virtually every [model](https://ai.pydantic.dev/models/overview) and provider: OpenAI, Anthropic, Gemini, DeepSeek, Grok, Cohere, Mistral, and Perplexity; Azure AI Foundry, Amazon Bedrock, Google Vertex AI, Ollama, LiteLLM, Groq, OpenRouter, Together AI, Fireworks AI, Cerebras, Hugging Face, GitHub, Heroku, Vercel, Nebius, OVHcloud, and Outlines. If your favorite model or provider is not listed, you can easily implement a [custom model](https://ai.pydantic.dev/models/overview#custom-models).
93
+ Supports virtually every [model](https://ai.pydantic.dev/models/overview) and provider: OpenAI, Anthropic, Gemini, DeepSeek, Grok, Cohere, Mistral, and Perplexity; Azure AI Foundry, Amazon Bedrock, Google Vertex AI, Ollama, LiteLLM, Groq, OpenRouter, Together AI, Fireworks AI, Cerebras, Hugging Face, GitHub, Heroku, Vercel, Nebius, OVHcloud, Alibaba Cloud, SambaNova, and Outlines. If your favorite model or provider is not listed, you can easily implement a [custom model](https://ai.pydantic.dev/models/overview#custom-models).
92
94
 
93
95
  3. **Seamless Observability**:
94
96
  Tightly [integrates](https://ai.pydantic.dev/logfire) with [Pydantic Logfire](https://pydantic.dev/logfire), our general-purpose OpenTelemetry observability platform, for real-time debugging, evals-based performance monitoring, and behavior, tracing, and cost tracking. If you already have an observability platform that supports OTel, you can [use that too](https://ai.pydantic.dev/logfire#alternative-observability-backends).
@@ -0,0 +1,5 @@
1
+ pydantic_ai-1.44.0.dist-info/METADATA,sha256=rhHbO1NEEzDGjnMfag-V-Fc1UFVrbmu7b275Opr5Fbw,14449
2
+ pydantic_ai-1.44.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
3
+ pydantic_ai-1.44.0.dist-info/entry_points.txt,sha256=kbKxe2VtDCYS06hsI7P3uZGxcVC08-FPt1rxeiMpIps,50
4
+ pydantic_ai-1.44.0.dist-info/licenses/LICENSE,sha256=vA6Jc482lEyBBuGUfD1pYx-cM7jxvLYOxPidZ30t_PQ,1100
5
+ pydantic_ai-1.44.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.27.0
2
+ Generator: hatchling 1.28.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
README.md DELETED
@@ -1,201 +0,0 @@
1
- <div align="center">
2
- <a href="https://ai.pydantic.dev/">
3
- <picture>
4
- <source media="(prefers-color-scheme: dark)" srcset="https://ai.pydantic.dev/img/pydantic-ai-dark.svg">
5
- <img src="https://ai.pydantic.dev/img/pydantic-ai-light.svg" alt="Pydantic AI">
6
- </picture>
7
- </a>
8
- </div>
9
- <div align="center">
10
- <h3>GenAI Agent Framework, the Pydantic way</h3>
11
- </div>
12
- <div align="center">
13
- <a href="https://github.com/pydantic/pydantic-ai/actions/workflows/ci.yml?query=branch%3Amain"><img src="https://github.com/pydantic/pydantic-ai/actions/workflows/ci.yml/badge.svg?event=push" alt="CI"></a>
14
- <a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/pydantic/pydantic-ai"><img src="https://coverage-badge.samuelcolvin.workers.dev/pydantic/pydantic-ai.svg" alt="Coverage"></a>
15
- <a href="https://pypi.python.org/pypi/pydantic-ai"><img src="https://img.shields.io/pypi/v/pydantic-ai.svg" alt="PyPI"></a>
16
- <a href="https://github.com/pydantic/pydantic-ai"><img src="https://img.shields.io/pypi/pyversions/pydantic-ai.svg" alt="versions"></a>
17
- <a href="https://github.com/pydantic/pydantic-ai/blob/main/LICENSE"><img src="https://img.shields.io/github/license/pydantic/pydantic-ai.svg?v" alt="license"></a>
18
- <a href="https://logfire.pydantic.dev/docs/join-slack/"><img src="https://img.shields.io/badge/Slack-Join%20Slack-4A154B?logo=slack" alt="Join Slack" /></a>
19
- </div>
20
-
21
- ---
22
-
23
- **Documentation**: [ai.pydantic.dev](https://ai.pydantic.dev/)
24
-
25
- ---
26
-
27
- ### <em>Pydantic AI is a Python agent framework designed to help you quickly, confidently, and painlessly build production grade applications and workflows with Generative AI.</em>
28
-
29
-
30
- FastAPI revolutionized web development by offering an innovative and ergonomic design, built on the foundation of [Pydantic Validation](https://docs.pydantic.dev) and modern Python features like type hints.
31
-
32
- Yet despite virtually every Python agent framework and LLM library using Pydantic Validation, when we began to use LLMs in [Pydantic Logfire](https://pydantic.dev/logfire), we couldn't find anything that gave us the same feeling.
33
-
34
- We built Pydantic AI with one simple aim: to bring that FastAPI feeling to GenAI app and agent development.
35
-
36
- ## Why use Pydantic AI
37
-
38
- 1. **Built by the Pydantic Team**:
39
- [Pydantic Validation](https://docs.pydantic.dev/latest/) is the validation layer of the OpenAI SDK, the Google ADK, the Anthropic SDK, LangChain, LlamaIndex, AutoGPT, Transformers, CrewAI, Instructor and many more. _Why use the derivative when you can go straight to the source?_ :smiley:
40
-
41
- 2. **Model-agnostic**:
42
- Supports virtually every [model](https://ai.pydantic.dev/models/overview) and provider: OpenAI, Anthropic, Gemini, DeepSeek, Grok, Cohere, Mistral, and Perplexity; Azure AI Foundry, Amazon Bedrock, Google Vertex AI, Ollama, LiteLLM, Groq, OpenRouter, Together AI, Fireworks AI, Cerebras, Hugging Face, GitHub, Heroku, Vercel, Nebius, OVHcloud, and Outlines. If your favorite model or provider is not listed, you can easily implement a [custom model](https://ai.pydantic.dev/models/overview#custom-models).
43
-
44
- 3. **Seamless Observability**:
45
- Tightly [integrates](https://ai.pydantic.dev/logfire) with [Pydantic Logfire](https://pydantic.dev/logfire), our general-purpose OpenTelemetry observability platform, for real-time debugging, evals-based performance monitoring, and behavior, tracing, and cost tracking. If you already have an observability platform that supports OTel, you can [use that too](https://ai.pydantic.dev/logfire#alternative-observability-backends).
46
-
47
- 4. **Fully Type-safe**:
48
- Designed to give your IDE or AI coding agent as much context as possible for auto-completion and [type checking](https://ai.pydantic.dev/agents#static-type-checking), moving entire classes of errors from runtime to write-time for a bit of that Rust "if it compiles, it works" feel.
49
-
50
- 5. **Powerful Evals**:
51
- Enables you to systematically test and [evaluate](https://ai.pydantic.dev/evals) the performance and accuracy of the agentic systems you build, and monitor the performance over time in Pydantic Logfire.
52
-
53
- 6. **MCP, A2A, and UI**:
54
- Integrates the [Model Context Protocol](https://ai.pydantic.dev/mcp/overview), [Agent2Agent](https://ai.pydantic.dev/a2a), and various [UI event stream](https://ai.pydantic.dev/ui/overview) standards to give your agent access to external tools and data, let it interoperate with other agents, and build interactive applications with streaming event-based communication.
55
-
56
- 7. **Human-in-the-Loop Tool Approval**:
57
- Easily lets you flag that certain tool calls [require approval](https://ai.pydantic.dev/deferred-tools#human-in-the-loop-tool-approval) before they can proceed, possibly depending on tool call arguments, conversation history, or user preferences.
58
-
59
- 8. **Durable Execution**:
60
- Enables you to build [durable agents](https://ai.pydantic.dev/durable_execution/overview/) that can preserve their progress across transient API failures and application errors or restarts, and handle long-running, asynchronous, and human-in-the-loop workflows with production-grade reliability.
61
-
62
- 9. **Streamed Outputs**:
63
- Provides the ability to [stream](https://ai.pydantic.dev/output#streamed-results) structured output continuously, with immediate validation, ensuring real time access to generated data.
64
-
65
- 10. **Graph Support**:
66
- Provides a powerful way to define [graphs](https://ai.pydantic.dev/graph) using type hints, for use in complex applications where standard control flow can degrade to spaghetti code.
67
-
68
- Realistically though, no list is going to be as convincing as [giving it a try](#next-steps) and seeing how it makes you feel!
69
-
70
- ## Hello World Example
71
-
72
- Here's a minimal example of Pydantic AI:
73
-
74
- ```python
75
- from pydantic_ai import Agent
76
-
77
- # Define a very simple agent including the model to use, you can also set the model when running the agent.
78
- agent = Agent(
79
- 'anthropic:claude-sonnet-4-0',
80
- # Register static instructions using a keyword argument to the agent.
81
- # For more complex dynamically-generated instructions, see the example below.
82
- instructions='Be concise, reply with one sentence.',
83
- )
84
-
85
- # Run the agent synchronously, conducting a conversation with the LLM.
86
- result = agent.run_sync('Where does "hello world" come from?')
87
- print(result.output)
88
- """
89
- The first known use of "hello, world" was in a 1974 textbook about the C programming language.
90
- """
91
- ```
92
-
93
- _(This example is complete, it can be run "as is", assuming you've [installed the `pydantic_ai` package](https://ai.pydantic.dev/install))_
94
-
95
- The exchange will be very short: Pydantic AI will send the instructions and the user prompt to the LLM, and the model will return a text response.
96
-
97
- Not very interesting yet, but we can easily add [tools](https://ai.pydantic.dev/tools), [dynamic instructions](https://ai.pydantic.dev/agents#instructions), and [structured outputs](https://ai.pydantic.dev/output) to build more powerful agents.
98
-
99
- ## Tools & Dependency Injection Example
100
-
101
- Here is a concise example using Pydantic AI to build a support agent for a bank:
102
-
103
- **(Better documented example [in the docs](https://ai.pydantic.dev/#tools-dependency-injection-example))**
104
-
105
- ```python
106
- from dataclasses import dataclass
107
-
108
- from pydantic import BaseModel, Field
109
- from pydantic_ai import Agent, RunContext
110
-
111
- from bank_database import DatabaseConn
112
-
113
-
114
- # SupportDependencies is used to pass data, connections, and logic into the model that will be needed when running
115
- # instructions and tool functions. Dependency injection provides a type-safe way to customise the behavior of your agents.
116
- @dataclass
117
- class SupportDependencies:
118
- customer_id: int
119
- db: DatabaseConn
120
-
121
-
122
- # This Pydantic model defines the structure of the output returned by the agent.
123
- class SupportOutput(BaseModel):
124
- support_advice: str = Field(description='Advice returned to the customer')
125
- block_card: bool = Field(description="Whether to block the customer's card")
126
- risk: int = Field(description='Risk level of query', ge=0, le=10)
127
-
128
-
129
- # This agent will act as first-tier support in a bank.
130
- # Agents are generic in the type of dependencies they accept and the type of output they return.
131
- # In this case, the support agent has type `Agent[SupportDependencies, SupportOutput]`.
132
- support_agent = Agent(
133
- 'openai:gpt-5',
134
- deps_type=SupportDependencies,
135
- # The response from the agent will, be guaranteed to be a SupportOutput,
136
- # if validation fails the agent is prompted to try again.
137
- output_type=SupportOutput,
138
- instructions=(
139
- 'You are a support agent in our bank, give the '
140
- 'customer support and judge the risk level of their query.'
141
- ),
142
- )
143
-
144
-
145
- # Dynamic instructions can make use of dependency injection.
146
- # Dependencies are carried via the `RunContext` argument, which is parameterized with the `deps_type` from above.
147
- # If the type annotation here is wrong, static type checkers will catch it.
148
- @support_agent.instructions
149
- async def add_customer_name(ctx: RunContext[SupportDependencies]) -> str:
150
- customer_name = await ctx.deps.db.customer_name(id=ctx.deps.customer_id)
151
- return f"The customer's name is {customer_name!r}"
152
-
153
-
154
- # The `tool` decorator let you register functions which the LLM may call while responding to a user.
155
- # Again, dependencies are carried via `RunContext`, any other arguments become the tool schema passed to the LLM.
156
- # Pydantic is used to validate these arguments, and errors are passed back to the LLM so it can retry.
157
- @support_agent.tool
158
- async def customer_balance(
159
- ctx: RunContext[SupportDependencies], include_pending: bool
160
- ) -> float:
161
- """Returns the customer's current account balance."""
162
- # The docstring of a tool is also passed to the LLM as the description of the tool.
163
- # Parameter descriptions are extracted from the docstring and added to the parameter schema sent to the LLM.
164
- balance = await ctx.deps.db.customer_balance(
165
- id=ctx.deps.customer_id,
166
- include_pending=include_pending,
167
- )
168
- return balance
169
-
170
-
171
- ... # In a real use case, you'd add more tools and a longer system prompt
172
-
173
-
174
- async def main():
175
- deps = SupportDependencies(customer_id=123, db=DatabaseConn())
176
- # Run the agent asynchronously, conducting a conversation with the LLM until a final response is reached.
177
- # Even in this fairly simple case, the agent will exchange multiple messages with the LLM as tools are called to retrieve an output.
178
- result = await support_agent.run('What is my balance?', deps=deps)
179
- # The `result.output` will be validated with Pydantic to guarantee it is a `SupportOutput`. Since the agent is generic,
180
- # it'll also be typed as a `SupportOutput` to aid with static type checking.
181
- print(result.output)
182
- """
183
- support_advice='Hello John, your current account balance, including pending transactions, is $123.45.' block_card=False risk=1
184
- """
185
-
186
- result = await support_agent.run('I just lost my card!', deps=deps)
187
- print(result.output)
188
- """
189
- support_advice="I'm sorry to hear that, John. We are temporarily blocking your card to prevent unauthorized transactions." block_card=True risk=8
190
- """
191
- ```
192
-
193
- ## Next Steps
194
-
195
- To try Pydantic AI for yourself, [install it](https://ai.pydantic.dev/install) and follow the instructions [in the examples](https://ai.pydantic.dev/examples/setup).
196
-
197
- Read the [docs](https://ai.pydantic.dev/agents/) to learn more about building applications with Pydantic AI.
198
-
199
- Read the [API Reference](https://ai.pydantic.dev/api/agent/) to understand Pydantic AI's interface.
200
-
201
- Join [Slack](https://logfire.pydantic.dev/docs/join-slack/) or file an issue on [GitHub](https://github.com/pydantic/pydantic-ai/issues) if you have any questions.
@@ -1,6 +0,0 @@
1
- README.md,sha256=uZJ_xRYVOBA2ggClS_dJrrI2_tOxPtHI7hHGBLAOb-A,11639
2
- pydantic_ai-1.14.0.dist-info/METADATA,sha256=jT6Zf0_xe_vEsYBmaQ1L-ad68QPm-zav0bHw-7avlXI,14222
3
- pydantic_ai-1.14.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
4
- pydantic_ai-1.14.0.dist-info/entry_points.txt,sha256=kbKxe2VtDCYS06hsI7P3uZGxcVC08-FPt1rxeiMpIps,50
5
- pydantic_ai-1.14.0.dist-info/licenses/LICENSE,sha256=vA6Jc482lEyBBuGUfD1pYx-cM7jxvLYOxPidZ30t_PQ,1100
6
- pydantic_ai-1.14.0.dist-info/RECORD,,