For the complete documentation index, see llms.txt. This page is also available as Markdown.

Structured outputs and templates

Structured outputs give model responses a defined set of fields. Templates combine those fields with fixed text. Use these features when later steps need predictable data or a consistent presentation.

Connect the processing steps

Connect the input, model, and output, then describe the information the model must extract.

Input, model, and output extraction path

Separate the extraction rules from the way you eventually want to display the result.

Understand the field types

A structured response is like a row with named columns. A string is text, a number is numeric data, a boolean is true or false, and an array is a list. A JSON Schema describes the allowed fields and types; it is not the answer itself.

Start with First input to output workflow if you do not yet have a connected input, model, and output. Choose a model that supports JSON Schema; the available answer formats depend on the model.

Define the response fields

In the model's Settings, set Answer Format to JSON Schema.

JSON Schema answer format setting

Use a schema when later steps need specific field names and types.

Define the fields, their data types, and which fields are required.

Schema fields, types, and required properties

Use allowed values and additional-property rules when you need to constrain the response further.

Start with a small schema

Use two fields for an initial extraction task: summary as text and amount as a number. In the schema editor, this is:

For the first check, supply text that contains one explicit amount. Tell the model to return a brief summary and that exact amount. An amount written as 12 is a number; "12" is text. Decide how your real task should handle a missing amount before using this required-field schema more broadly. A required field does not justify inventing a value.

Then use Map variables and expressions to select summary or amount from the actual model result.

Review the structured result

Run the workflow and inspect the structured output.

Structured model output

Confirm that the keys, types, and values match the schema before using them in later steps.

Format the result with a template

Add a Template to present individual fields in readable form.

Template containing live field references

Insert field references with the picker and expression editor so each value updates on the next run.

Run the formatted path and inspect Template and Output.

Formatted Template and Output results

The template controls presentation while the schema defines the structure produced by the model.

Important behavior

Use Text for a normal written answer, JSON Object for a JSON response, or JSON Schema for defined fields and types.

A template changes how values are displayed. It does not correct inaccurate source values.

Last updated

Was this helpful?