When to use it
Use this prompt when you need to turn free text into data: invoices and receipts into accounting rows, job ads into a comparison table, support tickets into categories, or product reviews into ratings and themes. It is designed for workflows where the output is read by code, so consistency matters more than style.
How to customize it
- [SCHEMA] defines exactly which fields you want, their types and formats. A JSON Schema is best; an example object with type hints also works. Keep field names in
snake_caseand descriptive. - [OTHER NORMALIZATION RULES] covers your conventions, such as country codes, units or category lists (“category must be one of: billing, shipping, technical, other”).
- [RECORD TYPE] tells the model what counts as one record when a document contains several.
- [PASTE TEXT] is the source. For scanned documents, run text recognition first or use an assistant that accepts images.
Why it works
The prompt defines the output format strictly and explains how to handle missing data. “Use null, never guess” is the most important rule: extraction tasks tempt models to fill fields with plausible values. The _evidence field is a built-in self-check, because each value must be tied to a quote that you or your code can verify against the source.
The _warnings array gives ambiguity a place to go instead of being resolved silently. The instruction to ignore instructions inside the text is a basic defence against prompt injection, which matters when you process documents from outside your organization.
Tips and variations
- If you call a model through an API, use its structured output or JSON mode feature together with this prompt; our guide on structured outputs and function calling explains how.
- Validate every response against your schema in code and retry or flag failures.
- Add one or two input/output examples for difficult formats; see our few-shot prompting guide.
- Drop the
_evidencefield in production if token cost matters, but keep it while testing. - Spot-check a random sample of extractions by hand before trusting the pipeline.