Skip to main content
ExuluDocumentProcessor converts documents to structured markdown for ingestion into knowledge contexts. It supports multiple processor backends — docling (Python, best for complex PDFs), liteparse (JS, broad format support), mistral (OCR via LiteLLM proxy), and officeparser (JS, Office formats) — and optionally validates and corrects each page using a VLM pass. The advanced-document-processing EE entitlement is checked at runtime; calling process without a valid license throws immediately.

API surface

ExuluDocumentProcessor.process

Processes a document and returns an array of per-page objects with the extracted markdown content.
file
string | Buffer
required
The document to process. Pass a local file path, an HTTP/HTTPS URL (downloaded automatically), or a Buffer with the raw file bytes.
name
string
required
The file name including extension (e.g. "report.pdf"). The extension determines which code path handles the file; it is required even when file is a Buffer.
config.processor.name
"docling" | "liteparse" | "mistral" | "officeparser"
required
The processing backend to use.
config.processor.model
string
LiteLLM model_name for the "mistral" OCR backend. Defaults to "mistral-ocr".
config.processor.maxPagesPerChunk
number
Maximum pages per OCR request for the "mistral" backend. Defaults to 25 (safely below the 30-page Vertex AI limit). The PDF is split into chunks of this size before sending.
config.vlm.model
string
LiteLLM model_name for the optional VLM validation pass (e.g. "vertex-gemini-2.5-flash"). Only supported when processor.name is "docling". When set, pages containing tables or images are re-validated and corrected by the VLM.
config.vlm.concurrency
number
Number of pages to validate in parallel. Required when vlm.model is set.
config.attribution
object
Optional cost-attribution fields (user, role, project, agent, routine, context) forwarded to LiteLLM as spend tags for both OCR and VLM passes.
config.debugging.deleteTempFiles
boolean
Set to false to keep the per-job temp directory on disk after processing. Defaults to true.
return
Promise<ProcessedDocument | undefined>
ProcessedDocument is Array<{ page: number; content: string }>. Each element is one page of the document, with final content (VLM-corrected when applicable).

Supported file types by processor

Example

Notes

  • The docling backend runs Python and sets up a virtual environment automatically on first use via ExuluPython.setup. Python 3.10+ is required.
  • Pages are separated by <!-- END_OF_PAGE --> comments in the markdown stream written to disk, but the returned ProcessedDocument array already splits them per page.
  • Temporary files are created under <cwd>/temp/<uuid>/ and deleted after each call unless debugging.deleteTempFiles is false.