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.
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.
- 📄 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)
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
- Streamlit
- PyPDF
- LangChain
- FAISS
- sentence-transformers/all-MiniLM-L6-v2
- Ollama
- Llama 3.2
- Python
PDF-Knowledge-Base/
│
├── pdfs/
├── vectorstore/
├── .streamlit/
├── app.py
├── requirements.txt
├── README.md
└── .gitignore
git clone https://github.com/teajas14/PDF-Knowledge-Base.git
cd PDF-Knowledge-Basepython -m venv venvWindows:
venv\Scripts\activatepip install -r requirements.txtDownload and install Ollama.
After installation:
ollama pull llama3.2Verify:
ollama run llama3.2streamlit run app.pyOpen the local Streamlit URL in your browser.
- Upload a PDF document.
- Extract text from the PDF.
- Split text into overlapping chunks.
- Convert chunks into vector embeddings.
- Store embeddings in FAISS.
- Retrieve the most relevant chunks for a query.
- Pass retrieved context to Llama 3.2.
- Generate a grounded response.
- 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
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
Teajas Sreejeth
GitHub: https://github.com/teajas14