# pranavkumarpk01/multimodal-rag architecture

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

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

## Overview

This repository implements a multimodal PDF question-answering system: PDFs are ingested into searchable text and image chunks, indexed in Qdrant, then retrieved to ground answers and optionally generate diagrams. The graph follows the documented API and ingestion/retrieval calls. Several internal details and UI wiring are unsampled, so uncertain connections are omitted; optional external model providers are shown separately.

Main entry points: [`app/llm.py`](https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/llm.py) (LLM and embeddings), [`api.py`](https://github.com/pranavkumarpk01/multimodal-rag/blob/main/api.py) (HTTP API), [`app/ingest.py`](https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/ingest.py) (PDF ingestion), [`app/answer.py`](https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/answer.py) (Answer composition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_api["HTTP API<br/>[api.py]"]
  node_ui["Web UI<br/>[ui.py]"]
end

subgraph group_ingestion["PDF ingestion"]
  node_pdf["PDF ingestion<br/>[ingest.py]"]
  node_vision["Image enrichment<br/>[enrich.py]"]
  node_records["Chunk schemas<br/>[models.py]"]
end

subgraph group_index["Search and storage"]
  node_qdrant[("Vector collection<br/>[store.py]")]
  node_hybrid["Hybrid retrieval<br/>[retrieve.py]"]
end

subgraph group_answers["Grounded responses"]
  node_answer["Answer composition<br/>[answer.py]"]
  node_intent["Diagram intent<br/>[diagram.py]"]
end

subgraph group_runtime["Shared runtime"]
  node_embed["LLM and embeddings<br/>[llm.py]"]
  node_settings["Configuration<br/>[config.py]"]
end

node_user(("Questioner"))
node_providers{{"Model providers"}}

node_user -->|"submits questions"| node_api
node_user -.->|"uses"| node_ui
node_api -->|"answers queries"| node_answer
node_api -->|"starts ingestion"| node_pdf
node_pdf -->|"enriches images"| node_vision
node_pdf -->|"creates chunks"| node_records
node_vision -->|"requests vision"| node_embed
node_pdf -->|"reads settings"| node_settings
node_answer -->|"retrieves context"| node_hybrid
node_answer -->|"checks diagram intent"| node_intent
node_answer -->|"generates response"| node_embed
node_intent -->|"generates diagrams"| node_embed
node_hybrid -->|"dense search"| node_qdrant
node_hybrid -->|"embeds query"| node_embed
node_qdrant -->|"embeds stored chunks"| node_embed
node_embed -->|"calls models"| node_providers
node_api -->|"reads settings"| node_settings

click node_api "https://github.com/pranavkumarpk01/multimodal-rag/blob/main/api.py"
click node_ui "https://github.com/pranavkumarpk01/multimodal-rag/blob/main/ui.py"
click node_pdf "https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/ingest.py"
click node_vision "https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/enrich.py"
click node_records "https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/models.py"
click node_embed "https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/llm.py"
click node_qdrant "https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/store.py"
click node_hybrid "https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/retrieve.py"
click node_answer "https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/answer.py"
click node_intent "https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/diagram.py"
click node_settings "https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/config.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_api,node_ui toneBlue
class node_pdf,node_vision,node_records toneAmber
class node_qdrant,node_hybrid toneMint
class node_answer,node_intent toneRose
class node_embed,node_settings,node_user,node_providers toneIndigo
```

## Components

### User interfaces

- [HTTP API](https://github.com/pranavkumarpk01/multimodal-rag/blob/main/api.py): `api.py`
- [Web UI](https://github.com/pranavkumarpk01/multimodal-rag/blob/main/ui.py): `ui.py`

### PDF ingestion

- [PDF ingestion](https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/ingest.py): `app/ingest.py`
- [Image enrichment](https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/enrich.py): `app/enrich.py`
- [Chunk schemas](https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/models.py): `app/models.py`

### Search and storage

- [Vector collection](https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/store.py): `app/store.py`
- [Hybrid retrieval](https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/retrieve.py): `app/retrieve.py`

### Grounded responses

- [Answer composition](https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/answer.py): `app/answer.py`
- [Diagram intent](https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/diagram.py): `app/diagram.py`

### Shared runtime

- [LLM and embeddings](https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/llm.py): `app/llm.py`
- [Configuration](https://github.com/pranavkumarpk01/multimodal-rag/blob/main/app/config.py): `app/config.py`

### Other components

- **Questioner**
- **Model providers**

## Connections

- Questioner → HTTP API: submits questions (evidence: `api.py`)
- Questioner → Web UI: uses
- HTTP API → Answer composition: answers queries (evidence: `api.py`)
- HTTP API → PDF ingestion: starts ingestion (evidence: `api.py`)
- PDF ingestion → Image enrichment: enriches images (evidence: `app/ingest.py`)
- PDF ingestion → Chunk schemas: creates chunks (evidence: `app/ingest.py`)
- Image enrichment → LLM and embeddings: requests vision (evidence: `app/enrich.py`)
- PDF ingestion → Configuration: reads settings (evidence: `app/ingest.py`)
- Answer composition → Hybrid retrieval: retrieves context (evidence: `app/answer.py`)
- Answer composition → Diagram intent: checks diagram intent (evidence: `app/answer.py`)
- Answer composition → LLM and embeddings: generates response (evidence: `app/answer.py`)
- Diagram intent → LLM and embeddings: generates diagrams (evidence: `app/diagram.py`)
- Hybrid retrieval → Vector collection: dense search (evidence: `app/retrieve.py`)
- Hybrid retrieval → LLM and embeddings: embeds query (evidence: `app/retrieve.py`)
- Vector collection → LLM and embeddings: embeds stored chunks (evidence: `app/store.py`)
- LLM and embeddings → Model providers: calls models (evidence: `app/llm.py`)
- HTTP API → Configuration: reads settings (evidence: `api.py`)
