PDF Extractor Docs

System view

Architecture

Components

ComponentResponsibility
BrowserUploads a PDF. Reads status. Shows JSON.
FastAPIValidates requests. Starts external jobs. Provides the public API.
SQLiteStores local job state and final JSON.
LlamaCloudUploads the file and runs extraction.

Upload flow

  1. The browser sends a PDF to POST /api/v1/documents.
  2. FastAPI validates the file.
  3. FastAPI creates a local job with status PENDING.
  4. FastAPI uploads the file to LlamaCloud.
  5. FastAPI creates an extraction job in LlamaCloud.
  6. FastAPI stores the two external IDs.
  7. FastAPI sets the local status to PROCESSING.
  8. FastAPI returns 202 Accepted and the local job ID.

Status flow

  1. The browser reads GET /api/v1/jobs/{job_id}.
  2. FastAPI reads the local job.
  3. FastAPI checks LlamaCloud only when the job is not final.
  4. FastAPI saves the result when LlamaCloud reports completion.
  5. FastAPI returns the local status.

The browser polls every 2.5 seconds. It stops when the job is complete, failed, or cancelled.

Why no worker exists

LlamaCloud already runs the long extraction task. FastAPI only submits the job and reads its state. A Celery worker would add operations work without improving this first version.