Skip to content

fix: drop assistant prefill from structured output tutorial - #44

Merged
amrynsky merged 1 commit into
mainfrom
fix/issue-43-prefill-4-6
Apr 14, 2026
Merged

fix: drop assistant prefill from structured output tutorial#44
amrynsky merged 1 commit into
mainfrom
fix/issue-43-prefill-4-6

Conversation

@amrynsky

Copy link
Copy Markdown
Contributor

Summary

  • Claude 4.6 removed support for assistant-message prefill, breaking method B of 05_structured_output_anthropic.py with a 400 error.
  • Method B now demonstrates XML scaffolding alone (still a valid Anthropic-specific prompting technique); the {"role": "assistant", "content": "{"} seed and the "{" + raw reconstruction are gone.
  • README, menu labels, and docstrings updated; added a short note explaining why prefill was dropped and linking to the breaking-changes doc.

Closes #43

Test plan

  • `uv run ruff check` + `uv run ruff format --check` pass on the edited file
  • `ast.parse` succeeds
  • Run `uv run --directory 01-foundations/02-prompt-engineering python 05_structured_output_anthropic.py` and exercise method B end-to-end against Claude 4.6

🤖 Generated with Claude Code

Claude 4.6 removed support for assistant-message prefill — the conversation
must end with a user message. Method B now demonstrates XML scaffolding
alone, which remains a valid Anthropic-specific prompting technique and
works across current models. README updated with a note linking to the
4.6 breaking-changes docs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@amrynsky
amrynsky merged commit f18c025 into main Apr 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Anthropic models from 4.6 don't support prefill

1 participant