The short version
- Business systems need structured data, such as named fields, not free text.
- Ask for a fixed format, give a schema, and mark clearly where your data starts and ends.
- Check every output with code before a system uses it. Reject and retry what does not fit.
The idea
When a model’s output feeds another program, the format must be exact. Four practices make that reliable.
Delimiters. Mark the parts of the prompt with clear tags, so the model can tell your instructions from the document it should process.
Output schema. Describe the exact fields, their types and allowed values. The common format is JSON, a simple way to write named fields that every system can read. Most providers now offer a structured output mode that forces the answer to match your schema.
Clear limits. State numbers: “at most three items”, “a date in the form YYYY-MM-DD”.
Positive instructions. Say what to do. “Return null when the field is missing” works better than “do not guess”.
Think of a paper form. A blank page invites an essay. A form with labelled boxes gets the facts you need in the place you expect them.
- Document
- Prompt with schema
- Model returns fields
- Code checks the fields
- System uses them
Validation is the last and most important step. Code checks that every required field is present and well formed. If not, the system retries or sends the case to a person.
An example
An order desk receives purchase orders as PDF attachments. The prompt asks for seven fields: customer number, order number, part number, quantity, unit, requested date and ship-to address. The schema says quantity must be a whole number and the date must use one format. Code checks each answer and confirms that the part number exists in the catalogue. Orders that pass go straight into the order system. Orders that fail go to a person with the problem field marked.
Common mistakes
- Parsing free text with fragile pattern matching.
- No rule for missing values, so the model fills the gap with a guess.
- Trusting the format and never checking the content.
- Schemas with vague field names that the model must interpret.
What to do this week
- Find one place where staff copy data from documents into a system.
- Write the schema: field names, types and allowed values.
- Test on 30 documents and count how many pass validation with no human fix.
The terms, in plain language
| Term | What it means |
|---|---|
| Structured output | An answer in a fixed format that a program can read |
| JSON | A common text format for named fields and values |
| Schema | The definition of the fields and their allowed values |
| Delimiter | A marker that separates parts of a prompt |
| Validation | Code that checks the output before it is used |
Further reading
Section 2.4 of the AI Engineering Guide · Last reviewed November 2026




