Prefill removal and its replacements
A migration detail that shows up as a scenario.
3 min read · Lesson 4 of 12 in this domain
Prefilling — putting a partial assistant turn at the end of messages so Claude continues from it — was the old way to force a shape. Current models reject it with a 400, so any code carrying that pattern needs migrating. The right replacement depends on what the prefill was actually doing, which is why this shows up as a scenario rather than a lookup: forcing JSON shape maps to structured outputs, forcing a label maps to an enum, and suppressing a chatty preamble maps to a plain system-prompt instruction.
- Last-assistant-turn prefills return a 400 on current models. Adding assistant messages elsewhere (few-shot examples) still works.
- Pick the replacement that matches what the prefill was doing — the exam frames this as a scenario, not a lookup.
- For classification specifically, an
enumin a schema or strict tool is stronger than any prefill ever was: it constrains the value before generation rather than the first few characters.
| Prefill was used for | Replacement |
|---|---|
| Forcing JSON / schema shape | output_config.format with a json_schema |
| Forcing a classification label | Tool or schema with an enum field |
| Skipping preambles | System prompt: "Respond directly without preamble" |
| Continuing an interrupted response | Move the continuation into the user turn |
| Steering around bad refusals | Usually unnecessary now — plain prompting suffices |
"Move the prefill into a user message" — a partial JSON fragment in a user turn constrains nothing.
Assistant prefills now return 400. What replaces a prefill used to force JSON?
A partial JSON fragment in a user turn constrains nothing.
What replaces a prefill used to force one of six labels?
An enum resolves the value before generation rather than constraining opening characters.
Practise this domain with 20%%-weighted questions in the study app.
Open in study appSource: Claude Docs — Model migration guide · Independent study aid, not affiliated with or endorsed by Anthropic.