This project is a Conversational Retrieval-Augmented Generation (RAG) system that allows users to upload PDF files, extract the content, and ask questions about the uploaded content. The system keeps track of chat history and contextualizes user questions based on the past conversation to provide relevant answers.
The application is built with Streamlit for the user interface, integrates Groq for the LLM (language model), and Chroma as the vector store to handle document embeddings and retrieval. The conversational flow is maintained with chat history to enable stateful question-answering.
HuggingFaceEmbeddings to create document embeddings and retrieve relevant content.To run this project, you need the following:
Clone the repository:
git clone https://github.com/yourusername/conversational-rag-with-pdf.git
cd conversational-rag-with-pdfCreate a virtual environment:
python3 -m venv venv
source venv/bin/activate # On Windows, use `venvScriptsactivate`Install the required dependencies:
pip install -r requirements.txtSet up environment variables:
Create a .env file in the root directory and add your API keys:
touch .envInside the .env file, add the following:
HF_TOKEN=your_huggingface_token
GROQ_API_KEY=your_groq_api_keyRun the application:
streamlit run utils.pyWhen you launch the app, you'll first need to enter your Groq API key. This is required to perform the language modeling and question answering.
Click on the Choose A PDF file button to upload one or more PDF files. The content from the PDFs will be processed and split into chunks for efficient retrieval.
After uploading PDFs, you can ask questions related to the content of the uploaded files. The assistant will answer based on the context provided by the PDFs and previous chat history.
The system tracks the conversation history. You can view the session history, and the assistant uses this history to answer follow-up questions in context.
Gemma2-9b-It model.If you run into issues such as API key errors or file upload issues, ensure that:
pip install -r requirements.txt.