Production-grade Retrieval-Augmented Generation (RAG) system designed for enterprise-scale document ingestion, semantic search, and LLM-powered question answering.
This project focuses on scalability, modularity, system design, observability, and evaluation β not demo-level RAG pipelines.
- Modular end-to-end RAG architecture
- Multi-format document ingestion (TXT, PDF, DOCX)
- Incremental knowledge base updates (no re-embedding unchanged data)
- Persistent FAISS vector store
- Hash-based embedding cache
- Observability-first UI (latency, retrieved chunks, confidence)
- Explicit evaluation layer (Recall@K, latency)
- Dockerized & Cloud Runβready
- GCP Secret Manager integration
- Designed with enterprise document systems in mind
The application is deployed on Google Cloud Run and is publicly accessible.
π Live URL:
https://scalable-enterprise-rag-761523979642.asia-south1.run.app
- Hosted on Google Cloud Run
- Container image stored in Artifact Registry
- HTTPS enabled by default
- Autoscaling based on traffic
- Secrets securely injected via GCP Secret Manager
This deployment closely mirrors how production-grade GenAI / RAG services are deployed in real enterprise environments.
The system supports multi-format enterprise document ingestion:
- β TXT β Plain text files
- β
PDF β Extracted using
pypdf - β
DOCX β Extracted using
python-docx
Documents are routed to loaders using a factory-based ingestion layer, making it trivial to add support for formats like HTML, Markdown, or PPTX.
This system implements a production-grade knowledge base lifecycle.
- Each document receives a stable, deterministic document ID
- Content hashes tracked via
kb_state.json - Only new or modified documents are chunked and embedded
- FAISS index and metadata are persisted
- Restarting the service does not rebuild embeddings
- The knowledge base grows incrementally over time
- If documents are already ingested, the system reuses the existing FAISS index
- The RAG pipeline auto-initializes from persisted state
- This avoids unnecessary compute cost and LLM calls
The Streamlit UI exposes internal system behavior:
- β± Retrieval latency (ms)
- π¦ Number of retrieved chunks
- π’ Confidence indicator (heuristic)
- π Exact retrieved contexts used by the LLM
This mirrors internal enterprise RAG tools used at large tech companies β not black-box demos.
ββββββββββββββββ
β Raw Documentsβ
ββββββββ¬ββββββββ
β
βΌ
ββββββββββββββββ
β Ingestion β β loaders.py, cleaner.py
ββββββββ¬ββββββββ
β
βΌ
ββββββββββββββββ
β Chunking β β strategies.py
ββββββββ¬ββββββββ
β
βΌ
ββββββββββββββββ
β Embeddings β β GeminiEmbedder + cache
ββββββββ¬ββββββββ
β
βΌ
ββββββββββββββββ
β Vector Store β β FAISS (persistent)
ββββββββ¬ββββββββ
β
βΌ
ββββββββββββββββ
β Retrieval β β Top-K semantic search
ββββββββ¬ββββββββ
β
βΌ
ββββββββββββββββ
β LLM Response β β Gemini (grounded)
ββββββββββββββββ
scalable-enterprise-rag/
β
βββ app/
β βββ ui.py # Streamlit UI (ingestion, QA, observability)
β
βββ ingestion/
β βββ base.py # BaseLoader abstraction
β βββ loaders.py # Loader factory (TXT / PDF / DOCX)
β βββ pdf_loader.py
β βββ docx_loader.py
β βββ cleaner.py
β
βββ chunking/
β βββ strategies.py # Fixed-size chunking with overlap
β
βββ embeddings/
β βββ embedder.py # GeminiEmbedder
β βββ cache.py # Hash-based embedding cache
β
βββ vectorstore/
β βββ faiss_store.py # Persistent FAISS index wrapper
β βββ kb_manager.py # Incremental KB lifecycle manager
β
βββ retrieval/
β βββ retriever.py
β
βββ llm/
β βββ gemini_llm.py
β
βββ rag/
β βββ pipeline.py # RAG orchestration + observability
β
βββ evaluation/
β βββ latency.py
β βββ retrieval_metrics.py
β βββ run_evaluation.py
β
βββ data/ # β Ignored (runtime artifacts)
β
βββ Dockerfile
βββ .dockerignore
βββ .gitignore
βββ requirements.txt
βββ README.md
βββ LICENSE
- Secrets are loaded via a
.envfile - The
.envfile is gitignored
- Secrets are managed using GCP Secret Manager
- Secrets are injected as environment variables at runtime
- No secrets are baked into Docker images or source code
Unlike most RAG demos, this project includes an explicit evaluation layer.
Planned/supported metrics:
- Retrieval latency
- Recall@K
- Mean Reciprocal Rank (MRR)
- End-to-end pipeline latency
# Clone repository
git clone https://github.com/Indrasish7/scalable-enterprise-rag.git
cd scalable-enterprise-rag
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run the pipeline
streamlit run app/ui.py
docker build -t scalable-enterprise-rag .
docker run -p 8501:8501 scalable-enterprise-rag- Docker image pushed to Artifact Registry
- Deployed on Cloud Run
- Autoscaling enabled by default
- Secure HTTPS endpoint exposed
- Secrets injected securely via GCP Secret Manager
This setup mirrors real-world GenAI service deployments used in production environments.
- Production-first mindset
- Clear separation of concerns
- Compute-efficient incremental updates
- Scales from small document sets to enterprise corpora
- Easily extensible for hybrid search, reranking, and evaluation
Planned improvements to evolve this into a fully production-ready RAG system:
- Hybrid retrieval (BM25 + Dense vectors)
- Cross-encoder reranking for improved answer relevance
- Streaming LLM responses
- Multi-tenant vector index support
- Monitoring & latency tracing
- Kubernetes-native deployment
Indrasish Bhattacharjee
AI Engineer | GenAI β’ RAG β’ LLMs β’ FAISS
π India
π LinkedIn: https://www.linkedin.com/in/indrasishbhattacharjee
This project is licensed under the MIT License.
See the LICENSE file for details.
β If this repository helped you understand production-grade RAG systems, consider starring it.