OCR V3
OCR V3 is RAGA's PDF-to-Markdown OCR service, built on Python + FastAPI. It accepts a PDF file (upload or URL) and proxies the actual OCR work to an external engine (cloud or local) — the service no longer runs an OCR engine itself. Once the OCR result comes back, the service takes over storing the source PDF in MinIO, indexing the extracted text in Elasticsearch, and automatically triggering Summarize. It's used by API Tarantula to process documents uploaded by users.
Unlike other synchronous services, OCR V3 uses an in-memory queue with a single worker thread — large/slow OCR requests are processed in the background under a task_id, without blocking subsequent requests.
Tech Stack
| Component | Technology |
|---|---|
| Runtime | Python 3.10/3.11 |
| Framework | FastAPI + uvicorn |
| OCR Processing | Proxied to an external OCR engine (cloud/local) over HTTP |
| Object Storage | MinIO |
| Search / Index | Elasticsearch |
| Summarize Integration | HTTP client to an external Summarize service |
| Secret Management | infisical_sdk (Python) |
Full environment variable, endpoint, and pipeline diagram details are on the Technical page.
How It Works
- The client (API Tarantula) sends
POST /api/v1/pdfs— the PDF file/URL is placed on an in-memory queue, and the service immediately replies with atask_id(statuspending). - A single worker thread pulls tasks off the queue serially, then proxies the file/URL to an external OCR engine (
CLOUD_PROCESSING_ENDPOINTorLOCAL_PROCESSING_ENDPOINT, depending on theprocessingparameter), polling the upstream task's status until it finishes. - Once the OCR result (
content_list+md_content_list) is downloaded, the source PDF (if it came from an upload/merge) is uploaded to MinIO, and the extracted text is indexed into Elasticsearch in chunks (5 pages per chunk). - Summarize is triggered automatically in the background against the OCR result — the summary and per-chunk summaries are saved back into Elasticsearch, without blocking completion of the OCR task.
- The client polls
GET /api/v1/tasks/{task_id}/statusto track progress, then retrieves the result viaGET /api/v1/pdfs/{id}.
OCR Modes
Mode (type_ocr) | Description |
|---|---|
ekstrak_only (default) | Text extraction only, no image analysis |
representasi | Text + image descriptions, image count capped by representasi_count |
This mode is only forwarded as a parameter to the external OCR engine — the actual OCR logic runs on that engine, not inside OCR V3.
Summary
OCR V3 now acts as an orchestration layer: it proxies PDF processing to an external OCR engine (cloud/local), then handles storage (MinIO), indexing (Elasticsearch), and automatic document summarization (Summarize). Built for heavy workloads via a single-worker, in-memory queue model — clients don't wait for the request to finish synchronously; they poll status via task_id until the result is ready.