A streamlined Retrieval-Augmented Generation (RAG) chatbot built with Streamlit and LangChain, using DeepSeek models through Groq's API. This application allows users to upload PDF documents and interact with them through natural language queries, featuring step-by-step reasoning and streaming responses.
deepseek-rag-project.mp4
- PDF Document Processing: Upload and analyze PDF documents
- Step-by-Step Reasoning: Watch the AI think through each question
- Streaming Responses: Real-time response generation
- Advanced Settings: Customize model parameters and processing options
- Performance Metrics: Track response times and processing statistics
- Clean UI: Modern, responsive interface with blue and white theme
- Python 3.8 or higher
- Groq API key
- OpenAI API key (for embeddings)
- Clone the repository:
git clone https://github.com/Croups/rag-chatbot-deepseek
cd deepseek-rag-chatbot- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Create a .env file in the project root:
GROQ_API_KEY=your_groq_api_key
OPENAI_API_KEY=your_openai_api_key- Start the Streamlit app:
streamlit run app.py- Open your browser and navigate to
http://localhost:8501
deepseek-rag-chatbot/
├── app.py # Main application file
├── requirements.txt # Project dependencies
├── .env # Environment variables
├── README.md # Project documentation
└── document_store/ # Document storage directory
└── pdfs/ # PDF storage directory
-
Setup
- Enter your Groq API key
- Select a DeepSeek model
- Configure advanced settings (optional)
-
Document Upload
- Upload a PDF document
- Documents are stored in
document_store/pdfs/ - System processes and indexes the document
-
Chatting
- Ask questions about your document
- View the AI's thinking process
- Get clear, concise answers
-
Advanced Settings
- Temperature: Control response creativity (0.0-1.0)
- Chunk Size: Adjust text processing (500-2000)
- Chunk Overlap: Set context overlap (0-500)
- deepseek-r1-distill-qwen-32b: Balanced performance
- deepseek-r1-distill-llama-70b: Best for complex tasks
- llama3-70b-8192: Extended context window
- gemma2-9b-it: Fast and efficient
- Frontend: Streamlit
- RAG Implementation: LangChain
- Embeddings: OpenAI Text Embeddings
- LLM Provider: Groq
- PDF Processing: PDFPlumber
- Text Splitting: RecursiveCharacterTextSplitter
- Document Upload → PDF Processing → Text Chunking
- Chunk Embedding → Vector Storage
- Query Processing → Context Retrieval
- LLM Processing → Streaming Response
| Setting | Range | Default | Description |
|---|---|---|---|
| Temperature | 0.0-1.0 | 0.7 | Controls response randomness |
| Chunk Size | 500-2000 | 1000 | Text chunk size for processing |
| Chunk Overlap | 0-500 | 200 | Overlap between chunks |
Common issues and solutions:
-
API Key Errors
- Verify API key length and format
- Check environment variable configuration
-
PDF Processing Issues
- Ensure PDF is not password protected
- Check file permissions
- Verify PDF is not corrupted
-
Memory Issues
- Reduce chunk size for large documents
- Process smaller sections if needed
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to contact me on linkedin : www.linkedin.com/in/enes-koşar