CCDV-F practice › Prompt & Context Engineering · Question 17 of 92
Prompt & Context Engineering
A pipeline calls a JSON parser directly on model output and crashes whenever the model wraps its JSON in a sentence of prose. What's the fix?
Show answer and explanation
Answer: B — Validate against a schema, handle deviations explicitly, and retry with the error fed back
Defensive parsing assumes the model will occasionally deviate and handles it in code — schema validation plus a feedback retry loop — rather than hoping a politer prompt eliminates the deviation entirely.
Keep going
More Prompt & Context Engineering questions
- An instruction only sometimes applies — like a special discount policy only for orders…
- A model reliably follows a format on 3 worked examples in training conversations but…
- An agent's search tool returns 40 results; the agent needed 3. All 40 stay in the…
- A constraint applies only when one specific tool runs — not on every turn. Where should…
- A summarization prompt says 'don't be too long, don't leave out anything important…