A powerful Streamlit application that allows you to upload PDF documents and chat with them using Retrieval-Augmented Generation (RAG) powered by Google's Gemini AI.
- 📄 PDF Upload & Processing: Upload PDF documents and process them for analysis
- 🤖 AI-Powered Chat: Chat with your documents using Google's Gemini AI models
- 🔍 Intelligent Retrieval: Uses FAISS vector search for efficient document retrieval
- 🎨 Modern UI: Clean and intuitive Streamlit interface
- 🔒 Secure API Key Management: Secure input for your Gemini API key
- Python 3.8 or higher
- A valid Google Gemini API key (get one from Google AI Studio)
- Clone the repository:
git clone <your-repo-url>
cd chat-pdf- Install the required dependencies:
pip install -r requirements.txt- Run the Streamlit app:
streamlit run app.py-
Open your browser and navigate to
http://localhost:8501 -
In the sidebar:
- Enter your Gemini API key
- Upload a PDF document
- Click "Process Document"
-
Start chatting with your PDF in the chat interface!
- streamlit: Web app framework
- langchain: Framework for building LLM applications
- langchain-community: Community integrations for LangChain
- langchain-huggingface: HuggingFace integrations
- langchain-google-genai: Google Generative AI integration
- pypdf: PDF processing library
- sentence-transformers: Text embeddings
- faiss-cpu: Vector similarity search
- Document Processing: PDFs are loaded and split into manageable chunks
- Embeddings: Text chunks are converted to vector embeddings using HuggingFace models
- Vector Storage: Embeddings are stored in a FAISS vector database
- Retrieval: When you ask a question, relevant document chunks are retrieved
- Generation: Gemini AI generates answers based on the retrieved context
- Chunk Size: 1000 characters with 200 character overlap
- Embedding Model: all-MiniLM-L6-v2 (fast and efficient)
- Vector Store: FAISS for local similarity search
- LLM: Google Gemini (configurable in the code)
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
This application requires a valid Google Gemini API key. Usage costs may apply based on your API usage. Please refer to Google's pricing for more information.