Function: createVisionPipeline()
createVisionPipeline(
config?):Promise<VisionPipeline>
Defined in: packages/agentos/src/core/vision/index.ts:160
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
| Check | Result |
|---|---|
ppu-paddle-ocr importable | ocr: 'paddle' |
tesseract.js importable (paddle missing) | ocr: 'tesseract' |
| Neither importable | ocr: 'none' |
@huggingface/transformers importable | handwriting: true, documentAI: true, embedding: true |
OPENAI_API_KEY / ANTHROPIC_API_KEY / etc. set | cloudProvider configured |
Caller-supplied config overrides always take precedence over auto-detected values.
Parameters
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.
Returns
Promise<VisionPipeline>
A configured and ready-to-use VisionPipeline instance.
Example
// 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,
});