A production-inspired Hybrid Retrieval-Augmented Generation (Hybrid RAG) application built with TypeScript, Node.js, ChromaDB, Elasticsearch, Cohere Rerank, and Google Gemini.
The application allows users to upload PDF documents, indexes them using both semantic search and keyword search, and provides an AI-powered chat interface capable of answering questions grounded in the uploaded documents.
- 📄 Upload and index PDF documents
- ✂️ Automatic document chunking
- 🧠 Generate embeddings using Google Gemini
- 🔍 Semantic search using ChromaDB
- 🔎 Keyword search using Elasticsearch (BM25)
- ⚡ Hybrid retrieval using Reciprocal Rank Fusion (RRF)
- 🎯 Context re-ranking using Cohere Rerank v3.5
- 🤖 AI-generated responses using Gemini 2.5 Flash
- 💬 Interactive chat interface
- 🌙 Modern dark-themed frontend
- Upload PDF documents
- Browse indexed documents
- Ask questions grounded in the uploaded knowledge base
- Node.js
- TypeScript
- Express.js
- Google Gemini Embeddings
- Gemini 2.5 Flash
- Cohere Rerank v3.5
- ChromaDB
- Elasticsearch
- LangChain
- PDF Loader
- Recursive Character Text Splitter
- React
- TypeScript
- Tailwind CSS
For every user query:
- Convert the query into an embedding using Gemini.
- Perform semantic search in ChromaDB.
- Perform keyword search in Elasticsearch (BM25).
- Merge both result sets using Reciprocal Rank Fusion (RRF).
- Re-rank the merged results with Cohere Rerank.
- Build a context-aware prompt.
- Generate the final answer with Gemini 2.5 Flash.
When a PDF is uploaded:
- Load the PDF.
- Extract text.
- Split the document into chunks.
- Generate embeddings for each chunk.
- Store embeddings in ChromaDB.
- Store document text and metadata in Elasticsearch.
- Make the document available for querying.
This project showcases practical implementations of modern RAG techniques, including:
- Retrieval-Augmented Generation (RAG)
- Hybrid Search
- Vector Search
- BM25 Keyword Search
- Reciprocal Rank Fusion (RRF)
- Semantic Re-ranking
- Embedding Generation
- PDF Parsing
- Document Chunking
- Prompt Engineering
- AI-powered Question Answering
git clone https://github.com/RohitVerma2003/Talk-PDF.git
cd Talk-PDFcd client
npm install
cd..
cd server
npm installCreate a .env file in server folder:
CHROMA_API_KEY
CHROMA_TENANT
CHROMA_DATABASE
ELASTIC_CLOUD_ID=
ELASTIC_CLOUD_URL=
ELASTIC_API_KEY=
GEMINI_API_KEY
COHERE_API_KEYserver
npm run startclient
npm run dev- User authentication
- Conversation history
- Streaming AI responses
- Citation highlighting
- Hybrid search filters
- OCR support for scanned PDFs
- Document collections
- Docker deployment
- Kubernetes deployment
- Evaluation pipeline using RAGAS
This project was built to explore how modern production-style RAG systems work by combining:
- Semantic Retrieval
- Keyword Retrieval
- Retrieval Fusion
- Re-ranking
- Large Language Models
It demonstrates how these components work together to improve retrieval quality and generate grounded, context-aware AI responses.