CCAR-F practice › Prompt Engineering & Structured Output · Question 73 of 105
Prompt Engineering & Structured Output
An extractor pulls sample size from research papers. It is accurate when the paper has a methodology section, but returns null, or occasionally a number not in the paper, when the sample size appears only in the results discussion. The prompt already says to search the whole document. What is the most effective fix?
Show answer and explanation
Answer: D — Add examples extracting sample size from both a methods section and results text
Few-shot examples demonstrating varied document structures are effective at reducing empty and hallucinated extractions: they show the model where the value can live. Making the field required (a) increases fabrication. More instruction text (b) hasn't worked so far and still can't anticipate every layout. Identical retries (c) repeat the same miss.
Keep going
More Prompt Engineering & Structured Output questions
- A pipeline prompts Claude to "reply only with a JSON object," but roughly 5% of…
- A ticket classifier uses a closed enum of five categories. New kinds of tickets, such as…
- An intake pipeline has three extraction tools (invoice, receipt, contract) and doesn't…
- A pipeline must run extract_metadata on each document before any enrichment tool…
- An invoice extraction pipeline retries failed validations by sending the document, the…