Architected and developed an enterprise-grade Agentic Retrieval-Augmented Generation (RAG) system designed to index, manage, and answer complex questions from multi-format company documents (PDF, DOCX, TXT) with verified inline citations.
Key Architecture & Engineering Highlights:
1. Intent-Based Agentic Routing:
Engineered an upfront Intent Router using LangGraph that classifies user input into chit-chat, out-of-scope requests, and domain-specific company queries. Out-of-scope questions receive structured, policy-compliant rejections, eliminating unnecessary vector queries and token expenditure.
2. Contextual Query Rewriting & Self-Correcting Loops: Integrated a query reformulation engine that resolves multi-turn conversational references and pronouns. Implemented an automated retry loop (up to 3 iterations) that grades retrieved document relevance and reformulates search terms with expanded top-K parameters if initial retrieval confidence is insufficient.
3. High-Performance Vector Storage & Search:
Configured PostgreSQL with the pgvector extension, utilizing HNSW indexing for rapid cosine similarity search with a strict similarity threshold (>= 0.7).
4. Live Streaming Document Ingestion:
Built an end-to-end asynchronous ingestion pipeline that streams extraction, token-aware chunking (800 token size, 200 token overlap), embedding generation, and database indexing progress to the user interface via Server-Sent Events (SSE). Includes SHA-256 document hashing for deduplication and non-destructive document updates.
5. Stateful Memory & Full Observability:
Utilized LangGraph PostgresSaver for persistent multi-turn conversational checkpointing. Developed an analytics subsystem logging latency, token consumption per model, retrieval accuracy, and full query audit trails for administrative monitoring.