Skip to content

Vansh2639/AI_PDF_Chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Python Streamlit License RAG

๐Ÿค– AI PDF Chatbot

An AI-powered PDF Question Answering application built using Retrieval-Augmented Generation (RAG). Upload one or multiple PDF documents, ask questions in natural language, and receive context-aware answers powered by Google Gemini, LangChain, and FAISS.

๐ŸŒ Live Demo: https://ai-pdf-chatbot-2639.streamlit.app/


โœจ Features

  • ๐Ÿ“„ Upload and chat with multiple PDF documents
  • ๐Ÿค– AI-powered question answering using Google Gemini
  • ๐Ÿ” Semantic search with FAISS vector database
  • ๐Ÿง  Retrieval-Augmented Generation (RAG) pipeline
  • ๐Ÿ’ฌ Supports follow-up questions with conversational query rewriting
  • ๐Ÿ“š Displays the source pages used to generate answers
  • โšก Fast document retrieval using LangChain
  • ๐ŸŽจ Clean and responsive Streamlit interface
  • ๐Ÿ”’ Secure API key management using Streamlit Secrets

๐Ÿ–ผ๏ธ Screenshots

Home Page

Home


Uploading PDFs

Upload


AI Answer

Chat


Source References

Sources


๐Ÿ› ๏ธ Tech Stack

Category Technology
Language Python
Frontend Streamlit
LLM Google Gemini
Framework LangChain
Vector Database FAISS
PDF Parsing PyMuPDF
Embeddings Google Gemini Embeddings
Environment python-dotenv

๐Ÿ“‚ Project Structure

AI_PDF_Chatbot/
โ”‚
โ”œโ”€โ”€ app.py
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ README.md
โ”‚
โ”œโ”€โ”€ assets/
โ”‚   โ”œโ”€โ”€ home.png
โ”‚   โ”œโ”€โ”€ upload.png
โ”‚   โ”œโ”€โ”€ chat.png
โ”‚   โ””โ”€โ”€ sources.png
โ”‚
โ””โ”€โ”€ utils/
    โ”œโ”€โ”€ chatbot.py
    โ”œโ”€โ”€ embeddings.py
    โ”œโ”€โ”€ pdf_reader.py
    โ”œโ”€โ”€ renderer.py
    โ”œโ”€โ”€ retriever.py
    โ”œโ”€โ”€ text_splitter.py
    โ””โ”€โ”€ vector_store.py

โš™๏ธ How It Works

PDF Upload
      โ”‚
      โ–ผ
Extract Text (PyMuPDF)
      โ”‚
      โ–ผ
Text Chunking
      โ”‚
      โ–ผ
Gemini Embeddings
      โ”‚
      โ–ผ
FAISS Vector Store
      โ”‚
      โ–ผ
Similarity Search
      โ”‚
      โ–ผ
Relevant Chunks Retrieved
      โ”‚
      โ–ผ
Google Gemini
      โ”‚
      โ–ผ
AI Answer + Source References

๐Ÿš€ Installation

1. Clone the repository

git clone https://github.com/Vansh2639/AI_PDF_Chatbot.git

cd AI_PDF_Chatbot

2. Install dependencies

pip install -r requirements.txt

3. Create a .env file

GOOGLE_API_KEY=YOUR_API_KEY

4. Run the application

streamlit run app.py

The application will open at:

http://localhost:8501

๐ŸŒ Deployment

This project is deployed using Streamlit Community Cloud.

Live Application

https://ai-pdf-chatbot-2639.streamlit.app/

To deploy your own version:

  1. Fork this repository.
  2. Connect it to Streamlit Community Cloud.
  3. Add your API key under App Settings โ†’ Secrets:
GOOGLE_API_KEY = "YOUR_API_KEY"
  1. Deploy.

๐Ÿ“š Example Questions

Try asking:

  • What is Object Destructuring?
  • Explain Object Destructuring in detail.
  • Give me an example of Object Destructuring.
  • Summarize this document.
  • What are the key points discussed?
  • Explain this topic like I'm a beginner.
  • What is the difference between dot notation and bracket notation?
  • List the important concepts in this chapter.

๐Ÿ”ฎ Future Improvements

  • OCR support for scanned PDFs
  • Highlight answer text inside PDFs
  • Export chat history
  • Multi-model support
  • Citation highlighting
  • Dark/Light theme toggle
  • Voice input
  • Streaming token generation
  • Document summarization
  • PDF comparison

๐Ÿ“ฆ Requirements

Some of the major libraries used:

  • streamlit
  • langchain
  • faiss-cpu
  • pymupdf
  • google-genai
  • python-dotenv

Install everything with:

pip install -r requirements.txt

๐Ÿ‘จโ€๐Ÿ’ป Author

Vansh Garg

Computer Science Student | AI/ML Enthusiast

GitHub: https://github.com/Vansh2639

LinkedIn: https://www.linkedin.com/in/vansh-garg-2850b332a/


โญ Support

If you found this project useful:

  • โญ Star the repository
  • ๐Ÿด Fork it
  • ๐Ÿž Report issues
  • ๐Ÿ’ก Suggest new features

Contributions are always welcome!


๐Ÿ“„ License

This project is licensed under the MIT License.

About

An AI-powered PDF chatbot built with Streamlit, LangChain, FAISS, Gemini 2.5 Flash, and RAG for intelligent document question answering.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages