This project implements a Retrieval-Augmented Generation (RAG) pipeline that enables users to upload PDF documents and interactively ask context-aware questions.
The system retrieves relevant sections from the document using vector embeddings and generates accurate, human-like answers using LLMs (Large Language Models).
- ๐ Upload any PDF and ask natural-language questions.
- ๐ง Combines retrieval-based search with generative AI for precise answers.
- ๐ Uses FAISS vector database for semantic search.
- ๐งฉ Built with LangChain, OpenAI embeddings, and FastAPI for modular, real-time interaction.
- ๐ฌ Supports both CLI and web API usage.
| Layer | Technology | Purpose |
|---|---|---|
| Frontend / Interface | Streamlit or FastAPI UI | File upload, question input |
| Backend Framework | FastAPI | Manages routes, queries, and response handling |
| Document Processing | PyPDF2 / LangChain | Extracts and chunks text from PDFs |
| Vector Storage | FAISS | Stores document embeddings for semantic retrieval |
| Embeddings Model | OpenAI text-embedding-ada-002 |
Converts document chunks into dense vectors |
| LLM for Generation | GPT-3.5 / GPT-4 (via OpenAI API) | Generates context-based answers |
| Pipeline Control | LangChain | Orchestrates retrieval + generation workflow |
๐ PDF Upload
โ
๐ Text Extraction โ Chunking โ Embedding Generation
โ
๐งฎ Embeddings stored in FAISS Vector DB
โ
โ User Question
โ
๐ Retrieve top relevant chunks (semantic search)
โ
๐ฌ Combine retrieved context + user query
โ
๐ค Generate final answer using OpenAI LLM
โ
๐ค Return answer to user