Rakshath66/Chat-With-Your-PDF
Streamlit-based chatbot to interact with PDFs using Retrieval-Augmented Generation (RAG), FAISS, Sentence Transformers, and Mistral LLM
π PDF Chatbot β Minimal RAG App using Streamlit + FAISS + Mistral
A clean, fast PDF-based RAG chatbot built with SentenceTransformers, FAISS vector search, and OpenAIβs Mistral-7B β all inside a beautiful Streamlit UI.
β Built with:
Streamlit,FAISS,SentenceTransformers,OpenAI,PyPDF,Mistral 7B
πΈ Preview
π Live Links
π§ Features
- π Upload and chat with PDFs
- π Finds relevant chunks using FAISS + embeddings
- π¬ Ask any question in natural language
- 𧬠Embeds text using
MiniLM-L6-v2 - π§ Answers via OpenAIβs Mistral-7B
- π¨ Custom chat bubble UI in Streamlit
π Getting Started
π§ Prerequisites
- Python 3.9+
- Get your API key from OpenAI
π₯οΈ Local Installation
# 1. Clone this repo
git clone https://github.com/rakshath66/chat-with-your-pdf.git
cd chat-with-your-pdf
# 2. Create virtual environment
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Add your API key in .env
echo "OPENAI_API_KEY=your_openai_key" >> .env
# 5. Launch the app
streamlit run src/streamlit_app.pyπ Environment Variables
Create a .env file (or set in Streamlit Secrets):
OPENAI_API_KEY=your_openai_key
If you're using Streamlit Cloud/ HuggingFace, paste this into Settings β Secrets:
OPENAI_API_KEY = "sk-..."π¬ Example Prompts
- "Summarize the full document."
- "What is the main conclusion in page 3?"
- "List all key entities mentioned."
- "Who is the author and when was this written?"
π Project Structure
chat-with-your-pdf/
βββ .env
βββ requirements.txt
βββ src/
β βββ streamlit_app.py
βββ images/
βββ ui.png
π€ Contributing
We welcome contributions! Here's how you can help:
β To Contribute:
- Fork this repository
- Clone your fork:
git clone https://github.com/Rakshath66/Chat-With-Your-PDF.git - Create a new branch:
git checkout -b feature/my-feature - Make your changes and commit:
git commit -m "Add: your message here" - Push to your branch:
git push origin feature/my-feature - Open a Pull Request with a description of your changes
π Please write clean code, add docstrings if needed, and test your features!
π€ Contributing Issues
Contributions, issues, and feature requests are welcome!
π΄ Fork this repo -> Make your changes -> Test thoroughly -> π© Submit a pull request
Please ensure your code follows best practices and includes helpful comments/documentation if needed.
π Code Commit Style
Follow Conventional Commits:
feat:new featurefix:bug fixdocs:documentation updaterefactor:code refactorstyle:UI or formattingchore:maintenance tasks
Example:
git commit -m "feat: added multi-pdf upload support"π§ͺ Testing
Make sure your code:
- Doesnβt break the main app
- Works on local Streamlit
- Follows a consistent UI/UX style
π Thank You
Every contribution makes this project better. Whether it's a typo fix or a new feature β you're appreciated!
π License
MIT Β© Rakshath U Shetty
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software... [rest of MIT license]
β Star this project if you like it!
It helps others discover it, and motivates me to build more free AI tools.
Also, feel free to open issues, request features, or contribute.
π£οΈ Next Steps β Roadmap
β Phase 1: Basic RAG PDF Chatbot β (Done)
- β Upload PDF
- β Chunk + embed with MiniLM
- β FAISS vector store
- β OpenAI + Mistral response
π Phase 2: Multi-PDF Support
- π Support multiple PDFs at once
- π Search across all PDFs in vector DB
- π§© Track source chunk in response
π§ Phase 3: Chunk Highlight + Source Tracking
- β¨ Show which PDF chunk was used
- π Highlight sentence or paragraph
- π Add page numbers in answer
π§ Phase 4: Simple Memory (Session-based)
- π§ Let chatbot remember previous Q/A per PDF session
- π Keep conversation thread for 1 session
βοΈ Phase 5: Backend API Support
- π§ Wrap logic into
FastAPIorFlask - π Expose
/askendpoint with PDF + query - π οΈ Use as an API for other frontends
π Phase 6: URL + Website Reader (optional)
- π° Add
summarize_urlsupport - π Upload a link β extract β chat like PDF
π§βπ» Built by Rakshath U Shetty
- Open source forever
- Designed for learning, research, and practical use
- Reach out via issues or PRs β ideas welcome!
Let me know if you want:
- `LICENSE` file (MIT version)
- A matching `.env.example` file
- `demo/screenshot.png` placeholder
- `contributing.md` file
All of this helps boost your open-source visibility!
