An AI-powered Retrieval-Augmented Generation (RAG) application that answers questions about PDF documents using semantic search and Large Language Models.
RAG PDF Chatbot allows users to ask natural language questions about any PDF document.
Instead of searching manually through long documents, the application retrieves the most relevant sections using semantic search and provides accurate answers with the help of modern Large Language Models.
The project supports multiple LLM providers, including OpenAI, Groq and Ollama.
- Ask questions about any PDF document
- Semantic search with Sentence Transformers
- Retrieval-Augmented Generation (RAG)
- Multiple LLM providers (OpenAI, Groq and Ollama)
- Automatic embedding cache for faster startup
- Context-aware question answering
- Beginner-friendly and lightweight implementation
PDF Document
│
▼
Text Extraction (PyPDF)
│
▼
Text Chunking
│
▼
Sentence Transformers
│
▼
Vector Embeddings
│
▼
Cosine Similarity Search
│
▼
Relevant Context
│
▼
Groq / OpenAI / Ollama
│
▼
Generated Answer
The application follows a standard Retrieval-Augmented Generation (RAG) pipeline.
Documents are converted into semantic embeddings, the most relevant chunks are retrieved using cosine similarity, and the selected context is sent to the language model to generate an accurate response.
- Python
- Sentence Transformers
- Retrieval-Augmented Generation (RAG)
- Cosine Similarity Search
- Groq
- OpenAI
- Ollama
- PyPDF
- NumPy
- Scikit-learn
git clone https://github.com/alkyramazann/RAG-PDF-Chatbot.git
cd RAG-PDF-Chatbotpip install -r requirements.txtOPENAI_API_KEY=your_openai_api_key
GROQ_API_KEY=your_groq_api_keyPlace your PDF document inside the data/ directory.
python app/rag.pyRAG-PDF-Chatbot/
│
├── app/
│ └── rag.py
│
├── assets/
│
├── data/
│
├── screenshots/
│
├── .env.example
├── .gitignore
├── LICENSE
├── README.md
└── requirements.txt
Ramazan Allahverdizada