A production-ready RAG (Retrieval-Augmented Generation) application that enables intelligent conversations with multiple PDF documents using advanced NLP techniques and Groq's high-performance LLM inference.
- Multi-Document Processing: Upload and analyze multiple PDFs simultaneously
- Intelligent Chunking: Smart text segmentation with TF-IDF vectorization for optimal retrieval
- Semantic Search: Cosine similarity-based context retrieval for precise answers
- Conversational Memory: Maintains context across multi-turn conversations
- Streaming Responses: Real-time token generation for enhanced UX
- Source Attribution: Tracks and displays which documents provided the answer
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ PDF Upload │────▶│ Text Extract │────▶│ Chunking │
└─────────────┘ └──────────────┘ └──────┬──────┘
│
┌─────────────┐ ┌──────────────┐ ┌──────▼──────┐
│ Groq LLM │◀────│ Context Build│◀────│ TF-IDF + │
│ Response │ │ + Prompt │ │ Similarity │
└─────────────┘ └──────────────┘ └─────────────┘
-
Download the code
- Click the green "Code" button above
- Click "Download ZIP"
- Extract the ZIP file
-
Install Python (3.8 or higher) from python.org
-
Open Command Prompt in the folder
- Navigate to the extracted folder
- Type
cmdin the address bar and press Enter
-
Create virtual environment
python -m venv venv venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set up API Key
- Create a file named .env
- Add: GROQ_API_KEY=your_api_key_here
-
Run the application
streamlit run Main.py
🔑 Get API Key
1. Go to console.groq.com
2. Create free account
3. Generate API key
4. Paste in .env file
💡 How It Works
Upload PDFs: Drag and drop multiple documents
Process: Click "Process PDFs" to index content
Chat: Ask questions in natural language
Review: Check source references for transparency
🧠 Technologies Used
Streamlit: Web interface framework
Groq: Ultra-fast LLM inference (Llama 3.1, Mixtral)
PyPDF2: PDF text extraction
scikit-learn: TF-IDF vectorization and similarity search
python-dotenv: Environment variable management
🛡️ Privacy & Security
Documents processed locally in memory only
No persistent storage of uploaded files
API keys managed via environment variables
📄 License
MIT License - see LICENSE file for details
🙏 Acknowledgments
Groq for high-speed LLM inference
Streamlit for intuitive UI framework
scikit-learn for ML utilities
Built with ❤️ by Badal Patel