key-information-extraction
Published
Public
in @structured-extraction

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.

key-information-extraction

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.

Entrypoints

EntrypointRendersInputs
systemPromptInstructions + your field definitions + embedded schemafields
userPromptThe delimited text to extract fromtext

Variables

  • 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.

Output

{
  "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).
  • Results are returned in request order, one object per field, with name echoed verbatim — so you can zip them straight back to your request.
  • Absent fieldsvalue: null, found: false. The prompt is explicitly told never to guess.

Note on typing

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).

House conventions

  • Triple-mustache for text and field name/description.
  • No hallucinated valuesnull + found: false for anything not in the text.
  • Strict schemaadditionalProperties: false throughout.

Notes

Verified by local render with a sample field set. Suggested default claude-sonnet-4-6 at temperature: 0.

@sufleur/