You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-16Lines changed: 16 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -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
-
classSupportResult(BaseModel):
116
+
# This pydantic model defines the structure of the output returned by the agent.
117
+
classSupportOutput(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.'
0 commit comments