Building a RAG System for Mumbai Enterprise Document Search

How we built a Retrieval-Augmented Generation system for a Mumbai legal firm — architecture, costs, and results.
Building a RAG System for Enterprise Document Search
A Mumbai legal firm needed to search 500,000+ legal documents — contracts, case files, regulatory filings — and retrieve relevant passages in seconds. Traditional keyword search couldn't handle the semantic complexity of legal language. We built a Retrieval-Augmented Generation (RAG) system.
System Architecture
Documents → Chunking → Embedding → Vector DB → Retriever → LLM → Answer
Chunking Strategy
Legal documents vary from 2-page affidavits to 500-page merger agreements. We used recursive character text splitting with 512-token chunks and 128-token overlap — enough overlap to preserve context across chunk boundaries without duplicating too much content.
Embedding and Storage
OpenAI's text-embedding-3-large (3072 dimensions) captured legal semantics better than open-source alternatives. Pinecone's serverless index handled 2M+ vectors with <100ms query latency from Mumbai's AWS region.
Results
- ›Search time: From 15+ minutes (manual) to under 2 seconds
- ›Recall: 94% on legal-specific benchmark questions
- ›Cost: ₹0.85 per query (embedding + LLM inference), down 60% from initial estimates after optimisation
Related: LLM fine-tuning vs RAG, AI resume screening.