Skip to main content
The extract node uses AI to extract structured data from documents according to a JSON Schema. It works with both raw documents (via VLM) and parsed DocumentIR (via LLM).

Basic Usage

Configuration Options

Options Reference

Input Mode

The inputMode option controls what input the extract node uses for extraction. This is one of the most important configuration options for optimizing accuracy and cost.

Mode Options

Auto Mode (Default)

Auto mode intelligently selects the best extraction path:
Auto mode decision tree:
  1. If DocumentIR + source available + VLM provider + preferVisual: trueir+source
  2. If only DocumentIR available → ir
  3. If only FlowInput (raw document) + VLM provider → source

IR Mode (Text-Only)

Use parsed text only, ignoring visual context:
Best for:
  • Text-heavy documents (contracts, reports)
  • Cost optimization (LLM is cheaper than VLM)
  • When OCR accuracy is sufficient

IR+Source Mode (Hybrid)

Combine parsed text with visual context for maximum accuracy:
Best for:
  • Complex layouts (tables, forms with checkboxes)
  • Documents with visual elements (signatures, stamps)
  • When highest accuracy is required

Source Mode (Direct VLM)

Skip parsing entirely, extract directly from raw document:
Best for:
  • Simple, well-structured documents
  • When OCR adds no value (clean PDFs)
  • Fastest processing time

Using Original Source in forEach

When processing split documents, use useOriginalSource to reference the full document instead of individual segments:

Input Types

The extract node accepts different input types depending on the configured mode:

Raw Documents (VLM)

Direct extraction from PDFs or images:

Parsed Documents (LLM)

Extract from previously parsed DocumentIR:

Schema Definition

Basic Schema

Schema Registry Reference

Use registered schemas:

Enhanced Schema

Include examples and extraction guidance:

Citation Tracking

Track which parts of the source document contributed to each field:
Output includes citation metadata:

Consensus Voting

Run extraction multiple times and vote on results:
See Consensus Voting for strategies and configuration.

Extended Reasoning

Enable chain-of-thought reasoning for complex extractions:
Extended reasoning improves accuracy for complex documents but increases latency and cost.

Custom Instructions

Add extraction guidance:

Type-Safe Extraction

Use TypeScript generics for typed output:

Error Handling

Extraction may fail if:
  • Document cannot be read
  • Schema cannot be satisfied
  • Provider returns invalid response
Handle errors:

Next Steps

Schemas

Learn about schema definition

Consensus Voting

Improve accuracy with multi-run voting

Citations

Track extraction sources

Providers

Configure LLM/VLM providers