Optional config: Partial<VisionPipelineConfig>Optional partial configuration. Fields that are set override auto-detected values. Fields that are omitted are filled by the auto-detection logic.
A configured and ready-to-use VisionPipeline instance.
// Full auto-detection
const pipeline = await createVisionPipeline();
// Override strategy but auto-detect everything else
const localOnly = await createVisionPipeline({
strategy: 'local-only',
});
// Explicit full config (no auto-detection)
const explicit = await createVisionPipeline({
strategy: 'progressive',
ocr: 'tesseract',
handwriting: true,
documentAI: false,
embedding: true,
cloudProvider: 'openai',
cloudModel: 'gpt-4o',
confidenceThreshold: 0.85,
});
Create a vision pipeline with sensible defaults by auto-detecting which providers are installed in the current environment.
The factory probes for optional peer dependencies (ppu-paddle-ocr, tesseract.js, @huggingface/transformers) and cloud API keys in environment variables, then configures the pipeline accordingly.
Auto-detection logic
ppu-paddle-ocrimportableocr: 'paddle'tesseract.jsimportable (paddle missing)ocr: 'tesseract'ocr: 'none'@huggingface/transformersimportablehandwriting: true,documentAI: true,embedding: trueOPENAI_API_KEY/ANTHROPIC_API_KEY/ etc. setcloudProviderconfiguredCaller-supplied config overrides always take precedence over auto-detected values.