Skip to content

Prompt with structured output

Instruct a language model to return structured data directly in table columns instead of free-form text.

When this is useful

Structured output is useful when model responses need to be parsed, validated, or processed automatically into KNIME workflows.

Use structured output when you want to:

  • Extract structured information from text into predefined columns
  • Define the exact output schema the model should follow
  • Reliably integrate LLM output into automated or rule-based workflows
  • Extract one or multiple items from each input row

If you only need free-form text output, use a simple prompt instead.

Build a prompt with structured output

Prerequisites

Before you start, make sure that you have:

To prompt a model for structured output, follow these steps:

  1. Configure the LLM Prompter output format
  2. Define the output structure
  3. Configure output columns

1. Configure the LLM Prompter output format

Use the LLM Prompter node and configure it as follows:

  • Provide the input text column containing the prompt
  • Set Output format to Structured

This makes structured output configuration options available.

2. Define the output structure

In the Output Structure section, configure:

  • Target object name: A descriptive name for the items being extracted (e.g., "Actionable tasks", "Product features")
  • Target object description: Describe what should be extracted from the input text (e.g., "Tasks mentioned in the meeting that should be added to the board")
  • Target objects per input row: Determines how many items are extracted for each input row
    • Single: Extract exactly one item with the defined columns per input row
    • Multiple: Allow the model to extract one or more items with the defined structure per input row. The input columns will be duplicated for each extracted item.

3. Configure output columns

Define the columns that will contain the extracted data. For each column, specify:

  • Column name: The name of the output column
  • Data type: The data type (String, Integer, etc.)
  • Quantity: Whether the field is single-valued or can contain multiple values as a list
  • Description: Describe what this field should contain, including any constraints or allowed values

The model will return data structured according to these column definitions.

Example

See structured output in action with this complete example on KNIME Hub:

JSON

Some providers like OpenAI also support JSON as an output format. Check out this example on the Hub: Extract structured data from text.

Next steps

Follow this tutorial to learn how you can extract structured data with a local model using Ollama: