An end-to-end Retrieval-Augmented Generation (RAG) chatbot that lets you have a conversation with any PDF document — powered by Google Gemini AI and semantic vector search.
- 📄 Upload any PDF — research papers, books, reports, manuals
- 🔍 Semantic search using FAISS vector index with cosine similarity
- 🤖 Gemini 1.5 Flash for fast, intelligent, context-aware answers
- 📌 Page-number citations on every response
- 💬 Multi-turn memory — the AI remembers your conversation
- ⚡ Local embeddings with
all-MiniLM-L6-v2(no extra API cost) - 🎨 Premium dark UI with glassmorphism styling
git clone https://github.com/YOUR_USERNAME/docmind-rag-chatbot.git
cd docmind-rag-chatbotpython -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # macOS/Linuxpip install -r requirements.txtOption A — UI (easiest): Just paste your key in the sidebar when the app opens.
Option B — .env file (recommended for local use):
cp .env.example .env
# Then open .env and add your keyGOOGLE_API_KEY=AIzaSy...your_key_hereGet a free key at 👉 aistudio.google.com
streamlit run app.pyPDF Upload
│
▼
PyMuPDF → Extract text (page by page)
│
▼
Chunker → 500-word overlapping chunks
│
▼
SentenceTransformer → Dense vector embeddings
│
▼
FAISS Index → Store & search vectors
│
▼
User Query → Embed → Retrieve top-5 chunks
│
▼
Gemini 1.5 Flash → Generate cited answer
| Layer | Tool |
|---|---|
| LLM | Google Gemini 1.5 Flash |
| Embeddings | sentence-transformers (all-MiniLM-L6-v2) |
| Vector Store | FAISS (cosine similarity) |
| PDF Parsing | PyMuPDF (fitz) |
| UI | Streamlit |
| Env Management | python-dotenv |
docmind-rag-chatbot/
├── app.py # Main Streamlit application
├── requirements.txt # Python dependencies
├── .env.example # API key template
├── .gitignore # Git ignore rules
└── README.md # This file
- Never commit your
.envfile — it's already in.gitignore - The sidebar API key input is designed for sharing the app; for personal use, prefer the
.envapproach
MIT License — feel free to use, modify, and share.