An architect is designing a system prompt for a data extraction task where Claude must extract specific fields from unstructured text and return only field values. The team observes that Claude includes explanatory prose when only field values are needed. Which prompt engineering technique most directly addresses this?
Select an answer to reveal the explanation.
Short Explanation
Here's the deal — you need structural control, not just a terseness hint. XML tags give Claude a clear template, and a prefilled assistant response makes it start right in the field values. That kills the extra prose.
Full Explanation
Two techniques work synergistically here. First, using XML tags (e.g., <fields>, <name>, <date>) in the output format specification gives Claude an unambiguous structural template to follow. Second, prefilling the assistant turn (providing the opening of Claude's response as an assistant role message in the messages array) forces Claude to continue from where the prefill ends, effectively eliminating any preamble or explanation before the structured data. Together these provide structural control over output format. The approach of increasing temperature to 0.0 affects randomness, not verbosity — Claude will still add prose, just deterministically. The approach of adding the instruction 'Be concise' is a soft instruction that can be overridden by Claude's helpful tendencies; it's less reliable than structural controls. The approach of switching to Claude 3 Haiku for its supposedly shorter default output style compared with larger models is incorrect — model tier doesn't reliably control output verbosity in the way described.