# govind252005/multimodal-rag architecture

> Architecture diagram of the GitHub repository govind252005/multimodal-rag, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/govind252005/multimodal-rag
- Repository: https://github.com/govind252005/multimodal-rag

## Overview

This is an enterprise multimodal RAG platform: users upload documents and ask questions through a web interface; the backend ingests content into searchable indexes, retrieves evidence, and generates cited answers. Its documented scope also includes multilingual retrieval, audio and image processing, document evidence viewing, tenant security, and disaster recovery. The graph combines README claims with the supplied source excerpts and index references; unsampled implementation details and some wiring are therefore left unconnected.

Main entry points: [`backend/main.py`](https://github.com/govind252005/multimodal-rag/blob/main/backend/main.py) (HTTP API), [`backend/ingestion/ingest.py`](https://github.com/govind252005/multimodal-rag/blob/main/backend/ingestion/ingest.py) (Ingestion coordinator), [`backend/retrieval/search.py`](https://github.com/govind252005/multimodal-rag/blob/main/backend/retrieval/search.py) (Hybrid retrieval), [`backend/retrieval/vector_store.py`](https://github.com/govind252005/multimodal-rag/blob/main/backend/retrieval/vector_store.py) (Vector collections)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_frontend["Web interface<br/>[App.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_evidence_viewer["Evidence viewer<br/>[DocumentViewer.tsx]"]
end

subgraph group_api["Backend and security"]
  node_backend["HTTP API<br/>[main.py]"]
  node_identity["Auth and sessions<br/>[auth.py]"]
  node_configuration["Runtime configuration<br/>[config.py]"]
end

subgraph group_ingest["Ingestion"]
  node_ingestion["Ingestion coordinator<br/>[ingest.py]"]
  node_image_processing["Image OCR and captions<br/>[image_pipeline.py]"]
  node_audio_processing["Audio transcription<br/>[audio_pipeline.py]"]
end

subgraph group_rag["Retrieval and generation"]
  node_embeddings["Multimodal embeddings<br/>[embeddings.py]"]
  node_vector_store[("Vector collections<br/>[vector_store.py]")]
  node_lexical_index[("Lexical index<br/>[lexical_index.py]")]
  node_search["Hybrid retrieval<br/>[search.py]"]
  node_answer["Grounded answer<br/>[answer.py]"]
  node_provider_router["Provider routing<br/>[router.py]"]
end

subgraph group_ops["Evaluation and recovery"]
  node_backup["Disaster recovery<br/>[backup_manager.py]"]
  node_eval_runner["Evaluation runner<br/>[run_eval.py]"]
  node_retrieval_metrics["Retrieval metrics"]
end

node_user(("User"))
node_ollama{{"Local Ollama"}}

node_user -->|"uses"| node_frontend
node_frontend -->|"calls"| node_api_client
node_api_client -->|"REST and SSE"| node_backend
node_frontend -->|"renders"| node_evidence_viewer
node_backend -->|"authenticates"| node_identity
node_backend -->|"submits uploads"| node_ingestion
node_ingestion -->|"processes images"| node_image_processing
node_ingestion -->|"processes audio"| node_audio_processing
node_ingestion -->|"creates vectors"| node_embeddings
node_ingestion -->|"stores records"| node_vector_store
node_image_processing -.->|"embeds content"| node_embeddings
node_vector_store -->|"updates index"| node_lexical_index
node_backend -->|"requests answers"| node_answer
node_answer -->|"retrieves evidence"| node_search
node_search -->|"encodes queries"| node_embeddings
node_search -->|"queries vectors"| node_vector_store
node_search -->|"searches terms"| node_lexical_index
node_answer -->|"generates response"| node_provider_router
node_provider_router -.->|"routes inference"| node_ollama
node_backend -.->|"uses settings"| node_configuration
node_backup -.->|"backs up collections"| node_vector_store
node_eval_runner -->|"evaluates retrieval"| node_retrieval_metrics

click node_frontend "https://github.com/govind252005/multimodal-rag/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/govind252005/multimodal-rag/blob/main/frontend/src/api.ts"
click node_evidence_viewer "https://github.com/govind252005/multimodal-rag/blob/main/frontend/src/components/DocumentViewer.tsx"
click node_backend "https://github.com/govind252005/multimodal-rag/blob/main/backend/main.py"
click node_identity "https://github.com/govind252005/multimodal-rag/blob/main/backend/auth.py"
click node_configuration "https://github.com/govind252005/multimodal-rag/blob/main/backend/config.py"
click node_ingestion "https://github.com/govind252005/multimodal-rag/blob/main/backend/ingestion/ingest.py"
click node_image_processing "https://github.com/govind252005/multimodal-rag/blob/main/backend/ingestion/image_pipeline.py"
click node_audio_processing "https://github.com/govind252005/multimodal-rag/blob/main/backend/ingestion/audio_pipeline.py"
click node_embeddings "https://github.com/govind252005/multimodal-rag/blob/main/backend/retrieval/embeddings.py"
click node_vector_store "https://github.com/govind252005/multimodal-rag/blob/main/backend/retrieval/vector_store.py"
click node_lexical_index "https://github.com/govind252005/multimodal-rag/blob/main/backend/retrieval/lexical_index.py"
click node_search "https://github.com/govind252005/multimodal-rag/blob/main/backend/retrieval/search.py"
click node_answer "https://github.com/govind252005/multimodal-rag/blob/main/backend/generation/answer.py"
click node_provider_router "https://github.com/govind252005/multimodal-rag/blob/main/backend/generation/providers/router.py"
click node_backup "https://github.com/govind252005/multimodal-rag/blob/main/backend/backup_manager.py"
click node_eval_runner "https://github.com/govind252005/multimodal-rag/blob/main/evaluation/runner/run_eval.py"
click node_retrieval_metrics "https://github.com/govind252005/multimodal-rag/blob/main/evaluation/metrics/retrieval_metrics.py"

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_frontend,node_api_client,node_evidence_viewer,node_user toneBlue
class node_backend,node_identity,node_configuration toneAmber
class node_ingestion,node_image_processing,node_audio_processing toneMint
class node_embeddings,node_vector_store,node_lexical_index,node_search,node_answer,node_provider_router toneRose
class node_backup,node_eval_runner,node_retrieval_metrics,node_ollama toneIndigo
```

## Components

### Web experience

- [Web interface](https://github.com/govind252005/multimodal-rag/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/govind252005/multimodal-rag/blob/main/frontend/src/api.ts): `frontend/src/api.ts`
- [Evidence viewer](https://github.com/govind252005/multimodal-rag/blob/main/frontend/src/components/DocumentViewer.tsx): `frontend/src/components/DocumentViewer.tsx`

### Backend and security

- [HTTP API](https://github.com/govind252005/multimodal-rag/blob/main/backend/main.py): `backend/main.py`
- [Auth and sessions](https://github.com/govind252005/multimodal-rag/blob/main/backend/auth.py): `backend/auth.py`
- [Runtime configuration](https://github.com/govind252005/multimodal-rag/blob/main/backend/config.py): `backend/config.py`

### Ingestion

- [Ingestion coordinator](https://github.com/govind252005/multimodal-rag/blob/main/backend/ingestion/ingest.py): `backend/ingestion/ingest.py`
- [Image OCR and captions](https://github.com/govind252005/multimodal-rag/blob/main/backend/ingestion/image_pipeline.py): `backend/ingestion/image_pipeline.py`
- [Audio transcription](https://github.com/govind252005/multimodal-rag/blob/main/backend/ingestion/audio_pipeline.py): `backend/ingestion/audio_pipeline.py`

### Retrieval and generation

- [Multimodal embeddings](https://github.com/govind252005/multimodal-rag/blob/main/backend/retrieval/embeddings.py): `backend/retrieval/embeddings.py`
- [Vector collections](https://github.com/govind252005/multimodal-rag/blob/main/backend/retrieval/vector_store.py): `backend/retrieval/vector_store.py`
- [Lexical index](https://github.com/govind252005/multimodal-rag/blob/main/backend/retrieval/lexical_index.py): `backend/retrieval/lexical_index.py`
- [Hybrid retrieval](https://github.com/govind252005/multimodal-rag/blob/main/backend/retrieval/search.py): `backend/retrieval/search.py`
- [Grounded answer](https://github.com/govind252005/multimodal-rag/blob/main/backend/generation/answer.py): `backend/generation/answer.py`
- [Provider routing](https://github.com/govind252005/multimodal-rag/blob/main/backend/generation/providers/router.py): `backend/generation/providers/router.py`

### Evaluation and recovery

- [Disaster recovery](https://github.com/govind252005/multimodal-rag/blob/main/backend/backup_manager.py): `backend/backup_manager.py`
- [Evaluation runner](https://github.com/govind252005/multimodal-rag/blob/main/evaluation/runner/run_eval.py): `evaluation/runner/run_eval.py`
- [Retrieval metrics](https://github.com/govind252005/multimodal-rag/blob/main/evaluation/metrics/retrieval_metrics.py): `evaluation/metrics/retrieval_metrics.py`

### Other components

- **User**
- **Local Ollama**

## Connections

- User → Web interface: uses (evidence: `README.md`)
- Web interface → API client: calls (evidence: `frontend/src/App.tsx`)
- API client → HTTP API: REST and SSE (evidence: `README.md`)
- Web interface → Evidence viewer: renders (evidence: `frontend/src/App.tsx`)
- HTTP API → Auth and sessions: authenticates (evidence: `backend/main.py`)
- HTTP API → Ingestion coordinator: submits uploads (evidence: `backend/main.py`)
- Ingestion coordinator → Image OCR and captions: processes images (evidence: `backend/ingestion/ingest.py`)
- Ingestion coordinator → Audio transcription: processes audio (evidence: `backend/ingestion/ingest.py`)
- Ingestion coordinator → Multimodal embeddings: creates vectors (evidence: `backend/ingestion/ingest.py`)
- Ingestion coordinator → Vector collections: stores records (evidence: `backend/ingestion/ingest.py`)
- Image OCR and captions → Multimodal embeddings: embeds content
- Vector collections → Lexical index: updates index (evidence: `backend/retrieval/vector_store.py`)
- HTTP API → Grounded answer: requests answers (evidence: `backend/main.py`)
- Grounded answer → Hybrid retrieval: retrieves evidence (evidence: `backend/generation/answer.py`)
- Hybrid retrieval → Multimodal embeddings: encodes queries (evidence: `backend/retrieval/search.py`)
- Hybrid retrieval → Vector collections: queries vectors (evidence: `backend/retrieval/search.py`)
- Hybrid retrieval → Lexical index: searches terms (evidence: `backend/retrieval/search.py`)
- Grounded answer → Provider routing: generates response (evidence: `backend/generation/answer.py`)
- Provider routing → Local Ollama: routes inference
- HTTP API → Runtime configuration: uses settings (evidence: `backend/main.py`)
- Disaster recovery → Vector collections: backs up collections
- Evaluation runner → Retrieval metrics: evaluates retrieval (evidence: `evaluation/runner/run_eval.py`)
