How adilshamim8/production-grade-rag works
This repository contains two RAG implementations: a root-level Streamlit/FastAPI application with optional Inngest orchestration, and a packaged FastAPI service under rag-engine. The main user journey uploads PDFs, chunks and embeds them, stores vectors, retrieves relevant passages, then returns grounded answers with sources. The README also documents multi-provider models, local fallback, diagnostics, and the packaged API/UI. Edges reflect excerpts and README/index references; where packaged internals are unsampled, the graph avoids inferring their call sequence.
Main entry points: main.py FastAPI workflow · app.py API application · rag_chain.py RAG chain · streamlit_app.py Streamlit UI
Components 24
Root application
- Streamlit UI
streamlit_app.py - FastAPI workflow
main.py - Inngest steps
main.py - PDF chunking
data_loader.py - Embedding providers
data_loader.py - Grounded answers
main.py - Qdrant storage
vector_db.py
Packaged API
- Packaged Streamlit UI
rag-engine/src/rag_engine/ui/streamlit_app.py - API application
rag-engine/src/rag_engine/api/app.py - Document routes
rag-engine/src/rag_engine/api/routes/documents.py - Query routes
rag-engine/src/rag_engine/api/routes/query.py - Health routes
rag-engine/src/rag_engine/api/routes/health.py - API schemas
rag-engine/src/rag_engine/models/schemas.py - Error middleware
rag-engine/src/rag_engine/api/middleware/error_handler.py - Request logging
rag-engine/src/rag_engine/api/middleware/logging.py
Packaged RAG core
- Document loading
rag-engine/src/rag_engine/core/document_loader.py - Embedding service
rag-engine/src/rag_engine/core/embeddings.py - RAG chain
rag-engine/src/rag_engine/core/rag_chain.py - Vector store manager
rag-engine/src/rag_engine/core/vector_store.py
Shared platform
- Qdrant service
- Logging utilities
rag-engine/src/rag_engine/utils/logger.py
Other components
- Document user
- Model providers
- Inngest service
Connections 32
- Document user → Streamlit UI: uploads and queries
README.md - Streamlit UI → FastAPI workflow: starts workflow
README.md - Streamlit UI → PDF chunking: local ingestion
streamlit_app.py - Streamlit UI → Qdrant storage: local retrieval
streamlit_app.py - FastAPI workflow → Inngest steps: registers steps
README.md - Inngest steps → Inngest service: dispatches events
README.md - Inngest steps → PDF chunking: loads and chunks
main.py - Inngest steps → Embedding providers: embeds chunks
main.py - Inngest steps → Qdrant storage: upserts vectors
main.py - Inngest steps → Qdrant storage: searches vectors
main.py - FastAPI workflow → PDF chunking: loads and chunks
main.py - FastAPI workflow → Embedding providers: embeds text
main.py - FastAPI workflow → Qdrant storage: upserts and searches
main.py - FastAPI workflow → Grounded answers: generates answer
main.py - FastAPI workflow → Model providers: requests generation
- Embedding providers → Model providers: requests embeddings
- Packaged Streamlit UI → API application: uses service
- API application → Document routes: registers route
rag-engine/src/rag_engine/api/app.py - API application → Query routes: registers route
rag-engine/src/rag_engine/api/app.py - API application → Health routes: registers route
rag-engine/src/rag_engine/api/app.py - Document routes → RAG chain: ingests document
rag-engine/src/rag_engine/api/routes/documents.py - Query routes → RAG chain: runs query
rag-engine/src/rag_engine/api/routes/query.py - Health routes → Vector store manager: checks store
rag-engine/src/rag_engine/api/routes/health.py - Document routes → API schemas: uses request models
rag-engine/src/rag_engine/api/routes/documents.py - Query routes → API schemas: uses query models
rag-engine/src/rag_engine/api/routes/query.py - RAG chain → Document loading: processes documents
- RAG chain → Embedding service: creates embeddings
- RAG chain → Vector store manager: retrieves and indexes
- Vector store manager → Qdrant service: reads and writes
rag-engine/src/rag_engine/core/vector_store.py - API application → Logging utilities: gets logger
rag-engine/src/rag_engine/api/app.py - Request logging → Logging utilities: gets logger
rag-engine/src/rag_engine/api/middleware/logging.py - API application → Error middleware: configures middleware