liveBook · Manning

Pydantic

Pydantic is a Python library for defining typed data models and schemas, validating and parsing data against them, and serializing validated values.

How 4 Manning books explain it

Build Financial Software with Generative AI (From Scratch)

Pydantic is a Python library for declaring data models and validating and serializing data using Python type annotations.

How it is used
Models ACH API responses, database records, and audit-log data while validating fields and documenting endpoints.
How deep it goes
Builds typed models, constraints, validators, SQL handoffs, and tests; defers an object-relational mapper rather than hiding SQL.
Examples
Uses ACH file IDs, uploaded-file totals, bank routing numbers, and audit-log IP addresses and URLs.
What you can do after
Apply it via Pydantic and FastAPI to define ACH responses, validate fields, document APIs, and pass modeled records to SQL routines.

Read how Build Financial Software with Generative AI (From Scratch) explains Pydantic →

Build Python Web Apps with Streamlit

pydantic is a Python data-validation library that uses type annotations to validate and serialize data against declared schemas.

How it is used
Structures and validates LLM responses so applications can parse quiz evaluations reliably.
How deep it goes
Defines BaseModel schemas and application usage while deferring inheritance and implementation internals.
Examples
Uses an AnswerEvaluation model to validate quiz correctness and return the correct answer.
What you can do after
Build typed response schemas and consume parsed fields in an OpenAI-powered Python application.

Read how Build Python Web Apps with Streamlit explains Pydantic →

Django in Action

Pydantic is a Python library for declaring data schemas with type annotations and validating or serializing structured data.

How it is used
Supports Django Ninja API endpoints that expose Django ORM objects as JSON.
How deep it goes
Explains typed schema declarations and ModelSchema configuration, stopping short of Pydantic internals.
Examples
Uses a promoters endpoint that serializes identifiers, names, dates, and a null death value.
What you can do after
Build it from scratch by defining a ModelSchema and returning a Django queryset from a typed API response.

Read how Django in Action explains Pydantic →

AI Agents in Action, Second Edition

Pydantic is a Python library for defining typed data models and validating, parsing, and serializing data.

How it is used
Stabilizes agent handoffs by constraining language-model inputs and outputs to inspectable data structures.
How deep it goes
Demonstrates model definitions, nested task structures, strict JSON-schema failures, and a repair using explicit fields.
Examples
Uses research-plan models, list and dictionary task formats, TypedDict task records, and extra='forbid'.
What you can do after
Build structured agent outputs and diagnose strict-schema failures without relying on brittle string parsing.

Read how AI Agents in Action, Second Edition explains Pydantic →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.