How dhruvvv-sh/production-rag-document-assistant works
This repository implements Stage 1 of a PDF document assistant: clients upload PDFs, which are validated, extracted page by page, chunked with page metadata, and stored for later lookup. The API also exposes liveness/readiness checks and document status. Configuration, SQLAlchemy session handling, and ORM models form the supporting persistence layer. The README describes retrieval, reranking, and answer-generation stages as future roadmap items; they are not included as runtime components. Relationships below are based on the sampled source and README.
Main entry points: routes.py Document Routes · ingestion.py Ingestion Service · database.py DB Sessions · main.py FastAPI App
Components 11
HTTP API
- Document Routes
src/app/api/routes.py - Response Schemas
src/app/schemas.py
PDF Ingestion
- Ingestion Service
src/app/services/ingestion.py - PDF Extraction
src/app/services/pdf.py - Token Chunker
src/app/services/chunking.py
Persistence
- DB Sessions
src/app/database.py - Document Models
src/app/models.py - PostgreSQL
Runtime Setup
- FastAPI App
src/app/main.py - Service Settings
src/app/config.py
Other components
- API Client
Connections 15
- API Client → FastAPI App: sends requests
README.md - FastAPI App → Document Routes: registers routes
src/app/main.py - FastAPI App → Service Settings: loads settings
src/app/main.py - Document Routes → Service Settings: reads limits
src/app/api/routes.py - Document Routes → DB Sessions: depends on
src/app/api/routes.py - Document Routes → Ingestion Service: calls ingest
src/app/api/routes.py - Document Routes → Token Chunker: creates chunker
src/app/api/routes.py - Document Routes → Document Models: queries documents
src/app/api/routes.py - Document Routes → Response Schemas: returns responses
src/app/api/routes.py - Ingestion Service → PDF Extraction: extracts pages
src/app/services/ingestion.py - Ingestion Service → Token Chunker: chunks pages
src/app/services/ingestion.py - Ingestion Service → Document Models: creates records
src/app/services/ingestion.py - Document Models → DB Sessions: uses declarative base
src/app/models.py - DB Sessions → Service Settings: gets database URL
src/app/database.py - DB Sessions → PostgreSQL: connects to
README.md