structured_outputs.py — anthropic-sdk-python Source File
Architecture documentation for structured_outputs.py, a python file in the anthropic-sdk-python codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 7cd3a254_17f6_7e3a_8041_dda9d5646798["structured_outputs.py"] 21de8837_7dae_989e_fdbb_1415c0770d90["pydantic"] 7cd3a254_17f6_7e3a_8041_dda9d5646798 --> 21de8837_7dae_989e_fdbb_1415c0770d90 d10c5377_2939_0f0b_cc44_8759393f2853["anthropic"] 7cd3a254_17f6_7e3a_8041_dda9d5646798 --> d10c5377_2939_0f0b_cc44_8759393f2853 style 7cd3a254_17f6_7e3a_8041_dda9d5646798 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import pydantic
import anthropic
class Order(pydantic.BaseModel):
product_name: str
price: float
quantity: int
client = anthropic.Anthropic()
prompt = """
Extract the product name, price, and quantity from this customer message:
"Hi, I’d like to order 2 packs of Green Tea for 5.50 dollars each."
"""
parsed_message = client.messages.parse(
model="claude-sonnet-4-5",
messages=[{"role": "user", "content": prompt}],
max_tokens=1024,
output_format=Order,
)
print(parsed_message.parsed_output) # Order(product_name='Green Tea', price=5.5, quantity=2)
Classes
Dependencies
- anthropic
- pydantic
Source
Frequently Asked Questions
What does structured_outputs.py do?
structured_outputs.py is a source file in the anthropic-sdk-python codebase, written in python.
What does structured_outputs.py depend on?
structured_outputs.py imports 2 module(s): anthropic, pydantic.
Where is structured_outputs.py in the architecture?
structured_outputs.py is located at examples/structured_outputs.py (directory: examples).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free