weiwill88/Local_Pdf_Chat_RAG
Transparent Python RAG reference with FAISS + BM25 hybrid retrieval, reranking, Gradio UI, and FastAPI.
What it solves
This project provides a transparent, modular Python implementation of a Retrieval-Augmented Generation (RAG) pipeline. It is designed as an educational tool for developers to learn, inspect, and experiment with how documents are processed and retrieved to provide context for LLMs, rather than being a production-ready service.
How it works
The system processes documents through a structured pipeline: parsing, chunking, and creating embeddings. It then employs a hybrid retrieval strategy, combining FAISS for dense retrieval and BM25 for keyword-based retrieval. Results can be further refined using an optional reranking step (via CrossEncoder or model-based scoring) before the final context is built and passed to an LLM for answer generation.
Who it’s for
Developers and students who want a reference implementation to understand the inner workings of RAG pipelines and those who wish to experiment with different model backends.
Highlights
- Hybrid Retrieval: Combines FAISS and BM25 to improve search accuracy.
- Modular Design: Core components (loader, splitter, embeddings, retriever, reranker, generator) are split into replaceable modules.
- Flexible Backends: Supports local Ollama, SiliconFlow, and OpenAI-compatible APIs.
- Broad Document Support: Handles PDF, TXT, Markdown, DOCX, XLS/XLSX, and PPTX files.
- Dual Interfaces: Includes both a Gradio web UI and a FastAPI REST API.
Related
- Project
- Project
- Project
- Project
- Project