Skip to content
For LLMsView as Markdown·

Structured Output

Sends data to an LLM and forces the response into a JSON object matching a schema you define (property → type). The result is validated against that schema before it flows downstream, so nodes after it can rely on the shape.

When to use

  • Pull a fixed set of fields out of unstructured text — e.g. extract { first_name, last_name, dob, doc_number } from a KYC submission.
  • Any time you want the AI's answer as predictable JSON rather than free text, and you want a validation signal you can branch on.

For free-form text (summaries, rewrites) use AI Transform. For picking one of several categories use AI Classify.

Configuration

FieldRequiredWhat it does
instructionYesWhat to produce. Supports {{...}} refs.
inputFieldNoThe data to work on. Blank = the upstream node's output.
schemaYesThe target shape as a property → type map. Types: string, number, boolean, object, array, any.
providerNogroq (default), gemini, or openrouter.
modelNoProvider model ID. Default llama-3.3-70b-versatile.

Example schema

json
{
  "first_name": "string",
  "last_name": "string",
  "date_of_birth": "string",
  "document_number": "string",
  "verified": "boolean"
}

What it outputs

{
  result: { first_name: "…", last_name: "…", verified: true },  // the parsed object
  valid: true,          // did it match the schema?
  errors: [],           // list of mismatches when valid = false
  model: "llama-3.3-70b-versatile",
  provider: "groq"
}

Downstream nodes reference {{structured_output.data.result.first_name}}. Branch on {{structured_output.data.valid}} with an If / Else to handle the case where the model couldn't produce a conforming object.

Gotchas

  • Validation is shape + type, not business rules. valid: true means every declared property is present with the right JSON type — it does not check that a date is real or an amount is positive. Add downstream checks for that.
  • Keep the schema flat where you can. Deeply nested schemas are harder for the model to satisfy reliably.
  • Non-determinism still applies — the values can vary run to run even though the shape is fixed.