Skip to content

About

RAG chatbot that answers questions from uploaded PDFs using LangChain, FAISS & Ollama

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

📚 PDF Knowledge Base Chatbot

A Retrieval-Augmented Generation (RAG) chatbot that allows users to upload PDF documents and ask questions about their contents using semantic search and a locally hosted LLM powered by Ollama.


🚀 Overview

This project combines document processing, vector search, and large language models to create an intelligent PDF question-answering system.

Users can upload a PDF document, ask questions in natural language, and receive context-aware answers generated from the uploaded document.

The application uses a Retrieval-Augmented Generation (RAG) pipeline to ensure answers are grounded in the document rather than relying solely on the language model's pre-trained knowledge.


✨ Features

  • 📄 PDF Upload and Processing
  • 🔍 Semantic Search using FAISS
  • 🧩 Recursive Text Chunking
  • 🤖 Local LLM Inference with Ollama
  • 🦙 Llama 3.2 Integration
  • 🧠 HuggingFace Embeddings
  • ⚡ Streamlit Web Interface
  • 🔒 Fully Local Execution (No Paid APIs Required)

🏗️ System Architecture

User Uploads PDF
        │
        ▼
Text Extraction (PyPDF)
        │
        ▼
Chunking (RecursiveCharacterTextSplitter)
        │
        ▼
Embeddings Generation
(HuggingFace all-MiniLM-L6-v2)
        │
        ▼
FAISS Vector Database
        │
        ▼
Similarity Search
        │
        ▼
Relevant Context Retrieval
        │
        ▼
Ollama + Llama 3.2
        │
        ▼
Generated Answer

🛠️ Tech Stack

Frontend

  • Streamlit

Document Processing

  • PyPDF

Retrieval Layer

  • LangChain
  • FAISS

Embeddings

  • sentence-transformers/all-MiniLM-L6-v2

Language Model

  • Ollama
  • Llama 3.2

Programming Language

  • Python

📂 Project Structure

PDF-Knowledge-Base/
│
├── pdfs/
├── vectorstore/
├── .streamlit/
├── app.py
├── requirements.txt
├── README.md
└── .gitignore

⚙️ Installation

1. Clone Repository

git clone https://github.com/teajas14/PDF-Knowledge-Base.git
cd PDF-Knowledge-Base

2. Create Virtual Environment

python -m venv venv

3. Activate Virtual Environment

Windows:

venv\Scripts\activate

4. Install Dependencies

pip install -r requirements.txt

🦙 Install Ollama

Download and install Ollama.

After installation:

ollama pull llama3.2

Verify:

ollama run llama3.2

▶️ Run the Application

streamlit run app.py

Open the local Streamlit URL in your browser.


🔄 RAG Workflow

  1. Upload a PDF document.
  2. Extract text from the PDF.
  3. Split text into overlapping chunks.
  4. Convert chunks into vector embeddings.
  5. Store embeddings in FAISS.
  6. Retrieve the most relevant chunks for a query.
  7. Pass retrieved context to Llama 3.2.
  8. Generate a grounded response.

📈 Future Enhancements

  • Multi-PDF Knowledge Base
  • Persistent Vector Storage
  • Chat History Memory
  • Gemini API Support
  • Hybrid Search (Keyword + Semantic)
  • Agentic RAG Pipeline
  • Recursive Retrieval Mechanisms
  • Document Summarization
  • Citation-Based Answers

🎯 Learning Outcomes

This project demonstrates:

  • Retrieval-Augmented Generation (RAG)
  • Semantic Search
  • Vector Databases
  • Embedding Models
  • Local LLM Deployment
  • LangChain Workflows
  • Streamlit Application Development
  • End-to-End AI Application Development

👨‍💻 Author

Teajas Sreejeth

GitHub: https://github.com/teajas14


⭐ If you found this project useful, consider giving it a star!

About

RAG chatbot that answers questions from uploaded PDFs using LangChain, FAISS & Ollama

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages