GoodPrompts
Main navigation
Task tutorials

Structured data extraction

Extract records with an explicit schema, missing-value policy and validation.

Sources checked

How to use it

  1. Define field names, types, allowed categories and missing-value rules. Provide records with source identifiers so extracted values can be traced back.
  2. Use schema-constrained output when supported by the chosen API. In a chat interface, show the intended shape and validate the returned text with a parser yourself.
  3. Check syntax, schema and factual support separately. Plan for refusals, truncation and invalid responses instead of sending unchecked data to downstream systems.

Prompt template

Extract {{fields}} from {{records}} using {{schema}}. Use only explicit source evidence. Use null for absent values, preserve original units and dates, and do not infer missing identifiers. Include the source record for each result. Return data matching the schema; handle unsupported or contradictory values according to {{rules}}.

Check the result

  • Parse the response and validate required fields, enums, types and extra-property rules.
  • Check a sample of values against the original text; schema validity does not imply factual correctness.

Common mistakes

  • Asking for JSON in prose does not activate a provider's schema enforcement feature.

Sources