pydantic-ai 0.0.54__py3-none-any.whl → 0.1.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.

Potentially problematic release.


This version of pydantic-ai might be problematic. Click here for more details.

README.md CHANGED
@@ -49,14 +49,14 @@ Designed to make [type checking](https://ai.pydantic.dev/agents/#static-type-che
49
49
  Leverages Python's familiar control flow and agent composition to build your AI-driven projects, making it easy to apply standard Python best practices you'd use in any other (non-AI) project.
50
50
 
51
51
  * __Structured Responses__
52
- Harnesses the power of [Pydantic](https://docs.pydantic.dev/latest/) to [validate and structure](https://ai.pydantic.dev/results/#structured-result-validation) model outputs, ensuring responses are consistent across runs.
52
+ Harnesses the power of [Pydantic](https://docs.pydantic.dev/latest/) to [validate and structure](https://ai.pydantic.dev/output/#structured-output) model outputs, ensuring responses are consistent across runs.
53
53
 
54
54
  * __Dependency Injection System__
55
- Offers an optional [dependency injection](https://ai.pydantic.dev/dependencies/) system to provide data and services to your agent's [system prompts](https://ai.pydantic.dev/agents/#system-prompts), [tools](https://ai.pydantic.dev/tools/) and [result validators](https://ai.pydantic.dev/results/#result-validators-functions).
55
+ Offers an optional [dependency injection](https://ai.pydantic.dev/dependencies/) system to provide data and services to your agent's [system prompts](https://ai.pydantic.dev/agents/#system-prompts), [tools](https://ai.pydantic.dev/tools/) and [output validators](https://ai.pydantic.dev/output/#output-validator-functions).
56
56
  This is useful for testing and eval-driven iterative development.
57
57
 
58
58
  * __Streamed Responses__
59
- Provides the ability to [stream](https://ai.pydantic.dev/results/#streamed-results) LLM outputs continuously, with immediate validation, ensuring rapid and accurate results.
59
+ Provides the ability to [stream](https://ai.pydantic.dev/output/#streamed-results) LLM outputs continuously, with immediate validation, ensuring rapid and accurate outputs.
60
60
 
61
61
  * __Graph Support__
62
62
  [Pydantic Graph](https://ai.pydantic.dev/graph) provides a powerful way to define graphs using typing hints, this is useful in complex applications where standard control flow can degrade to spaghetti code.
@@ -80,7 +80,7 @@ agent = Agent(
80
80
  # Here the exchange should be very short: PydanticAI will send the system prompt and the user query to the LLM,
81
81
  # the model will return a text response. See below for a more complex run.
82
82
  result = agent.run_sync('Where does "hello world" come from?')
83
- print(result.data)
83
+ print(result.output)
84
84
  """
85
85
  The first known use of "hello, world" was in a 1974 textbook about the C programming language.
86
86
  """
@@ -113,22 +113,22 @@ class SupportDependencies:
113
113
  db: DatabaseConn
114
114
 
115
115
 
116
- # This pydantic model defines the structure of the result returned by the agent.
117
- class SupportResult(BaseModel):
116
+ # This pydantic model defines the structure of the output returned by the agent.
117
+ class SupportOutput(BaseModel):
118
118
  support_advice: str = Field(description='Advice returned to the customer')
119
119
  block_card: bool = Field(description="Whether to block the customer's card")
120
120
  risk: int = Field(description='Risk level of query', ge=0, le=10)
121
121
 
122
122
 
123
123
  # This agent will act as first-tier support in a bank.
124
- # Agents are generic in the type of dependencies they accept and the type of result they return.
125
- # In this case, the support agent has type `Agent[SupportDependencies, SupportResult]`.
124
+ # Agents are generic in the type of dependencies they accept and the type of output they return.
125
+ # In this case, the support agent has type `Agent[SupportDependencies, SupportOutput]`.
126
126
  support_agent = Agent(
127
127
  'openai:gpt-4o',
128
128
  deps_type=SupportDependencies,
129
- # The response from the agent will, be guaranteed to be a SupportResult,
129
+ # The response from the agent will, be guaranteed to be a SupportOutput,
130
130
  # if validation fails the agent is prompted to try again.
131
- result_type=SupportResult,
131
+ output_type=SupportOutput,
132
132
  system_prompt=(
133
133
  'You are a support agent in our bank, give the '
134
134
  'customer support and judge the risk level of their query.'
@@ -150,7 +150,7 @@ async def add_customer_name(ctx: RunContext[SupportDependencies]) -> str:
150
150
  # Pydantic is used to validate these arguments, and errors are passed back to the LLM so it can retry.
151
151
  @support_agent.tool
152
152
  async def customer_balance(
153
- ctx: RunContext[SupportDependencies], include_pending: bool
153
+ ctx: RunContext[SupportDependencies], include_pending: bool
154
154
  ) -> float:
155
155
  """Returns the customer's current account balance."""
156
156
  # The docstring of a tool is also passed to the LLM as the description of the tool.
@@ -168,17 +168,17 @@ async def customer_balance(
168
168
  async def main():
169
169
  deps = SupportDependencies(customer_id=123, db=DatabaseConn())
170
170
  # Run the agent asynchronously, conducting a conversation with the LLM until a final response is reached.
171
- # Even in this fairly simple case, the agent will exchange multiple messages with the LLM as tools are called to retrieve a result.
171
+ # Even in this fairly simple case, the agent will exchange multiple messages with the LLM as tools are called to retrieve an output.
172
172
  result = await support_agent.run('What is my balance?', deps=deps)
173
- # The result will be validated with Pydantic to guarantee it is a `SupportResult`, since the agent is generic,
174
- # it'll also be typed as a `SupportResult` to aid with static type checking.
175
- print(result.data)
173
+ # The `result.output` will be validated with Pydantic to guarantee it is a `SupportOutput`. Since the agent is generic,
174
+ # it'll also be typed as a `SupportOutput` to aid with static type checking.
175
+ print(result.output)
176
176
  """
177
177
  support_advice='Hello John, your current account balance, including pending transactions, is $123.45.' block_card=False risk=1
178
178
  """
179
179
 
180
180
  result = await support_agent.run('I just lost my card!', deps=deps)
181
- print(result.data)
181
+ print(result.output)
182
182
  """
183
183
  support_advice="I'm sorry to hear that, John. We are temporarily blocking your card to prevent unauthorized transactions." block_card=True risk=8
184
184
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pydantic-ai
3
- Version: 0.0.54
3
+ Version: 0.1.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
@@ -28,9 +28,9 @@ Classifier: Topic :: Internet
28
28
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
29
29
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
30
30
  Requires-Python: >=3.9
31
- Requires-Dist: pydantic-ai-slim[anthropic,bedrock,cli,cohere,evals,groq,mcp,mistral,openai,vertexai]==0.0.54
31
+ Requires-Dist: pydantic-ai-slim[anthropic,bedrock,cli,cohere,evals,groq,mcp,mistral,openai,vertexai]==0.1.0
32
32
  Provides-Extra: examples
33
- Requires-Dist: pydantic-ai-examples==0.0.54; extra == 'examples'
33
+ Requires-Dist: pydantic-ai-examples==0.1.0; extra == 'examples'
34
34
  Provides-Extra: logfire
35
35
  Requires-Dist: logfire>=3.11.0; extra == 'logfire'
36
36
  Description-Content-Type: text/markdown
@@ -86,14 +86,14 @@ Designed to make [type checking](https://ai.pydantic.dev/agents/#static-type-che
86
86
  Leverages Python's familiar control flow and agent composition to build your AI-driven projects, making it easy to apply standard Python best practices you'd use in any other (non-AI) project.
87
87
 
88
88
  * __Structured Responses__
89
- Harnesses the power of [Pydantic](https://docs.pydantic.dev/latest/) to [validate and structure](https://ai.pydantic.dev/results/#structured-result-validation) model outputs, ensuring responses are consistent across runs.
89
+ Harnesses the power of [Pydantic](https://docs.pydantic.dev/latest/) to [validate and structure](https://ai.pydantic.dev/output/#structured-output) model outputs, ensuring responses are consistent across runs.
90
90
 
91
91
  * __Dependency Injection System__
92
- Offers an optional [dependency injection](https://ai.pydantic.dev/dependencies/) system to provide data and services to your agent's [system prompts](https://ai.pydantic.dev/agents/#system-prompts), [tools](https://ai.pydantic.dev/tools/) and [result validators](https://ai.pydantic.dev/results/#result-validators-functions).
92
+ Offers an optional [dependency injection](https://ai.pydantic.dev/dependencies/) system to provide data and services to your agent's [system prompts](https://ai.pydantic.dev/agents/#system-prompts), [tools](https://ai.pydantic.dev/tools/) and [output validators](https://ai.pydantic.dev/output/#output-validator-functions).
93
93
  This is useful for testing and eval-driven iterative development.
94
94
 
95
95
  * __Streamed Responses__
96
- Provides the ability to [stream](https://ai.pydantic.dev/results/#streamed-results) LLM outputs continuously, with immediate validation, ensuring rapid and accurate results.
96
+ Provides the ability to [stream](https://ai.pydantic.dev/output/#streamed-results) LLM outputs continuously, with immediate validation, ensuring rapid and accurate outputs.
97
97
 
98
98
  * __Graph Support__
99
99
  [Pydantic Graph](https://ai.pydantic.dev/graph) provides a powerful way to define graphs using typing hints, this is useful in complex applications where standard control flow can degrade to spaghetti code.
@@ -117,7 +117,7 @@ agent = Agent(
117
117
  # Here the exchange should be very short: PydanticAI will send the system prompt and the user query to the LLM,
118
118
  # the model will return a text response. See below for a more complex run.
119
119
  result = agent.run_sync('Where does "hello world" come from?')
120
- print(result.data)
120
+ print(result.output)
121
121
  """
122
122
  The first known use of "hello, world" was in a 1974 textbook about the C programming language.
123
123
  """
@@ -150,22 +150,22 @@ class SupportDependencies:
150
150
  db: DatabaseConn
151
151
 
152
152
 
153
- # This pydantic model defines the structure of the result returned by the agent.
154
- class SupportResult(BaseModel):
153
+ # This pydantic model defines the structure of the output returned by the agent.
154
+ class SupportOutput(BaseModel):
155
155
  support_advice: str = Field(description='Advice returned to the customer')
156
156
  block_card: bool = Field(description="Whether to block the customer's card")
157
157
  risk: int = Field(description='Risk level of query', ge=0, le=10)
158
158
 
159
159
 
160
160
  # This agent will act as first-tier support in a bank.
161
- # Agents are generic in the type of dependencies they accept and the type of result they return.
162
- # In this case, the support agent has type `Agent[SupportDependencies, SupportResult]`.
161
+ # Agents are generic in the type of dependencies they accept and the type of output they return.
162
+ # In this case, the support agent has type `Agent[SupportDependencies, SupportOutput]`.
163
163
  support_agent = Agent(
164
164
  'openai:gpt-4o',
165
165
  deps_type=SupportDependencies,
166
- # The response from the agent will, be guaranteed to be a SupportResult,
166
+ # The response from the agent will, be guaranteed to be a SupportOutput,
167
167
  # if validation fails the agent is prompted to try again.
168
- result_type=SupportResult,
168
+ output_type=SupportOutput,
169
169
  system_prompt=(
170
170
  'You are a support agent in our bank, give the '
171
171
  'customer support and judge the risk level of their query.'
@@ -187,7 +187,7 @@ async def add_customer_name(ctx: RunContext[SupportDependencies]) -> str:
187
187
  # Pydantic is used to validate these arguments, and errors are passed back to the LLM so it can retry.
188
188
  @support_agent.tool
189
189
  async def customer_balance(
190
- ctx: RunContext[SupportDependencies], include_pending: bool
190
+ ctx: RunContext[SupportDependencies], include_pending: bool
191
191
  ) -> float:
192
192
  """Returns the customer's current account balance."""
193
193
  # The docstring of a tool is also passed to the LLM as the description of the tool.
@@ -205,17 +205,17 @@ async def customer_balance(
205
205
  async def main():
206
206
  deps = SupportDependencies(customer_id=123, db=DatabaseConn())
207
207
  # Run the agent asynchronously, conducting a conversation with the LLM until a final response is reached.
208
- # Even in this fairly simple case, the agent will exchange multiple messages with the LLM as tools are called to retrieve a result.
208
+ # Even in this fairly simple case, the agent will exchange multiple messages with the LLM as tools are called to retrieve an output.
209
209
  result = await support_agent.run('What is my balance?', deps=deps)
210
- # The result will be validated with Pydantic to guarantee it is a `SupportResult`, since the agent is generic,
211
- # it'll also be typed as a `SupportResult` to aid with static type checking.
212
- print(result.data)
210
+ # The `result.output` will be validated with Pydantic to guarantee it is a `SupportOutput`. Since the agent is generic,
211
+ # it'll also be typed as a `SupportOutput` to aid with static type checking.
212
+ print(result.output)
213
213
  """
214
214
  support_advice='Hello John, your current account balance, including pending transactions, is $123.45.' block_card=False risk=1
215
215
  """
216
216
 
217
217
  result = await support_agent.run('I just lost my card!', deps=deps)
218
- print(result.data)
218
+ print(result.output)
219
219
  """
220
220
  support_advice="I'm sorry to hear that, John. We are temporarily blocking your card to prevent unauthorized transactions." block_card=True risk=8
221
221
  """
@@ -0,0 +1,6 @@
1
+ README.md,sha256=vGyV79yGdcp1dyQRoZgNinQLIBA-FG0YGgpi3kga9jo,9747
2
+ pydantic_ai-0.1.0.dist-info/METADATA,sha256=TNjXAm8SCdJuyVpOZwxvpG1PsRNQEvVMbJjeyWgsMfs,11528
3
+ pydantic_ai-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
4
+ pydantic_ai-0.1.0.dist-info/entry_points.txt,sha256=KxQSmlMS8GMTkwTsl4_q9a5nJvBjj3HWeXx688wLrKg,45
5
+ pydantic_ai-0.1.0.dist-info/licenses/LICENSE,sha256=vA6Jc482lEyBBuGUfD1pYx-cM7jxvLYOxPidZ30t_PQ,1100
6
+ pydantic_ai-0.1.0.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- README.md,sha256=lsQc4E2cdBhbhGeX5vrb4bVj_3hHp-lsz0POdwbfUes,9742
2
- pydantic_ai-0.0.54.dist-info/METADATA,sha256=qfDFeYcgXA8Bs5-4EZmEXZRPg6PowEl8FZ_o5rcWE2g,11526
3
- pydantic_ai-0.0.54.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
4
- pydantic_ai-0.0.54.dist-info/entry_points.txt,sha256=KxQSmlMS8GMTkwTsl4_q9a5nJvBjj3HWeXx688wLrKg,45
5
- pydantic_ai-0.0.54.dist-info/licenses/LICENSE,sha256=vA6Jc482lEyBBuGUfD1pYx-cM7jxvLYOxPidZ30t_PQ,1100
6
- pydantic_ai-0.0.54.dist-info/RECORD,,