# mr-asif003/minirag architecture

> Architecture diagram of the GitHub repository mr-asif003/minirag, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mr-asif003/minirag
- Repository: https://github.com/mr-asif003/minirag

## Overview

MiniRAG is a personal-information question-answering application. A user enters profile data in the Streamlit app, which saves it and initiates document loading, chunking, and vector-store creation. For questions, the app calls the RAG pipeline, which retrieves matching chunks, builds context, and requests an answer from a language model; the app displays the answer and retrieved context. Core ingestion and retrieval calls are visible in excerpts. The README documents model integrations and overall behavior, but some implementation details were not sampled.

Main entry points: [`app.py`](https://github.com/mr-asif003/minirag/blob/main/app.py) (Streamlit App), [`rag/vector_store.py`](https://github.com/mr-asif003/minirag/blob/main/rag/vector_store.py) (FAISS Store Access), [`rag/rag_pipeline.py`](https://github.com/mr-asif003/minirag/blob/main/rag/rag_pipeline.py) (RAG Orchestrator), [`rag/loader.py`](https://github.com/mr-asif003/minirag/blob/main/rag/loader.py) (Document Loading)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_app["Streamlit App<br/>[app.py]"]
end

subgraph group_ingestion["Information Ingestion"]
  node_data_manager["Profile Saving<br/>[data_manager.py]"]
  node_loader["Document Loading<br/>[loader.py]"]
  node_splitter["Text Chunking<br/>[splitter.py]"]
end

subgraph group_rag["RAG Processing"]
  node_pipeline["RAG Orchestrator<br/>[rag_pipeline.py]"]
  node_retriever["Similarity Retrieval<br/>[retriever.py]"]
  node_generator["Answer Generation<br/>[generator.py]"]
end

subgraph group_storage["Vector Storage"]
  node_embeddings["Embedding Model<br/>[embeddings.py]"]
  node_vector_store["FAISS Store Access<br/>[vector_store.py]"]
  node_vector_assets[("FAISS Index")]
  node_profile_file["User Profiles<br/>[users.json]"]
end

node_user(("User"))
node_huggingface{{"Hugging Face"}}

node_user -->|"enters data"| node_app
node_user -->|"asks question"| node_app
node_app -->|"saves profile"| node_data_manager
node_app -->|"loads documents"| node_loader
node_app -->|"splits documents"| node_splitter
node_app -->|"creates store"| node_vector_store
node_loader -->|"reads profiles"| node_profile_file
node_vector_store -->|"gets embeddings"| node_embeddings
node_vector_store -->|"saves or loads"| node_vector_assets
node_app -->|"asks RAG"| node_pipeline
node_pipeline -->|"retrieves documents"| node_retriever
node_pipeline -->|"generates answer"| node_generator
node_retriever -->|"searches vectors"| node_vector_store
node_generator -.->|"uses model"| node_huggingface
node_embeddings -.->|"uses models"| node_huggingface
node_app -->|"shows answer"| node_user

click node_app "https://github.com/mr-asif003/minirag/blob/main/app.py"
click node_data_manager "https://github.com/mr-asif003/minirag/blob/main/rag/data_manager.py"
click node_loader "https://github.com/mr-asif003/minirag/blob/main/rag/loader.py"
click node_splitter "https://github.com/mr-asif003/minirag/blob/main/rag/splitter.py"
click node_pipeline "https://github.com/mr-asif003/minirag/blob/main/rag/rag_pipeline.py"
click node_retriever "https://github.com/mr-asif003/minirag/blob/main/rag/retriever.py"
click node_generator "https://github.com/mr-asif003/minirag/blob/main/rag/generator.py"
click node_embeddings "https://github.com/mr-asif003/minirag/blob/main/rag/embeddings.py"
click node_vector_store "https://github.com/mr-asif003/minirag/blob/main/rag/vector_store.py"
click node_vector_assets "https://github.com/mr-asif003/minirag/tree/main/vectorstore"
click node_profile_file "https://github.com/mr-asif003/minirag/blob/main/users.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_user toneBlue
class node_data_manager,node_loader,node_splitter toneAmber
class node_pipeline,node_retriever,node_generator toneMint
class node_embeddings,node_vector_store,node_vector_assets,node_profile_file toneRose
class node_huggingface toneIndigo
```

## Components

### User Interface

- [Streamlit App](https://github.com/mr-asif003/minirag/blob/main/app.py): `app.py`

### Information Ingestion

- [Profile Saving](https://github.com/mr-asif003/minirag/blob/main/rag/data_manager.py): `rag/data_manager.py`
- [Document Loading](https://github.com/mr-asif003/minirag/blob/main/rag/loader.py): `rag/loader.py`
- [Text Chunking](https://github.com/mr-asif003/minirag/blob/main/rag/splitter.py): `rag/splitter.py`

### RAG Processing

- [RAG Orchestrator](https://github.com/mr-asif003/minirag/blob/main/rag/rag_pipeline.py): `rag/rag_pipeline.py`
- [Similarity Retrieval](https://github.com/mr-asif003/minirag/blob/main/rag/retriever.py): `rag/retriever.py`
- [Answer Generation](https://github.com/mr-asif003/minirag/blob/main/rag/generator.py): `rag/generator.py`

### Vector Storage

- [Embedding Model](https://github.com/mr-asif003/minirag/blob/main/rag/embeddings.py): `rag/embeddings.py`
- [FAISS Store Access](https://github.com/mr-asif003/minirag/blob/main/rag/vector_store.py): `rag/vector_store.py`
- [FAISS Index](https://github.com/mr-asif003/minirag/tree/main/vectorstore): `vectorstore`
- [User Profiles](https://github.com/mr-asif003/minirag/blob/main/users.json): `users.json`

### Other components

- **User**
- **Hugging Face**

## Connections

- User → Streamlit App: enters data (evidence: `README.md`)
- User → Streamlit App: asks question (evidence: `README.md`)
- Streamlit App → Profile Saving: saves profile (evidence: `app.py`)
- Streamlit App → Document Loading: loads documents (evidence: `app.py`)
- Streamlit App → Text Chunking: splits documents (evidence: `app.py`)
- Streamlit App → FAISS Store Access: creates store (evidence: `app.py`)
- Document Loading → User Profiles: reads profiles (evidence: `rag/loader.py`)
- FAISS Store Access → Embedding Model: gets embeddings (evidence: `rag/vector_store.py`)
- FAISS Store Access → FAISS Index: saves or loads (evidence: `rag/vector_store.py`)
- Streamlit App → RAG Orchestrator: asks RAG (evidence: `app.py`)
- RAG Orchestrator → Similarity Retrieval: retrieves documents (evidence: `rag/rag_pipeline.py`)
- RAG Orchestrator → Answer Generation: generates answer (evidence: `rag/rag_pipeline.py`)
- Similarity Retrieval → FAISS Store Access: searches vectors (evidence: `rag/retriever.py`)
- Answer Generation → Hugging Face: uses model (evidence: `README.md`)
- Embedding Model → Hugging Face: uses models (evidence: `README.md`)
- Streamlit App → User: shows answer (evidence: `README.md`)
