How to Ask AI for Structured Output
A beginner-safe AI workflow for ask ai for structured output, with a copyable prompt, source boundaries, missing-information rules and line-by-line verification.
By the end: You will run a grounded AI task using real source material, verify every consequential claim, and keep a reusable prompt plus human-review process.
You will run a grounded AI task using real source material, verify every consequential claim, and keep a reusable prompt plus human-review process.
Key terms before you start
These definitions make the steps easier to follow and help distinguish controls, files and concepts that can look similar at first.
What you need before starting
- Access to ChatGPT
- The real source material required for the task
- Permission to use that material
- A person who can verify/approve consequential facts
Step-by-step tutorial
Every step is shown below. Work through them in order and use each checkpoint to confirm the result before moving on.
Open a new ChatGPT conversation
Start a new chat so unrelated earlier instructions do not accidentally shape the workflow.
A clean conversation makes the task/source boundary easier to audit.
Treat the claim as unsupported; open the source yourself and correct/remove it.
Collect the authoritative input first
Prepare the real one or more real sample invoices/documents you are allowed to use.
Do not ask the model to reconstruct private/current facts that should come from a document, database or person.
Strengthen the source-only/missing-information rule, delete unsupported content, and verify the revised output. Do not keep a plausible guess.
Define the output format
Ask for JSON with exact named fields and specify headings/fields/order.
A defined structure makes comparison/review easier.
Restate the exact schema/headings and show a tiny structural example without adding fake factual values.
Check every number and date
Compare numbers, dates, prices, percentages and deadlines back to the source one by one.
These details are easy to alter accidentally and often consequential.
Treat the claim as unsupported; open the source yourself and correct/remove it.
Check every proper name and product/service name
Compare spelling and identity with the source.
A plausible wrong name is still wrong.
Strengthen the source-only/missing-information rule, delete unsupported content, and verify the revised output. Do not keep a plausible guess.
Define the schema before extraction
Write the exact field names/types/null behavior your downstream process expects.
Changing keys later can break imports.
Restate the exact schema/headings and show a tiny structural example without adding fake factual values.
Validate JSON syntax separately
Paste the returned JSON into a JSON validator/parser or your application test.
Readable text is not necessarily valid machine-readable JSON.
Test an invoice with a missing field
Use a sample that genuinely lacks tax/subtotal/etc.
This verifies the model uses null rather than inventing/calculating.
Strengthen the source-only/missing-information rule, delete unsupported content, and verify the revised output. Do not keep a plausible guess.
Record reusable prompt only after it works
Save the prompt template plus required inputs and review checks.
A repeatable workflow includes validation, not just reusable wording.
Re-run the same verification after every material revision. Human review is not a one-time step.
Re-test when source/model/process changes
If the input format, policy, model or business process changes, run validation examples again.
A workflow proven on one version is not permanently proven.
Strengthen the source-only/missing-information rule, delete unsupported content, and verify the revised output. Do not keep a plausible guess.
If a factual sentence cannot be traced to the allowed source, remove it or mark the information missing.
Concrete examples
Copyable example
Extract these fields from each invoice:
- invoice_number
- invoice_date
- supplier
- currency
- subtotal
- tax
- total
Return JSON only.
Use null when a field is absent.
Do not calculate a missing subtotal or tax.
Do not add commentary.
SOURCE:
[attach/paste invoice text]Troubleshooting
Strengthen the source-only/missing-information rule, delete unsupported content, and verify the revised output. Do not keep a plausible guess.
Restate the exact schema/headings and show a tiny structural example without adding fake factual values.
Treat the claim as unsupported; open the source yourself and correct/remove it.
Re-run the same verification after every material revision. Human review is not a one-time step.
The process remains current.
How the topic comes up in practice
Short excerpts from public discussions that directly relate to the task. Use the source link for the complete context.
“Instead of one massive prompt, I split the task into two specialized roles.”
structured extraction ↗
Continue with these tutorials
Documentation and references
Use these primary and supporting sources to verify current controls, browser behavior and product-specific details.