Skip to content

roissyahf/chat-with-your-pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š Chat with your PDF App

A simple yet powerful web-based chatbot that enables users to interact with their own PDF documents using natural language. Powered by OpenAI's GPT models and enhanced with Retrieval-Augmented Generation (RAG) capabilities, the chatbot understands context from user-uploaded PDFs and answers questions accurately and concisely.

It features vector storage with FAISS, and history-aware memory, making the experience more conversational and contextually intelligent. The app is built with Streamlit, providing an intuitive and responsive user interface for seamless interactions.


πŸš€ Features

  • PDF Upload & Parsing: Upload single or multiple PDFs and automatically extract structured content using PyPDFLoader.
  • Text Chunking: Split documents using RecursiveCharacterTextSplitter for improved retrieval accuracy.
  • FAISS Vector Store: Store and retrieve document embeddings for fast similarity search.
  • OpenAI-powered QA: Answer user questions by combining document knowledge and GPT responses via LangChain’s QA chain.
  • Chat History Memory: Maintain per-session conversation history using RunnableWithMessageHistory and InMemoryChatMessageHistory.
  • Streamlit UI: Clean sidebar for uploading PDFs, and chat-like interface for asking questions and viewing responses.

πŸ§‘β€πŸ’» How to Use

  1. πŸ‘‰ Go to the app: Click here to open the app
  2. πŸ“„ Upload your PDF file
  3. βœ… Wait for the document to be processed, util the text box to ask questions is displayed
  4. ❓ Ask question about your PDF, and wait the answer
  5. β†ͺ️ You can even ask follow up question, See the message log in the side bar, and restart the session

πŸ’» Run Locally

  1. Clone the repository
git clone https://github.com/roissyahf/chat-with-your-pdf.git
cd chat-with-your-pdf
  1. Create virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate    # On Windows: venv\Scripts\activate
  1. Install dependencies
pip install -r requirements.txt
  1. Create API Key

Visit https://platform.openai.com/api-keys to get OPENAI API KEY, then placed inside .env for security reason

  1. Run the Streamlit app
streamlit run app.py

Releases

No releases published

Packages

No packages published

Languages