An advanced AI-powered Hybrid Academic RAG (Retrieval-Augmented Generation) Assistant built using LangChain, Google Gemini API, ChromaDB, HuggingFace Embeddings, and Streamlit.
This system allows students to upload academic PDFs, notes, and study materials into a persistent vector database and ask intelligent context-aware questions from the stored documents.
The project follows a modular enterprise-style RAG architecture with query rewriting, semantic retrieval, reranking, prompt refinement, and grounded answer generation.
- Upload and permanently store multiple academic PDFs
- Extract text using PyMuPDF
- Extract tables using pdfplumber
- Clean and preprocess extracted content
- Split documents into semantic chunks
- Generate semantic embeddings using HuggingFace MiniLM
- Store embeddings permanently in ChromaDB
- Query rewriting for better retrieval
- Semantic similarity retrieval using ChromaDB
- CrossEncoder reranking for improved relevance
- Prompt refinement and context injection
- Grounded answer generation using Gemini 2.5 Flash
- Source citation with PDF name and page number
- PDF-specific retrieval filtering
- Multi-PDF semantic search
- Persistent vector database
- Context-aware response generation
- Top-k optimized retrieval
- Semantic chunk reranking
- Streamlit chat-based interface
- Persistent chat history using JSON storage
- Quick academic question suggestions
- Admin ingestion dashboard
- PDF selection dropdown
- Source transparency and retrieved details
- Python
- Streamlit
- LangChain
- Google Gemini API
- HuggingFace Embeddings
- ChromaDB
- SentenceTransformers
- CrossEncoder Reranker
- PyMuPDF
- pdfplumber
- python-dotenv
- Retrieval-Augmented Generation (RAG)
langchain-chatbot/
β
βββ app.py
βββ ingest.py
βββ config.py
βββ requirements.txt
βββ README.md
βββ .gitignore
βββ chat_history.json
βββ image.png
βββ image-1.png
βββ image-2.png
βββ image-3.png
β
βββ data/
β βββ pdfs/
β
βββ chroma_db/
β
βββ rag/
β βββ __init__.py
β βββ document_loader.py
β βββ chunker.py
β βββ embeddings.py
β βββ vector_store.py
β βββ query_rewriter.py
β βββ retriever.py
β βββ reranker.py
β βββ prompt_builder.py
β βββ generator.py
β βββ pipeline.pygit clone https://github.com/Sahithi-0506/chatbot.git
cd chatbotconda create -n langchain-env python=3.10 -y
conda activate langchain-envpip install -r requirements.txtCreate a .env file in the root folder.
GOOGLE_API_KEY=your_gemini_api_keystreamlit run ingest.pyUpload PDFs and build ChromaDB.
streamlit run app.pyApplication runs at:
http://localhost:8501
- User uploads academic PDFs
- PDFs are stored inside
data/pdfs - Text is extracted using PyMuPDF
- Tables are extracted using pdfplumber
- Extracted content is cleaned and chunked
- HuggingFace semantic embeddings are generated
- Chunks are stored permanently in ChromaDB
- User asks a question
- Query rewriting improves retrieval quality
- ChromaDB performs semantic similarity search
- Retrieved chunks are reranked using CrossEncoder
- Relevant context is injected into prompt
- Gemini generates grounded contextual answer
- Source citations are displayed with PDF name and page number
- Persistent ChromaDB vector storage
- Semantic retrieval using embeddings
- Query rewriting for improved retrieval accuracy
- CrossEncoder reranking for relevance optimization
- Modular RAG architecture
- Top-k retrieval optimization
- Chat history persistence
- PDF-specific filtering
- Context size optimization for token efficiency
- Single Responsibility Principle
- Modular architecture
- Separation of concerns
- Reusable pipeline components
- Extensible retrieval pipeline
- Academic doubt solving
- Exam preparation
- Notes summarization
- Concept explanation
- Quick revision
- Multi-PDF semantic search
- AI-assisted learning
- OCR support for scanned PDFs
- Gemini Vision integration
- Voice-based interaction
- Authentication system
- Cloud deployment
- Multi-user support
- Citation highlighting inside PDFs
- Hybrid search (keyword + semantic)
- Advanced agentic RAG workflows
-
GitHub: https://github.com/Sahithi-0506
-
LinkedIn: https://www.linkedin.com/in/sahithi-achyutha-ishwarya-kalla-317799319/
This project is developed for educational, academic, and learning purposes.



