Skip to content

Latest commit

Β 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 RAGVerse AI β€” Chat With Any PDF Book

Upload any PDF book and have a real conversation with it β€” grounded, cited answers pulled straight from its pages.

Live Demo Python Streamlit LangChain Mistral AI ChromaDB

Live Demo Β· Report a Bug Β· Request a Feature


πŸ“– About The Project

RAGVerse AI turns any PDF book into a conversational partner. Drop in a file, and instead of skimming hundreds of pages yourself, you just ask β€” and get answers pulled directly from the source, with the exact page cited.

Under the hood it's a full Retrieval-Augmented Generation (RAG) pipeline, built end-to-end rather than wrapped around a single prompt: chunking, embeddings, a per-session vector database, MMR-based retrieval, and a strict "answer only from context" prompt so the model doesn't hallucinate content that isn't actually in your book.

This project was built to practice production-style RAG system design β€” document ingestion, vector search tuning, session-state management, and a fully custom UI β€” rather than a toy llm.invoke(prompt) demo.

🎯 What It Does

Upload any PDF β€” a textbook, a novel, a research paper, a manual β€” and it will:

  1. πŸ“„ Load and parse the PDF page by page
  2. 🧩 Split it into overlapping chunks for better retrieval accuracy
  3. 🧠 Embed every chunk using Mistral's embedding model
  4. πŸ—‚οΈ Build a fresh, isolated vector store for that specific book
  5. πŸ’¬ Let you chat with it β€” retrieving the most relevant passages for every question
  6. πŸ“š Show you exactly which page(s) each answer came from

πŸ”— Live Demo

No installation needed β€” open the link, upload a PDF, and start asking questions.

Repository: github.com/garvkumarsharma/RAGVerse-AI-Project


πŸ–ΌοΈ Screenshots

Upload Screen Chat + Sources Settings Sidebar
Upload Screen Chat View Sidebar Settings

✨ Key Features

  • πŸ“š Upload any PDF, instantly β€” no pre-indexing or setup, just drag and drop
  • 🧠 True RAG pipeline β€” chunking β†’ embedding β†’ vector search β†’ grounded generation, not a single prompt trick
  • πŸ” MMR retrieval β€” Maximal Marginal Relevance balances relevance and diversity so answers aren't built from redundant chunks
  • πŸŽ›οΈ Tunable retrieval settings β€” adjust chunk size, chunk overlap, and number of retrieved chunks live from the sidebar
  • πŸ™… No hallucinated answers β€” the model is instructed to say so explicitly when the document doesn't contain the answer
  • πŸ“Ž Transparent sourcing β€” every answer comes with an expandable panel showing the exact source passages and page numbers
  • πŸ”„ Per-session isolation β€” each uploaded book gets its own vector store; switch books anytime without restarting
  • 🎨 Custom-designed UI β€” fully custom dark, gradient-themed Streamlit interface, not default styling

πŸ—οΈ How It Works β€” Architecture

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   PDF Upload ────▢ β”‚   PyPDFLoader      β”‚  β†’ Loads and parses the PDF page by page
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚  Text Splitter     β”‚  β†’ Chunks text (adjustable size / overlap)
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚ Mistral Embeddings β”‚  β†’ Embeds every chunk into vector space
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   Chroma Vector    β”‚  β†’ Fresh, isolated store per uploaded book
                    β”‚      Store         β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β–Ό
   User Question ──▢ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚  MMR Retriever      β”‚  β†’ Fetches top-k relevant, diverse chunks
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚  Context-Bound      β”‚  β†’ "Answer ONLY from this context" prompt
                    β”‚  Prompt Template    β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚  Mistral Chat LLM  β”‚  β†’ Generates the grounded answer
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β–Ό
              Answer + Cited Source Passages (in-app)

πŸ› οΈ Tech Stack

Layer Technology
LLM Mistral AI (mistral-medium-3-5) via langchain-mistralai
Embeddings Mistral AI Embeddings (langchain-mistralai)
Vector Store ChromaDB via langchain-chroma
Orchestration LangChain (document loaders, text splitters, prompt templates)
Document Parsing pypdf / PyPDFLoader
UI / Frontend Streamlit (custom CSS, no default theme)
Deployment Streamlit Community Cloud
Language Python 3.10+

πŸ“‚ Project Structure

RAGVerse-AI-Project/
β”œβ”€β”€ app.py               # Streamlit UI β€” main entry point for deployment
β”œβ”€β”€ create_db.py         # Standalone script for building a persistent vector store from a fixed PDF (reference/legacy)
β”œβ”€β”€ main.py               # CLI-based query loop against a persistent vector store (reference/legacy)
β”œβ”€β”€ requirements.txt      # Python dependencies
β”œβ”€β”€ config.toml           # Streamlit configuration (theme/server settings)
β”œβ”€β”€ document_loaders/      # Sample/local PDFs used for testing (gitignored)
β”œβ”€β”€ .gitignore             # Excludes .env, .venv, chroma_db/, *.sqlite3
└── README.md

Note: app.py builds a fresh, per-upload vector store at runtime β€” it does not depend on create_db.py or main.py. Those two are kept in the repo as standalone reference scripts for building/querying a persistent, pre-indexed vector store outside the web UI.


πŸš€ Getting Started β€” Run It Locally

Prerequisites

Installation

1. Clone the repository

git clone https://github.com/garvkumarsharma/RAGVerse-AI-Project.git
cd RAGVerse-AI-Project

2. Create and activate a virtual environment

python -m venv .venv

# Windows
.venv\Scripts\activate

# macOS/Linux
source .venv/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. Set up environment variables

Create a .env file in the project root:

MISTRAL_API_KEY=your_mistral_api_key_here

⚠️ Never commit your .env file. It's already excluded via .gitignore.

5. Run the app

streamlit run app.py

The app will open at http://localhost:8501. Upload a PDF, click Process Book, and start chatting.


☁️ Deployment

This project is deployed on Streamlit Community Cloud, connected directly to this GitHub repository.

Live app: ragverse-ai-garv.streamlit.app

If you'd like to deploy your own fork:

  1. Push your fork to GitHub
  2. Go to share.streamlit.io β†’ Create app
  3. Point it at your repo, branch main, main file app.py
  4. Under Advanced settings β†’ Secrets, add:
    MISTRAL_API_KEY = "your_key_here"
  5. Deploy πŸš€

🧭 Roadmap / Future Improvements

  • Support multiple document formats (.docx, .txt, .epub)
  • Multi-document chat (query across several uploaded books at once)
  • Persistent chat history across sessions
  • Support for additional LLM providers (OpenAI, Gemini) via a model switcher
  • Downloadable chat transcript / summary export

πŸ‘€ Author

Garv Kumar Sharma


πŸ“„ License

This project is open source and available under the MIT License.


If you found this project interesting, consider giving it a ⭐ on GitHub!

About

AI-powered RAG app to chat with any PDF book - upload a PDF and get grounded, cited answers using LangChain, Mistral AI, and ChromaDB. Built with Streamlit.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages