A PDF-based Retrieval-Augmented Generation (RAG) chatbot allows users to interact with PDF documents intelligently. Instead of manually searching through pages, you can simply ask questions, and the chatbot extracts relevant information from your PDFs, providing accurate and context-aware answers instantly.
This chatbot built with Streamlit, LangChain, HuggingFace embeddings, FAISS, and Groq LLM.
Live Demo : (https://insightpdf---rag-powered-ai-chatbot.streamlit.app/)
- Project Overview
- Screenshots
- Key Features
- Installation
- Usage
- Configuration
- Tech Stack
- Folder Structure
- Contributions
- License
- About
-
Context-Aware PDF Intelligence: Engineered for deep, targeted querying, allowing users to extract precise insights instantly without manual skimming or document searching.
-
Intelligent Text Processing: Utilizes automated extraction and recursive chunking logic to preserve document hierarchy and maximize retrieval accuracy.
-
High-Speed Retrieval with FAISS: Implements local vector storage for optimized similarity searches, ensuring near-instant access to relevant document segments.
-
Ultra-Fast Inference via Groq: Delivers real-time, grounded responses by leveraging Groq’s Tensor Streaming Processor (TSP) architecture for industry-leading, deterministic low latency.
-
Semantic Precision with HuggingFace: Employs state-of-the-art embedding models to generate high-fidelity semantic representations, ensuring superior search relevance.
git clone https://github.com/SruthiPuli/InsightPDF---RAG-Powered-AI-Chatbot.git
cd InsightPDF---RAG-Powered-AI-ChatbotTo avoid package dependency issues, it is recommended to create a virtual environment before installing the required libraries. You can skip this step if you prefer installing packages globally.
# Create a virtual environment named 'my_venv'
python -m venv my_venv# Activate the virtual environment
# On Windows
my_venv\Scripts\activate# On macOS/Linux
source my_venv/bin/activateInstall all required dependencies using the following command:
# python packages
pip install -r requirements.txt- Once the setup is complete, start the Streamlit app by running:
# Run the chatbot
streamlit run app.py
# Open the URL in your browser (usually http://localhost:8501)-
Upload any PDF file using the file uploader in the Streamlit interface.
-
Once the document is processed and indexed, start asking questions through the chat input.
-
The chatbot retrieves relevant context from the PDF and answers your queries in real time.
Ensure your .env file is set up with your Groq API key:
# To access Groq LLM
GROQ_API_KEY="your_actual_api_key_here"Then, in your Python script, load it like this:
# Python
import os
from dotenv import load_dotenv
load_dotenv()
api_key = os.getenv("GROQ_API_KEY")If you deploy this application on Streamlit Cloud, do not use the .env file.
- Go to your app dashboard on Streamlit Cloud.
- Open Settings → Secrets.
- Add your API key in the following format:
# Secrets
GROQ_API_KEY = "your_actual_api_key_here"- Python – Core programming language used for application logic.
- Streamlit – Interactive web framework for building the user interface.
- LangChain – Provides end-to-end components for building Retrieval-Augmented Generation (RAG) pipelines, including document loading, text splitting, embedding integration, vector store management, and seamless LLM orchestration.
- Groq LLM – Used for real-time response generation, leveraging Groq’s Tensor Streaming Processor (TSP) architecture to deliver ultra-fast, deterministic, low-latency inference for context-aware answers. It allows 14,000+ requests in a day for free.
- HuggingFace Embeddings – Responsible for converting document text and user queries into semantic vector representations, enabling accurate similarity-based retrieval.
- FAISS – High-performance vector database for efficient and fast similarity search over embedded document chunks.
- PyPdfReader – Extracts and processes text from PDF documents.
- Sentence-Transformers – Provides pre-trained embedding models; this project uses
sentence-transformers/all-MiniLM-L6-v2for lightweight, high-quality embeddings that balance speed and semantic accuracy. - Python-dotenv – Manages environment variables securely during local development.
pdf-rag-chatbot/
├─ outputs/ # Images, Live Demo Video
├─ .gitattributes # Tells Git how to handle files
├─ app.py # Main Streamlit app
├─ requirements.txt # Python dependencies
├─ sample_pdf # Sample Pdf to upload
├─ LICENSE # MIT License
└─ README.md # README File
Contributions are welcome! If you’d like to improve this project, feel free to fork the repository, create a new branch, and submit a pull request. Bug reports, feature requests, and documentation improvements are all appreciated.
This project is licensed under the MIT License. If you fork or use this project, please give credit by mentioning or pinging me: Sruthi Pulipati (GitHub: SruthiPuli).
This project is solely developed by Sruthi Pulipati (GitHub: SruthiPuli).