# bwanab/rag_ollama architecture

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

- Interactive diagram: https://gitdiagram.com/bwanab/rag_ollama
- Repository: https://github.com/bwanab/rag_ollama

## Overview

This small example builds a local RAG question-answering loop. On startup, it either loads an existing Chroma collection or reads the sample text, embeds it, and creates an index; it then accepts questions and prints answers. The README also identifies Ollama as the local model runtime and Chroma as the vector database. The graph shows calls and data flow visible in starter.py; retrieval internals of LlamaIndex are not shown, so those relationships are omitted.

Main entry points: [`starter.py`](https://github.com/bwanab/rag_ollama/blob/main/starter.py) (RAG CLI), [`cd_data/cd_post.txt`](https://github.com/bwanab/rag_ollama/blob/main/cd_data/cd_post.txt) (Review Text)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_app["RAG CLI<br/>[starter.py]"]
end

subgraph group_rag["RAG Components"]
  node_reader["Directory Reader<br/>[starter.py]"]
  node_index["Vector Index<br/>[starter.py]"]
  node_query["Query Engine<br/>[starter.py]"]
  node_embedding["Ollama Embeddings<br/>[starter.py]"]
  node_llm["Ollama LLM<br/>[starter.py]"]
end

subgraph group_storage["Local Data"]
  node_source["Review Text<br/>[cd_post.txt]"]
  node_chroma[("Chroma Collection<br/>[starter.py]")]
end

node_user(("Questioner"))
node_ollama["Ollama Runtime"]

node_user -->|"enters question"| node_app
node_app -->|"loads documents"| node_reader
node_source -->|"provides text"| node_reader
node_app -->|"builds or loads"| node_index
node_app -->|"configures"| node_embedding
node_app -->|"opens or creates"| node_chroma
node_app -->|"creates"| node_query
node_index -->|"creates engine"| node_query
node_app -->|"submits question"| node_query
node_app -->|"prints answer"| node_user
node_ollama -->|"serves locally"| node_embedding
node_ollama -->|"serves locally"| node_llm

click node_app "https://github.com/bwanab/rag_ollama/blob/main/starter.py"
click node_reader "https://github.com/bwanab/rag_ollama/blob/main/starter.py"
click node_index "https://github.com/bwanab/rag_ollama/blob/main/starter.py"
click node_query "https://github.com/bwanab/rag_ollama/blob/main/starter.py"
click node_embedding "https://github.com/bwanab/rag_ollama/blob/main/starter.py"
click node_llm "https://github.com/bwanab/rag_ollama/blob/main/starter.py"
click node_source "https://github.com/bwanab/rag_ollama/blob/main/cd_data/cd_post.txt"
click node_chroma "https://github.com/bwanab/rag_ollama/blob/main/starter.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_app toneBlue
class node_reader,node_index,node_query,node_embedding,node_llm toneAmber
class node_source,node_chroma toneMint
class node_user,node_ollama toneIndigo
```

## Components

### Application

- [RAG CLI](https://github.com/bwanab/rag_ollama/blob/main/starter.py): `starter.py`

### RAG Components

- [Directory Reader](https://github.com/bwanab/rag_ollama/blob/main/starter.py): `starter.py`
- [Vector Index](https://github.com/bwanab/rag_ollama/blob/main/starter.py): `starter.py`
- [Query Engine](https://github.com/bwanab/rag_ollama/blob/main/starter.py): `starter.py`
- [Ollama Embeddings](https://github.com/bwanab/rag_ollama/blob/main/starter.py): `starter.py`
- [Ollama LLM](https://github.com/bwanab/rag_ollama/blob/main/starter.py): `starter.py`

### Local Data

- [Review Text](https://github.com/bwanab/rag_ollama/blob/main/cd_data/cd_post.txt): `cd_data/cd_post.txt`
- [Chroma Collection](https://github.com/bwanab/rag_ollama/blob/main/starter.py): `starter.py`

### Other components

- **Questioner**
- **Ollama Runtime**

## Connections

- Questioner → RAG CLI: enters question (evidence: `README.md`)
- RAG CLI → Directory Reader: loads documents (evidence: `starter.py`)
- Review Text → Directory Reader: provides text (evidence: `starter.py`)
- RAG CLI → Vector Index: builds or loads (evidence: `starter.py`)
- RAG CLI → Ollama Embeddings: configures (evidence: `starter.py`)
- RAG CLI → Chroma Collection: opens or creates (evidence: `starter.py`)
- RAG CLI → Query Engine: creates (evidence: `starter.py`)
- Vector Index → Query Engine: creates engine (evidence: `starter.py`)
- RAG CLI → Query Engine: submits question (evidence: `starter.py`)
- RAG CLI → Questioner: prints answer (evidence: `starter.py`)
- Ollama Runtime → Ollama Embeddings: serves locally (evidence: `README.md`)
- Ollama Runtime → Ollama LLM: serves locally (evidence: `README.md`)
