# optimal-cognitive-core/occ-rag architecture

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

- Interactive diagram: https://gitdiagram.com/optimal-cognitive-core/occ-rag
- Repository: https://github.com/optimal-cognitive-core/occ-rag

## Overview

OCC-RAG is a release of compact models for context-grounded question answering, not an implemented RAG pipeline in this repository. The documented workflow supplies a question and source documents, formats them with the model’s chat template, generates a structured response, and reads its answer or abstention. The README documents Transformers and vLLM usage; the examples are present in the tree but were not sampled, so implementation-level connections are limited to those documented relationships.

Main entry points: [`README.md`](https://github.com/optimal-cognitive-core/occ-rag/blob/main/README.md) (Structured prompt), [`examples/quickstart_transformers.py`](https://github.com/optimal-cognitive-core/occ-rag/blob/main/examples/quickstart_transformers.py) (Transformers quickstart), [`examples/quickstart_vllm.py`](https://github.com/optimal-cognitive-core/occ-rag/blob/main/examples/quickstart_vllm.py) (vLLM quickstart)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_format["Prompt and response format"]
  node_prompt["Structured prompt<br/>[README.md]"]
  node_response["Five-section response<br/>[README.md]"]
end

subgraph group_inference["Model inference examples"]
  node_transformers["Transformers quickstart"]
  node_vllm["vLLM quickstart<br/>[quickstart_vllm.py]"]
end

node_user(("Questioner"))
node_model["OCC-RAG models"]

node_user -->|"provides question and sources"| node_prompt
node_prompt -->|"formats model input"| node_model
node_model -->|"generates structured trace"| node_response
node_transformers -->|"loads and generates"| node_model
node_vllm -->|"serves inference"| node_model
node_response -->|"returns answer or abstention"| node_user

click node_prompt "https://github.com/optimal-cognitive-core/occ-rag/blob/main/README.md"
click node_transformers "https://github.com/optimal-cognitive-core/occ-rag/blob/main/examples/quickstart_transformers.py"
click node_vllm "https://github.com/optimal-cognitive-core/occ-rag/blob/main/examples/quickstart_vllm.py"
click node_response "https://github.com/optimal-cognitive-core/occ-rag/blob/main/README.md"

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_prompt,node_response toneBlue
class node_transformers,node_vllm toneAmber
class node_user,node_model toneIndigo
```

## Components

### Prompt and response format

- [Structured prompt](https://github.com/optimal-cognitive-core/occ-rag/blob/main/README.md): `README.md`
- [Five-section response](https://github.com/optimal-cognitive-core/occ-rag/blob/main/README.md): `README.md`

### Model inference examples

- [Transformers quickstart](https://github.com/optimal-cognitive-core/occ-rag/blob/main/examples/quickstart_transformers.py): `examples/quickstart_transformers.py`
- [vLLM quickstart](https://github.com/optimal-cognitive-core/occ-rag/blob/main/examples/quickstart_vllm.py): `examples/quickstart_vllm.py`

### Other components

- **Questioner**
- **OCC-RAG models**

## Connections

- Questioner → Structured prompt: provides question and sources (evidence: `README.md`)
- Structured prompt → OCC-RAG models: formats model input (evidence: `README.md`)
- OCC-RAG models → Five-section response: generates structured trace (evidence: `README.md`)
- Transformers quickstart → OCC-RAG models: loads and generates (evidence: `README.md`)
- vLLM quickstart → OCC-RAG models: serves inference (evidence: `README.md`)
- Five-section response → Questioner: returns answer or abstention (evidence: `README.md`)
