Extract Data From Text with AI
Free text in, named fields out. The extraction prompt pattern that turns any unstructured text into consistent, parseable records.
Invoice number, vendor, dates, total, currency — extracted into clean fields with strict no-inference rules, ready for accounts payable.
Invoices are semi-structured: values follow printed labels, but layouts vary by vendor. Reliable invoice extraction pins the fields (invoice_number, vendor, issue_date, due_date, total_amount, currency), gives each its own rule — identifiers exactly as written, dates in ISO format, totals as bare numbers with the currency in its own field — and runs strict: an invoice is the wrong place for a model's best guess. This resource loads the full accounts-payable setup with null for missing values, so downstream code sees stable keys.
Generate and paste above the invoice text
The prompt reads the invoice from the input — paste OCR text or the email body below it.
Trust the per-field rules
total_amount comes back as a bare number, currency as an ISO code, invoice_number untouched — each field has its own rule.
Keep strict ambiguity for finance
A missing due date returns null; it is never inferred from "net 30 is typical". Wrong data costs more than no data here.
It returns six fields as a single JSON object: invoice_number, vendor, issue_date, due_date, total_amount, and currency. Each has its own rule — the invoice number is kept exactly as written, dates come back in ISO YYYY-MM-DD, the total is a bare number with no symbols or thousands separators, and the currency sits in its own field as an ISO code like USD.
Paste the invoice text — OCR output or the email body — directly below the prompt; it reads the invoice from the input. You don't reformat anything first: the prompt's reading guidance knows values follow printed labels like "Invoice #" and "Total Due," and that the grand total is the final amount after tax. One invoice per run keeps the fields clean.
No — it pulls only what is explicitly printed in the source and never infers, so accuracy depends on the invoice being legible and its labels clear. Anything not found comes back as null rather than a guess, which makes gaps loud instead of silent. Run it in your own AI tool and reconcile the fields against the invoice before they reach accounts payable.
Not line items — this setup extracts the header fields; for a full line-item table, run a second pass focused on the rows. To capture different fields, regenerate the prompt in the Extraction Prompt Generator with your own field list and per-field rules. Deciding whether a document even is an invoice is a separate classification job, not this extraction.
Free text in, named fields out. The extraction prompt pattern that turns any unstructured text into consistent, parseable records.
The most consequential setting in any extraction prompt: what the model does when the field isn't in the text. Four behaviors, and when each is right.
Parties, effective date, term, payment, termination notice, governing law — key terms into a contract register, with "unknown" marking every gap loudly.
Stop getting 'Sure, here is the JSON…' — the output-contract pattern that forces models to return only parseable JSON: schema, example, and a strict rule block.
Billing, Technical, Account, How-To, Feature Request — ticket triage with definitions that decide the borderline cases for the model.
The JSON won't parse and you can't see why. Deterministic cause-sniffing — trailing commas, single quotes, unclosed brackets — and the repair prompt that fixes it.
Build prompts that extract defined fields from unstructured text — emails, invoices, tickets, résumés.