Skip to content
Siddharth Singh
Menu
  • About Me
  • Buy My Data Science Notes
  • Book 1:1 Session For Data Science Career Guidance
  • Explore My GitHub
  • Add Me on LinkedIn
Menu

PDF RAG ChatBot

Posted on October 14, 2025 by nomadicsid

Live at : http://217.154.38.177:8501/

Smart ChatBot πŸ€–

This is a simple Streamlit ChatBot app powered by OpenAI, LangChain, RAG (Retrieval-Augmented Generation), and FAISS for vector storage.
The app allows users to upload a text-based PDF document and ask natural language questions related to the content of the uploaded file.


πŸš€ Features

  • πŸ”₯ Ask questions from any uploaded PDF document
  • πŸ’‘ Uses OpenAI (gpt-3.5-turbo) to generate smart answers
  • πŸ”Ž Powered by LangChain’s RAG framework and FAISS vector store
  • πŸ“š Dynamically parses PDFs and generates embeddings
  • 🧠 Retrieval-based contextual answering with document chunking

πŸ› οΈ Tech Stack

  • Streamlit – UI frontend
  • LangChain – Chain and retrieval logic
  • OpenAI – LLM for answer generation
  • FAISS – Local in-memory vector storage
  • PDF document parsing via PyPDFLoader

πŸ“¦ Folder Structure

your-repo/
β”œβ”€β”€ app.py             # Main Streamlit app file
└── README.md           # Project documentation

πŸ’‘ How It Works

  1. Upload a PDF document (text-based only).
  2. It gets split into chunks using LangChain’s RecursiveCharacterTextSplitter.
  3. Each chunk is converted into a vector using OpenAI Embeddings (text-embedding-3-small or similar).
  4. Vectors are stored in a temporary FAISS index.
  5. At query time, most relevant chunks are retrieved and passed as context to GPT.
  6. GPT returns an answer grounded in the uploaded document.

▢️ Getting Started

1. Clone the repository

git clone https://github.com/siddharthsingh5010/pdf_rag_chatbot
cd pdf_rag_chatbot

2. Install dependencies

Create a virtual environment and install required packages:

pip install -r requirements.txt

3. Set your OpenAI API Key

You can export it in your terminal session:

docker build -t pdf_rag_app .

Or add this in your shell config (~/.bashrc, ~/.zshrc, etc.).

4. Run the app

docker run -p 8501:8501 pdf_rag_app


πŸ” Notes

  • This app only supports text-based PDFs (not scanned images).
  • For best performance, make sure your OpenAI API key has access to gpt-3.5-turbo.

πŸ“„ License

MIT License

Author
Siddharth Singh

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • πŸ”₯ PDF RAG ChatBot
  • πŸ”₯ HR Policy ChatBot
  • LinkedIn
  • GitHub
  • Mail
  • WhatsApp
  • YouTube
  • Generative AI
  • Machine Learning
  • Regression
  • Uncategorized
© 2026 Siddharth Singh | Powered by Superbs Personal Blog theme