This project implements a conversational Retrieval Augmented Generation (RAG) system using Streamlit, allowing users to upload PDF documents and engage in a chat with the content of those documents. The system maintains chat history for a more natural conversational flow.
- PDF Upload: Easily upload one or multiple PDF files.
- Conversational AI: Chat with the content extracted from the uploaded PDFs.
- Chat History: The system remembers previous turns in the conversation, allowing for context-aware follow-up questions.
- Groq Integration: Utilizes Groq for fast and efficient language model inference.
- HuggingFace Embeddings: Uses
all-MiniLM-L6-v2for generating document embeddings. - Streamlit UI: Provides an intuitive web interface for interaction.
Follow these steps to set up and run the project locally:
- Python 3.8+
pip(Python package installer)
https://github.com/vishalpatel72/Conversational-QA-RAG-Chatbot-using-Langchain.git
cd Conversational-QA-RAG-Chatbot-using-Langchainpython3 -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`pip install -r requirements.txtCreate a .env file in the root directory of the project and add your Groq API key:
GROQ_API_KEY="your_groq_api_key_here"
HF_TOKEN="your_huggingface_token_here" # Optional, but good practice for HuggingFaceEmbeddings
Replace "your_groq_api_key_here" with your actual Groq API key. You can obtain one from the Groq website.
The HF_TOKEN is optional for HuggingFaceEmbeddings but can be useful for rate limits or private models.
To run the Streamlit application, execute the following command in your terminal:
streamlit run app.pyThis will open the application in your web browser (usually at http://localhost:8501).
- Enter your Groq API Key: Input your Groq API key into the provided text field.
- Upload PDF Files: Use the "Choose A PDF file" button to upload one or more PDF documents.
- Enter Session ID: (Optional) Provide a session ID to manage different chat histories. By default, it uses "default_session".
- Ask Questions: Once the PDFs are processed, type your questions into the "Your question:" input field and press Enter. The assistant will respond based on the content of the uploaded PDFs and the ongoing chat history.