0%
AI/ML 2024

EnterpriseRAG - Document Q&A

LangChain + Qdrant + Claude

Developed production-ready RAG (Retrieval-Augmented Generation) system for intelligent document Q&A using LangChain orchestration framework, Qdrant vector database, and Claude 3.5 API. System ingests multi-format documents (PDF, DOCX, Markdown), chunks intelligently with overlap strategies, generates embeddings via sentence-transformers, performs hybrid search (semantic + keyword), retrieves relevant context, generates answers with source citations. Implements conversation history, query rewriting for better retrieval, context caching for cost optimization. Deployed with FastAPI backend, React frontend, Docker Compose orchestration.

1K+ indexed
Documents
5 supported
Formats
<3s
Response Time
512 tokens
Chunk Size
40%
Cost Savings
Hybrid
Search
01

The Challenge

Knowledge scattered across multiple document formats (PDF, DOCX, Markdown). Traditional keyword search misses semantic matches. LLMs without context give generic answers. Need retrieval system finding relevant chunks, then generating accurate answers with source citations. Context window limits require smart chunking strategies.

02

The Solution

Built RAG pipeline using LangChain for orchestration, Qdrant vector database for embeddings storage, Claude 3.5 for generation. Intelligent document chunking with overlap prevents context loss. Hybrid search combines semantic similarity (Qdrant) with keyword matching. Context caching reduces API costs. Query rewriting improves retrieval accuracy.

Technology Stack

Python 3.11+
FastAPI 0.109
LangChain
Anthropic Claude 3.5
Qdrant 1.8
sentence-transformers
PostgreSQL 16
Redis 7.2
React 18
TypeScript 5.x
Docker 24.0
Docker Compose
PyPDF2
python-docx
03

Architecture

  • RAG pipeline: ingestion → chunking → embedding → indexing → retrieval → generation
  • sentence-transformers embeddings (all-MiniLM-L6-v2, 384 dimensions)
  • Qdrant 1.8 vector database for semantic similarity search
  • Hybrid search: Qdrant semantic + BM25 keyword matching
  • Document chunking: 512 tokens with 50 token overlap
  • LangChain orchestration for multi-stage retrieval
  • Query rewriting via LLM for disambiguation
  • Context caching reducing Claude API costs 40%
  • FastAPI async endpoints with streaming SSE responses
  • Docker Compose deployment: FastAPI + Qdrant + PostgreSQL + Redis
04

Key Features

01
Multi-format ingestion: PDF (PyPDF2), DOCX (python-docx), Markdown, HTML
02
Intelligent chunking with overlap (512 tokens, 50 token overlap)
03
Hybrid search: Qdrant semantic + BM25 keyword matching
04
Source citations with document references and page numbers
05
LangChain context caching reducing API costs 40%
06
Query rewriting via LLM for improved retrieval
07
Conversation history for multi-turn Q&A dialogues
08
React 18 frontend with streaming SSE responses
09
FastAPI 0.109 async backend with Python 3.11+
10
sentence-transformers embeddings (all-MiniLM-L6-v2)
11
PostgreSQL 16 metadata storage with document references
12
Docker Compose orchestration for local deployment
05

Results & Impact

  • Multi-format document ingestion: PDF, DOCX, Markdown, HTML, TXT
  • Indexed 1,000+ documents with intelligent chunking (512 tokens, 50 overlap)
  • Hybrid search: semantic similarity (Qdrant) + keyword matching (BM25)
  • Achieved <3s response time for Q&A with source citations
  • Context caching reduced API costs 40% via LangChain cache layer
  • Query rewriting improved retrieval precision 25% for ambiguous questions
  • Conversation history support for multi-turn dialogues
  • React 18 frontend with streaming responses via Server-Sent Events

Explore This Project