Overview
Extract entities and relations from documents using LLM-based extraction. Processes documents in a directory, chunks them, and uses configured LLM to identify entities and relationships.Usage
Arguments
string
required
Directory containing documents to process. Must be a valid directory path.
Options
Model & Domain
string
LLM model to use for extraction (e.g.,
openai/gpt-4o-mini, anthropic/claude-3-5-sonnet-20241022). Overrides default from config.string
Path to custom domain YAML file defining entity and relation types.
string
default:"schema-free"
Bundled domain name to use (e.g.,
general, osint, academic). Use -d as shorthand.Performance & Cost
integer
default:"10000"
Characters per chunk. Larger chunks = fewer API calls and lower cost, but may reduce extraction quality for very large documents.
integer
default:"4"
Concurrent LLM calls per document. Use
-c as shorthand. Higher values speed up processing but may hit rate limits.integer
default:"40"
Maximum requests per minute to prevent rate limit waste and throttle API calls.
float
Maximum cost budget in USD. Extraction stops when this limit is reached.
Extraction Settings
boolean
default:"false"
Re-extract all documents, ignoring cached results. Use
-f as shorthand.string
Extraction backend to use.
kreuzberg supports 75+ formats, pdfplumber is PDF-only.boolean
default:"false"
Enable OCR for scanned documents and images.
string
OCR backend to use.
gcv = Google Cloud Vision (requires API key).string
OCR language code in ISO 639-3 format (e.g.,
eng for English, fra for French, deu for German).Output
string
Output directory for extraction results. Use
-o as shorthand. Defaults to value in config.boolean
default:"false"
Enable verbose logging with debug-level output. Use
-v as shorthand.Output
Extraction results are saved to{output_dir}/extractions/ with one JSON file per document.
In schema-free mode, discovered entity and relation types are saved to {output_dir}/discovered_domain.yaml.
Examples
Basic extraction
./documents using default settings.
With custom domain
With OCR for scanned documents
Cost-limited extraction
High-performance extraction
Output Summary
After completion, displays:- Documents processed
- Total entities extracted
- Total relations extracted
- Total cost in USD
- Output location