docs/content/Guides/ocr.mdx
import { Callout } from 'nextra/components'
DocsGPT uses Docling as the default parser layer for many document formats. OCR is optional and controlled by two settings:
DOCLING_OCR_ENABLED=false
DOCLING_OCR_ATTACHMENTS_ENABLED=false
DOCLING_OCR_ENABLED: OCR behavior for Source Docs ingestion.DOCLING_OCR_ATTACHMENTS_ENABLED: OCR behavior for chat attachments uploaded from the message box./api/upload.ingest_worker).SimpleDirectoryReader parses files with get_default_file_extractor.DOCLING_OCR_ENABLED./api/store_attachment.attachment_worker parses and stores the attachment in Postgres (attachments table).DOCLING_OCR_ATTACHMENTS_ENABLED.Docling OCR behavior is different for PDFs vs images:
By default, Docling parser classes use RapidOCR options (language default: english).
Docling runs its layout, table, and OCR models through torch.compile by
default. DocsGPT turns that off. On x86-64 Linux, compiling raised the first
parse of a two-page PDF from 8.4s to 58.6s while steady-state parsing stayed
at 1.5s either way, so the warmup is overhead a per-file parse never recovers.
Compiling also fails outright on Apple Silicon, on install paths containing a
space, on Windows without MSVC, and in slim images with no C compiler.
DOCLING_COMPILE_TORCH_MODELS=false
Set it to true only if you are parsing large batches on a machine where the
warmup pays for itself.
When attachments are used in chat, behavior depends on the selected model/provider:
This means OCR quality is especially important for text fallback paths and for models without native attachment support.
For most OCR-enabled use cases, enable both flags:
DOCLING_OCR_ENABLED=true
DOCLING_OCR_ATTACHMENTS_ENABLED=true
After changing these settings, restart the API and Celery worker.
PARSE_IMAGE_REMOTE=true.