Add a structured outputs lesson to anthropic_api_fundamentals (#161)#164
Open
NishchayMahor wants to merge 1 commit into
Open
Add a structured outputs lesson to anthropic_api_fundamentals (#161)#164NishchayMahor wants to merge 1 commit into
NishchayMahor wants to merge 1 commit into
Conversation
…pics#161) The course's older sections cover prefill + stop_sequences and tool use for JSON extraction. Structured outputs (output_config.format with a JSON schema) is now the recommended approach because the API uses constrained decoding — the parse step can't fail and no retry loop is needed. The Skilljar 'Structured Data' lesson teaches the legacy pattern as primary and the two are explicitly incompatible (prefill can't be combined with structured outputs), so the gap is worth filling here too. New 07_structured_outputs.ipynb walks through the contact-card extraction case, contrasts it with the legacy prefill+stop pattern, and ends with a multi-meeting extraction exercise. README updated with the link.
|
I would also add that in order to run through the exercise as designed, it requires an earlier model (sonnet-4-0) which now gives a deprecation message and will no longer be available as of June 14th. The newer models don't work for this part of the course at all. |
Author
|
Good flag. The new lesson here only uses The exercises still pinned to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #161.
The Skilljar "Claude with the Anthropic API" course teaches structured JSON extraction with prefill + `stop_sequences`. Structured outputs (`output_config.format` with a JSON schema) is now the purpose-built solution — constrained decoding means the parse step can't fail and no retry loop is needed — and is explicitly incompatible with assistant prefill, so the two paths don't fit cleanly in one lesson.
This PR doesn't touch Skilljar (that's behind the platform), but it fills the gap in the open-source course material:
Happy to fold the same content into an updated Skilljar script if that's useful — let me know what the cadence is for keeping the platform version in sync.
What's in the notebook
Cells use `claude-sonnet-4-6` to match the GA list from the structured outputs reference.