Skip to main content

A factory type that enables structured output behavior in Pydantic models.

Example usage:

from pydantic_ai import Agent
from pydantic import BaseModel
from pydantic_outputs import structured, StructuredOutput

# structured is a type alias for StructuredOutput
# StructuredOutput(Model) is equivalent to @structured <ModelDef>

@structured
class FooBar(BaseModel):
    foo: str
    bar: int

class BarBaz(BaseModel):
    bar: str
    baz: int

agent = Agent('test')
result = agent.run_sync(
    "Generate a sample object",
    output_type=[FooBar, StructuredOutput(BarBaz)]
)

assert isinstance(result.output, dict)

Release files for pydantic-outputs 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydantic-outputs 0.1.2
File Size Uploaded
pydantic_outputs-0.1.2.tar.gz 2.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-outputs 0.1.2
File Interpreter ABI Platform
pydantic_outputs-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 4.8 kB

Release files / pydantic_outputs-0.1.2.tar.gz

Download URL pydantic_outputs-0.1.2.tar.gz
Size 2.2 kB
Tags Source
SHA-256 checksum
How to use checksums
80d4e83aebef35639fab93ecc8711d64fa92dd37a08dc928a14ad4b032ebd2a4
BLAKE2b-256 checksum
How to use checksums
242347c497a0add1f5ed5a259b1afda77108fd56718d00531eee481c96bbeed7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.7

Release files / pydantic_outputs-0.1.2-py3-none-any.whl

Download URL pydantic_outputs-0.1.2-py3-none-any.whl
Size 2.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
abb655a00de17bcbcfe2ac2f8db3e604b3265954ae413e0f050380c411c3a330
BLAKE2b-256 checksum
How to use checksums
0289ae3f19687970adffc42ffb5c9a74e102eb3a88bddee7f1f13a42a05fa306
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page