# baiiraam/ml_project_task_1 architecture

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

- Interactive diagram: https://gitdiagram.com/baiiraam/ml_project_task_1
- Repository: https://github.com/baiiraam/ml_project_task_1

## Overview

This repository demonstrates a local Haystack RAG application backed by Qdrant and Ollama, with Kubernetes (Kind) hosting the services and HAProxy exposing Ollama on localhost. The workflow loads the Seven Wonders dataset, embeds and indexes its documents, then embeds each question, retrieves context, builds a prompt, and generates an answer. Deployment and network relationships are documented in the README; runtime component wiring is visible in rag_demo.py. Other deployment details are represented only where the README identifies them.

Main entry points: [`rag_demo.py`](https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py) (RAG demo), [`qdrant.yaml`](https://github.com/baiiraam/ml_project_task_1/blob/main/qdrant.yaml) (Qdrant store), [`kind-config.yaml`](https://github.com/baiiraam/ml_project_task_1/blob/main/kind-config.yaml) (Kind cluster), [`haproxy/haproxy.cfg`](https://github.com/baiiraam/ml_project_task_1/blob/main/haproxy/haproxy.cfg) (HAProxy proxy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["RAG application"]
  node_rag["RAG demo<br/>[rag_demo.py]"]
  node_dataset["Seven Wonders data<br/>[rag_demo.py]"]
  node_indexing["Document indexing<br/>[rag_demo.py]"]
  node_doc_embed["Document embedder<br/>[rag_demo.py]"]
  node_writer["Qdrant writer<br/>[rag_demo.py]"]
  node_query_embed["Question embedder<br/>[rag_demo.py]"]
  node_retriever["Vector retriever<br/>[rag_demo.py]"]
  node_prompt["Prompt builder<br/>[rag_demo.py]"]
  node_generator["Ollama generator<br/>[rag_demo.py]"]
end

subgraph group_services["Cluster services"]
  node_qdrant[("Qdrant store<br/>[qdrant.yaml]")]
  node_ollama["Ollama service<br/>[ollama.yaml]"]
end

subgraph group_network["Local access"]
  node_haproxy["HAProxy proxy<br/>[haproxy.cfg]"]
end

subgraph group_deployment["Cluster deployment"]
  node_kind["Kind cluster<br/>[kind-config.yaml]"]
end

node_user(("Questioner"))
node_huggingface["Hugging Face"]

node_user -->|"runs queries"| node_rag
node_huggingface -->|"provides dataset"| node_dataset
node_rag -->|"runs indexing"| node_indexing
node_dataset -->|"supplies documents"| node_indexing
node_indexing -->|"runs embedder"| node_doc_embed
node_indexing -->|"runs writer"| node_writer
node_doc_embed -->|"passes documents"| node_writer
node_writer -->|"writes vectors"| node_qdrant
node_rag -->|"runs query pipeline"| node_query_embed
node_query_embed -->|"passes embedding"| node_retriever
node_retriever -->|"retrieves vectors"| node_qdrant
node_retriever -->|"passes documents"| node_prompt
node_prompt -->|"passes prompt"| node_generator
node_generator -->|"sends generation request"| node_haproxy
node_haproxy -->|"proxies requests"| node_ollama
node_kind -->|"hosts service"| node_qdrant
node_kind -->|"hosts service"| node_ollama
node_rag -->|"connects via port-forward"| node_qdrant

click node_rag "https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py"
click node_dataset "https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py"
click node_indexing "https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py"
click node_doc_embed "https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py"
click node_writer "https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py"
click node_query_embed "https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py"
click node_retriever "https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py"
click node_prompt "https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py"
click node_generator "https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py"
click node_qdrant "https://github.com/baiiraam/ml_project_task_1/blob/main/qdrant.yaml"
click node_ollama "https://github.com/baiiraam/ml_project_task_1/blob/main/ollama.yaml"
click node_haproxy "https://github.com/baiiraam/ml_project_task_1/blob/main/haproxy/haproxy.cfg"
click node_kind "https://github.com/baiiraam/ml_project_task_1/blob/main/kind-config.yaml"

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_rag,node_dataset,node_indexing,node_doc_embed,node_writer,node_query_embed,node_retriever,node_prompt,node_generator toneBlue
class node_qdrant,node_ollama toneAmber
class node_haproxy toneMint
class node_kind toneRose
class node_user,node_huggingface toneIndigo
```

## Components

### RAG application

- [RAG demo](https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py): `rag_demo.py`
- [Seven Wonders data](https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py): `rag_demo.py`
- [Document indexing](https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py): `rag_demo.py`
- [Document embedder](https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py): `rag_demo.py`
- [Qdrant writer](https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py): `rag_demo.py`
- [Question embedder](https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py): `rag_demo.py`
- [Vector retriever](https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py): `rag_demo.py`
- [Prompt builder](https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py): `rag_demo.py`
- [Ollama generator](https://github.com/baiiraam/ml_project_task_1/blob/main/rag_demo.py): `rag_demo.py`

### Cluster services

- [Qdrant store](https://github.com/baiiraam/ml_project_task_1/blob/main/qdrant.yaml): `qdrant.yaml`
- [Ollama service](https://github.com/baiiraam/ml_project_task_1/blob/main/ollama.yaml): `ollama.yaml`

### Local access

- [HAProxy proxy](https://github.com/baiiraam/ml_project_task_1/blob/main/haproxy/haproxy.cfg): `haproxy/haproxy.cfg`

### Cluster deployment

- [Kind cluster](https://github.com/baiiraam/ml_project_task_1/blob/main/kind-config.yaml): `kind-config.yaml`

### Other components

- **Questioner**
- **Hugging Face**

## Connections

- Questioner → RAG demo: runs queries (evidence: `README.md`)
- Hugging Face → Seven Wonders data: provides dataset (evidence: `rag_demo.py`)
- RAG demo → Document indexing: runs indexing (evidence: `rag_demo.py`)
- Seven Wonders data → Document indexing: supplies documents (evidence: `rag_demo.py`)
- Document indexing → Document embedder: runs embedder (evidence: `rag_demo.py`)
- Document indexing → Qdrant writer: runs writer (evidence: `rag_demo.py`)
- Document embedder → Qdrant writer: passes documents (evidence: `rag_demo.py`)
- Qdrant writer → Qdrant store: writes vectors (evidence: `rag_demo.py`)
- RAG demo → Question embedder: runs query pipeline (evidence: `rag_demo.py`)
- Question embedder → Vector retriever: passes embedding (evidence: `rag_demo.py`)
- Vector retriever → Qdrant store: retrieves vectors (evidence: `rag_demo.py`)
- Vector retriever → Prompt builder: passes documents (evidence: `rag_demo.py`)
- Prompt builder → Ollama generator: passes prompt (evidence: `rag_demo.py`)
- Ollama generator → HAProxy proxy: sends generation request (evidence: `rag_demo.py`)
- HAProxy proxy → Ollama service: proxies requests (evidence: `README.md`)
- Kind cluster → Qdrant store: hosts service (evidence: `README.md`)
- Kind cluster → Ollama service: hosts service (evidence: `README.md`)
- RAG demo → Qdrant store: connects via port-forward (evidence: `README.md`)
