Output Parser¶
The Output Parser sub-component transforms raw LLM text output into structured data. It supports JSON extraction, regex matching, and list parsing, making it essential for nodes that need to produce machine-readable outputs from natural language responses.
| Property | Value |
|---|---|
| Component Type | output_parser |
| Category | Sub-component |
| Display Name | Output Parser |
| Executable | No (configuration only) |
Ports¶
Inputs¶
| Port | Data Type | Required | Description |
|---|---|---|---|
text | STRING | No | Raw text to parse (typically from an AI node's LLM response) |
Outputs¶
| Port | Data Type | Description |
|---|---|---|
parsed | OBJECT | Structured data extracted from the raw text |
Configuration¶
The Output Parser component accepts the following configuration in extra_config:
| Field | Type | Default | Description |
|---|---|---|---|
parser_type | string | json | Parsing strategy: json, regex, or list |
source_node | string | -- | Node ID to read raw text from (optional) |
pattern | string | -- | Regex pattern (required when parser_type is regex) |
Parser types¶
JSON parser (json)¶
Extracts JSON from the LLM response. Handles two formats:
- Direct JSON -- the entire response is valid JSON
- Markdown code blocks -- JSON wrapped in
```json ... ```fences
If neither format is found, the raw text is returned as-is.
Regex parser (regex)¶
Applies the configured pattern as a Python regular expression to the text and returns all matches via re.findall(). If no matches are found, the raw text is returned.
List parser (list)¶
Splits the text by newlines and strips common list prefixes (bullets, numbers, dashes). Each non-empty line becomes an element in the output array.
Input:
Output:
Usage¶
- Add an Output Parser node from the Node Palette (Sub-components category)
- Configure the
parser_typeand any parser-specific settings in Extra Config - Connect the Output Parser to an AI node via the slate diamond output_parser handle
Source resolution¶
The Output Parser reads its input text in this order:
- If
source_nodeis set, reads that node's output fromstate.node_outputs - Otherwise, reads the last message's content from the
messageslist in state
Compatible AI nodes¶
The Output Parser connects to these AI node types:
| AI Node | Uses Output Parser |
|---|---|
| Categorizer | Parses the LLM response into a category label |
| Router | Parses the LLM response into a route identifier |
| Extractor | Parses the LLM response into structured data |
| Agent | Not supported (agents use tools, not parsers) |
Example¶
A categorizer uses an output parser to extract the category from the LLM's JSON response:
flowchart LR
T[Chat Trigger] --> C[Categorizer]
M[AI Model] -.->|model| C
OP[Output Parser] -.->|output_parser| C
style OP fill:#94a3b8,color:white Output Parser Extra Config:
If the LLM responds with:
The Output Parser produces {"category": "technical_support", "confidence": 0.92} as structured data that the Categorizer can use to set its category output.
Regex example¶
Extract email addresses from LLM output:
Input: "Contact us at support@example.com or sales@example.com"
Output: ["support@example.com", "sales@example.com"]
Graceful fallback
If parsing fails (e.g., invalid JSON, no regex matches), the Output Parser returns the raw text rather than raising an error. This ensures the workflow continues even when the LLM produces unexpected output formats.