Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.docex.dev/llms.txt

Use this file to discover all available pages before exploring further.

Pipeline

The Docex worker pipeline is model- and task-agnostic. It does not assume “documents.” The only document-specific layer is the optional built-in schema registry, which provides convenience defaults for common extraction tasks.

Stages

1

Upload

The client requests a presigned upload URL via POST /v1/uploads/presign, then uploads the file directly to storage. This keeps large files out of your API request body.
2

Queue

The client submits a run request via POST /v1/runs with the upload ID, prompt, and optional schema or workflow hints. The job is queued for processing.
3

Classify

The worker inspects file metadata (type, dimensions, page count) and classifies the task type. This informs provider selection and cost estimation.
4

Plan

The planner resolves candidate providers per step based on the catalog (catalog.js). It considers capabilities, costs, and auth requirements to build an execution strategy.
5

Execute

The executor runs the strategy. If a provider fails (timeout, rate limit, error), it automatically falls back to the next candidate in the plan.
6

Respond

The worker wraps the result in a standard run envelope with status, result, usage, confidence, and chargedUsd. The client polls GET /v1/runs/:jobId until completion.

Execution strategies

The worker supports multiple strategies depending on the task and file:
StrategyWhen used
Direct multimodalSingle image, vision-capable model can handle it directly
OCR then analyzePDF or image where text extraction improves accuracy
Parser then analyzeStructured documents where a dedicated parser exists
Generic vision summaryOpen-ended analysis where no structured schema is provided

Cost confirmation

Jobs exceeding DOCEX_COST_CONFIRMATION_THRESHOLD_USD (default $1.00) require explicit confirmation via confirmCost: true or a maxCostUsd budget. The estimate is based on file metadata; refunds are issued if actual cost is below the estimate.