Generic structured extraction: pull a caller-defined set of named fields out of any messy text — receipts, emails, forms, notes. You describe the fields; it returns each value (canonical string) or null when absent, with no fabrication. See invoice-extraction for a ready-made specialization.
The generic "messy text → the fields you care about" extractor. You describe a set of named fields at call time; the prompt returns each one's value (as a canonical string) or null when it isn't present — no fabrication.
Reach for this when your target shape is ad-hoc or caller-defined. When the shape is fixed and known (e.g. invoices), prefer a specialization like invoice-extraction that bakes the schema in for richer typing.
| Entrypoint | Renders | Inputs |
|---|---|---|
systemPrompt | Instructions + your field definitions + embedded schema | fields |
userPrompt | The delimited text to extract from | text |
fields (array, required) — the fields to extract. Each item is { name, description }:
name — machine-readable field key, e.g. order_total.description — what to pull and the expected format, e.g. "The grand total as a decimal number". The description does the heavy lifting; be specific about format.text (string, required) — the unstructured text to extract from.{
"reasoning": "Found the order number and total; no ship date was mentioned.",
"fields": [
{ "name": "order_number", "value": "A-10293", "found": true },
{ "name": "order_total", "value": "149.99", "found": true },
{ "name": "ship_date", "value": null, "found": false }
]
}
reasoning is emitted first (house convention).name echoed verbatim — so you can zip them straight back to your request.value: null, found: false. The prompt is explicitly told never to guess.Every value is a string or null — the lowest-common-denominator across arbitrary fields. Parse/coerce to numbers, dates, etc. in your own code based on each field's description. If you want strongly-typed output, author a specialization with a concrete output schema (see invoice-extraction).
text and field name/description.null + found: false for anything not in the text.additionalProperties: false throughout.Verified by local render with a sample field set. Suggested default claude-sonnet-4-6 at temperature: 0.