new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

explore / Backend & APIs / mozg / Pydantic

Pydantic · Concepts

Answer questions about the Pydantic concepts: models and their config, fields and aliases, validators and serializers, dataclasses, JSON Schema, strict mode, type adapters, and how each standard and custom type is coerced.

422 notes · updated 2026-08-10 · trained 82%

use this brain
# sign in to get a token
$ claude mcp add --transport http mozg \
https://mozg.sh/mcp --header "Authorization: Bearer …"
> use mozg/pydantic-concepts — …
Sign in — get this command with your token in it

New here? Sign in and this exact command appears with your token already inside — copy, paste into your terminal, done.

Or just add it

Sign in and add it, and every agent you have connected can read it — nothing to download, and it stays current as the author updates it.

Sign in to add it

Ask it things like

answers 25/30 on its latest exam
What does model_construct() do, and how does it handle extra data?Models
What is the purpose of TypeAdapter?Type Adapters
What are the four types of field validators in Pydantic?Validators
What does arbitrary_types_allowed do when set to True?Configuration
What is the difference between extra='forbid' and extra='ignore'?Configuration
What is the difference between Pydantic dataclasses and Python stdlib dataclasses?Configuration
What happens when you call model_dump(by_alias=True)?Fields & Aliases
What is the difference between exclude_defaults and exclude_none in model_dump()?Fields & Aliases

What it can answer

30 coverage checks
82%
Answers 25 of the exam's 30 questionsIt answers 25 questions, the same as last time.
Fields & Aliases4 / 5
Type Coercion4 / 4
Validators4 / 4
Configuration3 / 4
Serializers3 / 3
Strict Mode3 / 3
JSON Schema2 / 2
Models1 / 4
Type Adapters1 / 1
exam badge — share this score →

Attacks survived

re-run weekly · 2026-08-10
gate-battery12/12 known hostile payloads caught by the ingest gate
injection-corpusevery active note scanned — no steering language
secret-corpusevery active note scanned — no keys or credentials

heuristic scans against known attack classes — measured and dated, not a promise of unpoisonability

Inside

  • Prefer after validators over before validators · validators
  • Recursive type aliases with TypeAliasType · models
  • Assignment form vs Annotated pattern for Field · fields & aliases
  • StringConstraints for string-specific constraints · type coercion
  • Avoid unions for type coercion · type coercion
  • Avoid from __future__ import annotations in Pydantic modules · models
  • Pydantic purpose and use cases · models
  • Field metadata types: field-specific vs type-specific · fields & aliases
  • Field-specific metadata must apply to whole union type · fields & aliases
  • Use built-in validation constraints instead of custom validators · validators
  • Annotated pattern for validators over decorator pattern · validators
  • Type coercion in non-strict mode · strict mode
  • Avoid abstract collections types · type coercion
  • Subclass serialization uses defined type not runtime value · models

Licence

CC BY-NC-SA 4.0

Use it, copy it, build on it, with credit. Selling it is not allowed.