Data template
Structured data extraction prompt template
Extract fields from free text into a strict JSON object. Turning semi-structured documents such as invoices, receipts, or forms into records your code can parse without cleanup.
The prompt
prompt.md
## Task
Extract the invoice fields from the document below.
## Requirements
- Use null for any field that is not present; do not infer values.
- Dates must use the YYYY-MM-DD format.
- Amounts must be numbers without currency symbols.
## Output format
Return only valid JSON with the keys invoice_number, issue_date, due_date, vendor_name, total_amount, and currency.
## Input
<document>
{{document}}
</document>Variables
| Variable | What to pass in |
|---|---|
{{document}} | The document text, for example OCR output or text extracted from a PDF. |
Each variable sits inside its own tags so the model treats what you insert as data, not instructions.
How it scores
100/100 with no warnings or critical issues, checked in CI on every change.
| Dimension | Score |
|---|---|
| Clarity | 100 |
| Specificity | 100 |
| Completeness | 100 |
| Structure | n/a |
| Consistency | 100 |
| Output specification | 100 |
| Efficiency | 100 |
| Security | 100 |
Tokens and cost per model
Input tokens for the template itself, before you fill in the variables. Costs use the list prices in the model catalog, each dated with when it was last verified; confirm with your provider.
| Model | Tokens | Input cost / 1,000 calls |
|---|---|---|
| GPT-4.1 | 92 | $0.1840 |
| GPT-4.1 mini | 92 | $0.0368 |
| Claude Sonnet 5.5 | 92 (approx.) | $0.1840 |
| Claude Haiku 4.5 | 92 (approx.) | $0.0920 |
| Gemini 2.5 Flash | 92 (approx.) | $0.0276 |
Adapting it
- List every key your parser expects, and keep the list identical in the output format and your code.
- Keep the "use null" rule: it stops the model from guessing values that are not in the document.
- If your provider supports structured outputs or a JSON schema, pass the schema too; the prompt still documents intent.
After editing, the workspace re-scores the prompt as you type and flags anything that regresses.
More templates
- Pull request review: Structured review of a diff with severity-ranked findings.
- Customer support reply: On-policy reply to a customer ticket with a fixed structure.
- Meeting summary: Decisions, owners, and deadlines from a transcript.
- Ticket classification: Route a message to exactly one category with a confidence.
- Tool-using agent system prompt: Scoped agent with explicit tool rules and a stop condition.