# beejayc/dt_lennyrag_rebuild architecture

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

- Interactive diagram: https://gitdiagram.com/beejayc/dt_lennyrag_rebuild
- Repository: https://github.com/beejayc/dt_lennyrag_rebuild

## Overview

LennyHub is a transcript-search product: transcripts are indexed into vector and knowledge-graph representations, then users query them through a web UI or CLI and receive synthesized answers. The graph distinguishes the documented ingestion, retrieval, synthesis, and graph-exploration capabilities. Some retrieval and persistence internals are provided by RAG-Anything/LightRAG and are not shown in the excerpts, so their internal calls are not expanded.

Main entry points: [`query_worker.py`](https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/query_worker.py) (Query worker), [`setup_rag.py`](https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/setup_rag.py) (Index orchestrator), [`streamlit_app.py`](https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/streamlit_app.py) (Web application), [`query_rag.py`](https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/query_rag.py) (Query CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Transcript ingestion"]
  node_setup["Index orchestrator<br/>[setup_rag.py]"]
  node_rag["RAG framework"]
end

subgraph group_query["Question answering"]
  node_worker["Query worker<br/>[query_worker.py]"]
end

subgraph group_storage["Index and storage"]
  node_qdrant_config["Qdrant configuration<br/>[qdrant_config.py]"]
  node_vector_store[("Vector database")]
  node_graph_store[("Knowledge graph")]
end

subgraph group_interfaces["User interfaces"]
  node_streamlit["Web application<br/>[streamlit_app.py]"]
  node_cli["Query CLI<br/>[query_rag.py]"]
  node_sources_cli["Source-attribution CLI"]
  node_chunks_cli["Chunk-debug CLI"]
end

subgraph group_visualization["Graph exploration"]
  node_graph_export["Graph exporter<br/>[export_graph.py]"]
  node_graph_server["Graph explorer service<br/>[serve_graph.py]"]
end

node_user(("Questioner"))
node_transcripts["Podcast transcripts"]
node_azure["Azure OpenAI"]
node_answer["Answer and citations"]

node_setup -->|"reads files"| node_transcripts
node_setup -->|"indexes transcripts"| node_rag
node_setup -->|"checks and prepares"| node_qdrant_config
node_rag -.->|"stores vectors"| node_vector_store
node_rag -.->|"stores relationships"| node_graph_store
node_setup -->|"uses embeddings and model"| node_azure
node_user -->|"asks question"| node_streamlit
node_streamlit -->|"launches subprocess"| node_worker
node_worker -->|"runs query"| node_rag
node_worker -->|"loads working directory"| node_qdrant_config
node_worker -->|"uses embeddings and model"| node_azure
node_rag -.->|"retrieves relevant chunks"| node_vector_store
node_rag -.->|"retrieves graph context"| node_graph_store
node_rag -.->|"synthesizes answer"| node_azure
node_streamlit -->|"checks health and stats"| node_qdrant_config
node_worker -->|"returns result"| node_answer
node_user -->|"submits query"| node_cli
node_cli -->|"runs query"| node_rag
node_cli -->|"configures model and embeddings"| node_azure
node_user -->|"submits query"| node_sources_cli
node_sources_cli -->|"runs query"| node_rag
node_sources_cli -->|"configures model and embeddings"| node_azure
node_user -->|"submits query"| node_chunks_cli
node_chunks_cli -->|"runs query"| node_rag
node_chunks_cli -->|"configures model and embeddings"| node_azure
node_graph_store -->|"provides GraphML"| node_graph_export
node_graph_server -->|"uses exporter"| node_graph_export
node_graph_server -.->|"presents graph"| node_user

click node_setup "https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/setup_rag.py"
click node_qdrant_config "https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/qdrant_config.py"
click node_streamlit "https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/streamlit_app.py"
click node_worker "https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/query_worker.py"
click node_cli "https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/query_rag.py"
click node_sources_cli "https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/query_with_sources.py"
click node_chunks_cli "https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/query_rag_with_chunks.py"
click node_graph_export "https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/export_graph.py"
click node_graph_server "https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/serve_graph.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_setup,node_rag toneBlue
class node_worker toneAmber
class node_qdrant_config,node_vector_store,node_graph_store toneMint
class node_streamlit,node_cli,node_sources_cli,node_chunks_cli toneRose
class node_graph_export,node_graph_server,node_user,node_transcripts,node_azure,node_answer toneIndigo
```

## Components

### Transcript ingestion

- [Index orchestrator](https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/setup_rag.py): `setup_rag.py`
- **RAG framework**

### Question answering

- [Query worker](https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/query_worker.py): `query_worker.py`

### Index and storage

- [Qdrant configuration](https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/qdrant_config.py): `qdrant_config.py`
- **Vector database**
- **Knowledge graph**

### User interfaces

- [Web application](https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/streamlit_app.py): `streamlit_app.py`
- [Query CLI](https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/query_rag.py): `query_rag.py`
- [Source-attribution CLI](https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/query_with_sources.py): `query_with_sources.py`
- [Chunk-debug CLI](https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/query_rag_with_chunks.py): `query_rag_with_chunks.py`

### Graph exploration

- [Graph exporter](https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/export_graph.py): `export_graph.py`
- [Graph explorer service](https://github.com/beejayc/dt_lennyrag_rebuild/blob/main/serve_graph.py): `serve_graph.py`

### Other components

- **Questioner**
- **Podcast transcripts**
- **Azure OpenAI**
- **Answer and citations**

## Connections

- Index orchestrator → Podcast transcripts: reads files (evidence: `setup_rag.py`)
- Index orchestrator → RAG framework: indexes transcripts (evidence: `setup_rag.py`)
- Index orchestrator → Qdrant configuration: checks and prepares (evidence: `setup_rag.py`)
- RAG framework → Vector database: stores vectors (evidence: `README.md`)
- RAG framework → Knowledge graph: stores relationships (evidence: `README.md`)
- Index orchestrator → Azure OpenAI: uses embeddings and model (evidence: `setup_rag.py`)
- Questioner → Web application: asks question (evidence: `README.md`)
- Web application → Query worker: launches subprocess (evidence: `streamlit_app.py`)
- Query worker → RAG framework: runs query (evidence: `query_worker.py`)
- Query worker → Qdrant configuration: loads working directory (evidence: `query_worker.py`)
- Query worker → Azure OpenAI: uses embeddings and model (evidence: `query_worker.py`)
- RAG framework → Vector database: retrieves relevant chunks (evidence: `README.md`)
- RAG framework → Knowledge graph: retrieves graph context (evidence: `README.md`)
- RAG framework → Azure OpenAI: synthesizes answer (evidence: `README.md`)
- Web application → Qdrant configuration: checks health and stats (evidence: `streamlit_app.py`)
- Query worker → Answer and citations: returns result (evidence: `query_worker.py`)
- Questioner → Query CLI: submits query (evidence: `query_rag.py`)
- Query CLI → RAG framework: runs query (evidence: `query_rag.py`)
- Query CLI → Azure OpenAI: configures model and embeddings (evidence: `query_rag.py`)
- Questioner → Source-attribution CLI: submits query (evidence: `query_with_sources.py`)
- Source-attribution CLI → RAG framework: runs query (evidence: `query_with_sources.py`)
- Source-attribution CLI → Azure OpenAI: configures model and embeddings (evidence: `query_with_sources.py`)
- Questioner → Chunk-debug CLI: submits query (evidence: `query_rag_with_chunks.py`)
- Chunk-debug CLI → RAG framework: runs query (evidence: `query_rag_with_chunks.py`)
- Chunk-debug CLI → Azure OpenAI: configures model and embeddings (evidence: `query_rag_with_chunks.py`)
- Knowledge graph → Graph exporter: provides GraphML (evidence: `export_graph.py`)
- Graph explorer service → Graph exporter: uses exporter (evidence: `serve_graph.py`)
- Graph explorer service → Questioner: presents graph (evidence: `README.md`)
