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
{{ message }}
This repository was archived by the owner on Sep 15, 2026. It is now read-only.
Section: "Accessing Claude with the API"
Lesson: "Structured Data"
Problem
The "Structured Data" lesson teaches structured JSON extraction using the prefilled assistant message + stop sequence technique (prefilling the
assistant turn with ```json and setting ``` as a stop
sequence).
This approach is no longer the current best practice and conflicts with the
feature Anthropic now recommends for this exact use case:
Structured outputs are now the purpose-built, recommended solution
for getting valid JSON, and are not covered by the course. The output_config.format parameter with a JSON schema uses constrained
decoding to guarantee schema-valid output ("Always valid: No more
JSON.parse() errors ... no retries needed"). It is generally available
for Claude Opus 4.7, Opus 4.6, Sonnet 4.6, Sonnet 4.5, Opus 4.5, and
Haiku 4.5.
Ref: https://platform.claude.com/docs/en/build-with-claude/structured-outputs
The technique taught is explicitly incompatible with structured
outputs. The structured outputs documentation lists "Message
Prefilling" as incompatible with JSON outputs. So the method the lesson
teaches cannot be combined with the modern recommended approach, and
learners are being taught a pattern that the current API design steers
away from.
Suggested fix
Update the "Structured Data" lesson to teach structured outputs
(output_config.format / json_schema) as the primary method, and present
prefill + stop sequences (and tool use) as historical or alternative
approaches with their current limitations clearly noted.
Related
Part of the broader pattern of course material lagging behind the current
API. See #71 (dynamic model name selection in course notebooks).
Activity
fix: update claude-3-haiku-20240307 to claude-haiku-4-5 in 04_paramet…