How ishanth777/production-grade-rag-application works
DocuMind answers questions over uploaded PDFs through a FastAPI interface or interactive CLI. Its main workflow checks cached responses, applies input safety checks, retrieves Qdrant context, validates that context, generates an answer through a provider-fallback gateway, sanitizes the output, and caches the result. A separate document-management workflow loads PDFs, chunks them, and indexes them. The README describes Redis and Logfire capabilities; the sampled cache implementation is in-memory, and the source excerpts do not establish a Redis connection. Some optional integrations are therefore shown as unverified.
Main entry points: app.py FastAPI App · search.py RAG Search · vector_store.py Vector Store · llm_gateway.py LLM Gateway
Components 19
User Interfaces
- FastAPI App
app.py - Web UI
templates/index.html - Interactive CLI
cli.py
RAG Answering
- RAG Search
src/search.py - Safety Guardrails
src/guardrails.py - LLM Gateway
src/llm_gateway.py - Offline Fallback
src/llm_gateway.py
Document Indexing
- PDF Loader
src/data_loader.py - Chunking Pipeline
src/embeddings.py - Vector Store
src/vector_store.py - PDF Documents
data
State & Observability
- Response Cache
src/cache.py - Tracing
src/observability.py
Other components
- User
- Groq
- OpenAI
- Qdrant
- Redis
- Logfire
Connections 23
- User → FastAPI App: submits requests
app.py - FastAPI App → Web UI: renders
app.py - FastAPI App → RAG Search: runs search
app.py - User → Interactive CLI: enters queries
cli.py - Interactive CLI → RAG Search: runs search
cli.py - RAG Search → Response Cache: checks and stores
src/search.py - RAG Search → Safety Guardrails: checks query, context, answer
src/search.py - RAG Search → Vector Store: retrieves context
src/search.py - RAG Search → LLM Gateway: requests generation
src/search.py - LLM Gateway → Groq: tries primary
README.md - LLM Gateway → OpenAI: falls back
README.md - LLM Gateway → Offline Fallback: falls back
src/llm_gateway.py - FastAPI App → PDF Loader: loads PDFs
app.py - FastAPI App → Chunking Pipeline: chunks documents
app.py - FastAPI App → Vector Store: indexes chunks
app.py - PDF Loader → PDF Documents: reads
src/data_loader.py - Vector Store → Qdrant: stores and searches
src/vector_store.py - Vector Store → PDF Loader: loads on missing index
src/vector_store.py - Vector Store → Chunking Pipeline: chunks on missing index
src/vector_store.py - FastAPI App → Tracing: initializes tracing
app.py - RAG Search → Tracing: creates spans
src/search.py - Tracing → Logfire: exports traces
src/observability.py - Response Cache → Redis: optional backend