Skip to main content

createImageDocumentParser

@forge/monorepo


@forge/monorepo / backend/src / createImageDocumentParser

Function: createImageDocumentParser()

createImageDocumentParser(deps): DocumentParser

Defined in: backend/src/documents/vision.ts:173

The image parser: OCR when there is text to transcribe, vision to describe, or both.

Both is the useful default for a screenshot. A screenshot of a dashboard has text and a chart, and either alone loses half of it — the numbers without the layout, or the layout without the numbers.

Parameters

deps

ocr?

OcrProvider

onVisionUsage?

(usage) => void

Observed for tests and hosts that want the raw result.

Not the billing path. Billing goes through the returned document's usage, because only the pipeline knows which file a parse belonged to — a callback held by the parser is shared across every file it ever parses, so correlating one would mean trusting that parses never interleave.

vision?

VisionProvider

Returns

DocumentParser