AITraining2U

Programs

Resources

Case Studies

Quick Links

Enquire Now
Domain 3 · 20%% of exam

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.

Key points
  • 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 enum in a schema or strict tool is stronger than any prefill ever was: it constrains the value before generation rather than the first few characters.
Reference
Prefill was used for Replacement
Forcing JSON / schema shapeoutput_config.format with a json_schema
Forcing a classification labelTool or schema with an enum field
Skipping preamblesSystem prompt: "Respond directly without preamble"
Continuing an interrupted responseMove the continuation into the user turn
Steering around bad refusalsUsually unnecessary now — plain prompting suffices
Exam trap

"Move the prefill into a user message" — a partial JSON fragment in a user turn constrains nothing.

Check your understanding

Assistant prefills now return 400. What replaces a prefill used to force JSON?

Correct answer: B — output_config.format with a json_schema
A partial JSON fragment in a user turn constrains nothing.

What replaces a prefill used to force one of six labels?

Correct answer: A — An enum in a schema or strict tool
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 app

Source: Claude Docs — Model migration guide · Independent study aid, not affiliated with or endorsed by Anthropic.