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
π Live Links
- π 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
- Python 3.9+
- Get your API key from OpenAI
# 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.pyCreate 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-..."- "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?"
chat-with-your-pdf/
βββ .env
βββ requirements.txt
βββ src/
β βββ streamlit_app.py
βββ images/
βββ ui.png
We welcome contributions! Here's how you can help:
- 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!
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.
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"Make sure your code:
- Doesnβt break the main app
- Works on local Streamlit
- Follows a consistent UI/UX style
Every contribution makes this project better. Whether it's a typo fix or a new feature β you're appreciated!
MIT Β© Rakshath U Shetty
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software... [rest of MIT license]
It helps others discover it, and motivates me to build more free AI tools. Also, feel free to open issues, request features, or contribute.
- β Upload PDF
- β Chunk + embed with MiniLM
- β FAISS vector store
- β OpenAI + Mistral response
- π Support multiple PDFs at once
- π Search across all PDFs in vector DB
- π§© Track source chunk in response
- β¨ Show which PDF chunk was used
- π Highlight sentence or paragraph
- π Add page numbers in answer
- π§ Let chatbot remember previous Q/A per PDF session
- π Keep conversation thread for 1 session
- π§ Wrap logic into
FastAPIorFlask - π Expose
/askendpoint with PDF + query - π οΈ Use as an API for other frontends
- π° 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!
