Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 DocMind — RAG-Powered Document Q&A

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.


✨ Features

  • 📄 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

🚀 Quick Start

1. Clone the repo

git clone https://github.com/YOUR_USERNAME/docmind-rag-chatbot.git
cd docmind-rag-chatbot

2. Create a virtual environment (recommended)

python -m venv venv
venv\Scripts\activate      # Windows
# source venv/bin/activate  # macOS/Linux

3. Install dependencies

pip install -r requirements.txt

4. Set up your API key

Option 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 key
GOOGLE_API_KEY=AIzaSy...your_key_here

Get a free key at 👉 aistudio.google.com

5. Run the app

streamlit run app.py

🏗️ How It Works

PDF 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

🛠️ Tech Stack

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

📁 Project Structure

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

⚠️ Security Note

  • Never commit your .env file — it's already in .gitignore
  • The sidebar API key input is designed for sharing the app; for personal use, prefer the .env approach

📄 License

MIT License — feel free to use, modify, and share.

About

Chat with any PDF using RAG — semantic search with FAISS + Google Gemini AI

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages