An open-source, fully offline Retrieval-Augmented Generation (RAG) system ## π To-Do List
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
Designed & Developed by VRS Foundation (Vijay R. Shinde)
For questions or support, please open an issue on GitHub.hout internet**, without APIs, and supports any subject β driven by uploaded documents or a master knowledge base.
Built with:
MiniLM or BGE with FAISSFile Upload -> Text Chunking -> Sentence Embedding -> FAISS Vector Store -> Top-k Retrieval -> Prompt Builder -> llama.cpp (LLaMA / Mistral GGUF) -> Final Answer
ββββββββββββββββββββββββββββββ
β User / Admin β
ββββββββββββββ¬ββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββ
β π Frontend (Flask UI) β
β HTML/CSS/JS + AJAX + Jinjaβ
ββββββββββββββ¬ββββββββββββββββ
β
ββββββββββββββββββββββΌβββββββββββββββββββββ
β Flask Web Server β
β (routes.py + API) β
ββββββ¬βββββββββββββββββββββββββββββββ¬ββββββ
β β
ββββββββββββββββββΌβββ ββββββββββββββββΌβββββββββββββββ
β π embedder.py β β rag.py (Query Engine) β
β - Chunking logic β β - Embeds question β
β - Embeddings β β - FAISS top-k retrieval β
ββββββ¬βββββββββββββββ ββββββββββββββββ¬βββββββββββββββ
β β
βββββββββββββββΌββββββββββββββ ββββββββββββββΌββββββββββββββ
β π FAISS Vector Store β β π§ llm.py (LLM Prompting)β
β - User Index (session) β β - prompt construction β
β - Master KB (fallback) β β - llama-cpp-python call β
βββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββ
β²
β
ββββββββββββββββββΌββββββββββββββββ
β π¦ Local LLM Runtime Engine β
β (llama-cpp-python / GGUF) β
β Quantized Mistral / LLaMA β
βββββββββββββββββββββββββββββββββββ
offline-rag/
βββ app/
β βββ routes.py # Flask route handling
β βββ embedder.py # Chunking + Embedding logic
β βββ vector_store.py # FAISS vector store manager
β βββ rag.py # Retrieval + LLM answering
β βββ llm.py # llama-cpp wrapper
β βββ file_utils.py # Helper functions
β
βββ frontend/
β βββ templates/ # HTML templates (index, admin, intro)
β βββ static/
β βββ css/ # Dark UI styling
β βββ js/ # AJAX & animation logic
β βββ images/ # UI assets
β
βββ data/ # Stored embeddings + user/master files
βββ models/ # GGUF LLM model (LLaMA/Mistral)
βββ README.md
βββ requirements.txt
βββ run.py # Entry point
β οΈ Works best on Linux or Windows with Python 3.10+
git clone https://github.com/vijay-shinde/offline-rag.git
cd offline-rag
Create virtual env + install dependencies
```bash
# Create virtual environment
python -m venv envGenAI
source envGenAI/bin/activate # Linux/Mac
# or
envGenAI\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
Download LLM Model
models/ directoryRun the Application
python run.py
Visit http://localhost:5000 in your browser
Upload newton_laws_summary.pdf via Admin panel. Ask: βWhat does Newtonβs Second Law explain?β
β‘οΈ The system retrieves from master KB and responds using the local LLM.
π Research Summary Inspired by: βAttention is All You Needβ, Vaswani et al. (2017)
Embedding: Sentence-BERT (MiniLM-L6-v2 or BGE-Small)
Vector Search: FAISS (Facebook AI)
LLM: LLaMA 2 / Mistral via llama-cpp-python (GGUF format)
π Full whitepaper: Offline_RAG_IEEE_Paper.pdf
π‘οΈ Use Cases Education (offline Q&A)
Secure Enterprises
Remote research labs
Edge AI / Dev sandboxes
π€ Contribution PRs welcome! Feel free to fork, suggest improvements, or extend it for other domains.
π License MIT License
Designed & Developed by [VRS Foundation (Vijay R. Shinde)]
markdown Copy Edit
An open-source, fully offline Retrieval-Augmented Generation (RAG) system ## π To-Do List
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
Designed & Developed by VRS Foundation (Vijay R. Shinde)
For questions or support, please open an issue on GitHub.hout internet**, without APIs, and supports any subject β driven by uploaded documents or a master knowledge base.
Built with:
MiniLM or BGE with FAISSFile Upload -> Text Chunking -> Sentence Embedding -> FAISS Vector Store -> Top-k Retrieval -> Prompt Builder -> llama.cpp (LLaMA / Mistral GGUF) -> Final Answer
ββββββββββββββββββββββββββββββ
β User / Admin β
ββββββββββββββ¬ββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββ
β π Frontend (Flask UI) β
β HTML/CSS/JS + AJAX + Jinjaβ
ββββββββββββββ¬ββββββββββββββββ
β
ββββββββββββββββββββββΌβββββββββββββββββββββ
β Flask Web Server β
β (routes.py + API) β
ββββββ¬βββββββββββββββββββββββββββββββ¬ββββββ
β β
ββββββββββββββββββΌβββ ββββββββββββββββΌβββββββββββββββ
β π embedder.py β β rag.py (Query Engine) β
β - Chunking logic β β - Embeds question β
β - Embeddings β β - FAISS top-k retrieval β
ββββββ¬βββββββββββββββ ββββββββββββββββ¬βββββββββββββββ
β β
βββββββββββββββΌββββββββββββββ ββββββββββββββΌββββββββββββββ
β π FAISS Vector Store β β π§ llm.py (LLM Prompting)β
β - User Index (session) β β - prompt construction β
β - Master KB (fallback) β β - llama-cpp-python call β
βββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββ
β²
β
ββββββββββββββββββΌββββββββββββββββ
β π¦ Local LLM Runtime Engine β
β (llama-cpp-python / GGUF) β
β Quantized Mistral / LLaMA β
βββββββββββββββββββββββββββββββββββ
offline-rag/
βββ app/
β βββ routes.py # Flask route handling
β βββ embedder.py # Chunking + Embedding logic
β βββ vector_store.py # FAISS vector store manager
β βββ rag.py # Retrieval + LLM answering
β βββ llm.py # llama-cpp wrapper
β βββ file_utils.py # Helper functions
β
βββ frontend/
β βββ templates/ # HTML templates (index, admin, intro)
β βββ static/
β βββ css/ # Dark UI styling
β βββ js/ # AJAX & animation logic
β βββ images/ # UI assets
β
βββ data/ # Stored embeddings + user/master files
βββ models/ # GGUF LLM model (LLaMA/Mistral)
βββ README.md
βββ requirements.txt
βββ run.py # Entry point
β οΈ Works best on Linux or Windows with Python 3.10+
git clone https://github.com/vijay-shinde/offline-rag.git
cd offline-rag
Create virtual env + install dependencies
```bash
# Create virtual environment
python -m venv envGenAI
source envGenAI/bin/activate # Linux/Mac
# or
envGenAI\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
Download LLM Model
models/ directoryRun the Application
python run.py
Visit http://localhost:5000 in your browser
Upload newton_laws_summary.pdf via Admin panel. Ask: βWhat does Newtonβs Second Law explain?β
β‘οΈ The system retrieves from master KB and responds using the local LLM.
π Research Summary Inspired by: βAttention is All You Needβ, Vaswani et al. (2017)
Embedding: Sentence-BERT (MiniLM-L6-v2 or BGE-Small)
Vector Search: FAISS (Facebook AI)
LLM: LLaMA 2 / Mistral via llama-cpp-python (GGUF format)
π Full whitepaper: Offline_RAG_IEEE_Paper.pdf
π‘οΈ Use Cases Education (offline Q&A)
Secure Enterprises
Remote research labs
Edge AI / Dev sandboxes
π€ Contribution PRs welcome! Feel free to fork, suggest improvements, or extend it for other domains.
π License MIT License
Designed & Developed by [VRS Foundation (Vijay R. Shinde)]
markdown Copy Edit