# plishh/relt-graphrag architecture

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

- Interactive diagram: https://gitdiagram.com/plishh/relt-graphrag
- Repository: https://github.com/plishh/relt-graphrag

## Overview

GraphRAG transforms unstructured private text into structured graph-based context for question answering. The principal workflow loads documents, builds and enriches an index, then uses query APIs to retrieve context and generate answers; incremental indexing and prompt tuning are additional capabilities. The sampled pipeline runner shows storage, cache, and workflow orchestration, while README and the tree establish broader product stages. Several indexing-stage links are dashed because their runtime wiring was not sampled.

Main entry points: [`packages/graphrag/graphrag/index/run/run_pipeline.py`](https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag/graphrag/index/run/run_pipeline.py) (Pipeline runner), [`packages/graphrag-llm/graphrag_llm`](https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag-llm/graphrag_llm) (LLM runtime), [`packages/graphrag/graphrag/cli/main.py`](https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag/graphrag/cli/main.py) (CLI commands), [`packages/graphrag/graphrag/index/operations/extract_graph`](https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag/graphrag/index/operations/extract_graph) (Graph extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_cli["CLI commands<br/>[main.py]"]
  node_api["Public APIs<br/>[index.py]"]
  node_prompt_tune["Prompt tuning"]
end

subgraph group_indexing["Index construction"]
  node_input["Document readers"]
  node_chunking["Text chunking"]
  node_extract["Graph extraction"]
  node_covariates["Claim extraction"]
  node_communities["Community detection<br/>[cluster_graph.py]"]
  node_reports["Community reports"]
  node_embeddings["Text embeddings"]
  node_incremental["Incremental indexing"]
  node_runner["Pipeline runner<br/>[run_pipeline.py]"]
end

subgraph group_query["Question answering"]
  node_query_api["Query API<br/>[query.py]"]
  node_query_modes["Search strategies"]
  node_vector["Vector stores"]
end

subgraph group_services["Runtime services"]
  node_storage[("Storage backends")]
  node_tables[("Table providers")]
  node_cache[("Cache backends<br/>[cache.py]")]
  node_llm["LLM runtime"]
  node_templating["Template engine"]
end

node_user(("User"))
node_external_llm{{"LLM provider"}}
node_answer["Search result"]

node_user -->|"runs commands"| node_cli
node_cli -->|"dispatches to"| node_api
node_user -.->|"submits query"| node_api
node_user -.->|"tunes prompts"| node_prompt_tune
node_api -.->|"starts indexing"| node_runner
node_runner -->|"creates and reads"| node_storage
node_runner -->|"creates providers"| node_tables
node_runner -->|"creates cache"| node_cache
node_runner -.->|"runs workflows"| node_input
node_input -.->|"provides documents"| node_chunking
node_chunking -.->|"provides text units"| node_extract
node_extract -.->|"extracts claims"| node_covariates
node_extract -.->|"builds graph"| node_communities
node_communities -.->|"summarizes groups"| node_reports
node_runner -.->|"runs workflow"| node_embeddings
node_runner -.->|"supports updates"| node_incremental
node_cli -->|"dispatches queries"| node_query_api
node_query_api -->|"selects search"| node_query_modes
node_query_api -->|"returns result"| node_answer
node_query_modes -.->|"uses vector search"| node_vector
node_query_modes -.->|"generates response"| node_llm
node_llm -.->|"calls provider"| node_external_llm
node_llm -->|"caches calls"| node_cache
node_llm -.->|"uses templates"| node_templating

click node_cli "https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag/graphrag/cli/main.py"
click node_api "https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag/graphrag/api/index.py"
click node_prompt_tune "https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag/graphrag/prompt_tune"
click node_input "https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag-input/graphrag_input"
click node_chunking "https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag-chunking/graphrag_chunking"
click node_extract "https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag/graphrag/index/operations/extract_graph"
click node_covariates "https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag/graphrag/index/operations/extract_covariates"
click node_communities "https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag/graphrag/index/operations/cluster_graph.py"
click node_reports "https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag/graphrag/index/operations/summarize_communities"
click node_embeddings "https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag/graphrag/index/operations/embed_text"
click node_incremental "https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag/graphrag/index/update/incremental_index.py"
click node_runner "https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag/graphrag/index/run/run_pipeline.py"
click node_query_api "https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag/graphrag/api/query.py"
click node_query_modes "https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag/graphrag/query"
click node_vector "https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag-vectors/graphrag_vectors"
click node_storage "https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag-storage/graphrag_storage"
click node_tables "https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag-storage/graphrag_storage/tables/table_provider_factory.py"
click node_cache "https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag-cache/graphrag_cache/cache.py"
click node_llm "https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag-llm/graphrag_llm"
click node_templating "https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag-llm/graphrag_llm/templating/template_engine_factory.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_cli,node_api,node_prompt_tune,node_user toneBlue
class node_input,node_chunking,node_extract,node_covariates,node_communities,node_reports,node_embeddings,node_incremental,node_runner toneAmber
class node_query_api,node_query_modes,node_vector toneMint
class node_storage,node_tables,node_cache,node_llm,node_templating toneRose
class node_external_llm,node_answer toneIndigo
```

## Components

### User entry points

- [CLI commands](https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag/graphrag/cli/main.py): `packages/graphrag/graphrag/cli/main.py`
- [Public APIs](https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag/graphrag/api/index.py): `packages/graphrag/graphrag/api/index.py`
- [Prompt tuning](https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag/graphrag/prompt_tune): `packages/graphrag/graphrag/prompt_tune`

### Index construction

- [Document readers](https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag-input/graphrag_input): `packages/graphrag-input/graphrag_input`
- [Text chunking](https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag-chunking/graphrag_chunking): `packages/graphrag-chunking/graphrag_chunking`
- [Graph extraction](https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag/graphrag/index/operations/extract_graph): `packages/graphrag/graphrag/index/operations/extract_graph`
- [Claim extraction](https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag/graphrag/index/operations/extract_covariates): `packages/graphrag/graphrag/index/operations/extract_covariates`
- [Community detection](https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag/graphrag/index/operations/cluster_graph.py): `packages/graphrag/graphrag/index/operations/cluster_graph.py`
- [Community reports](https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag/graphrag/index/operations/summarize_communities): `packages/graphrag/graphrag/index/operations/summarize_communities`
- [Text embeddings](https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag/graphrag/index/operations/embed_text): `packages/graphrag/graphrag/index/operations/embed_text`
- [Incremental indexing](https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag/graphrag/index/update/incremental_index.py): `packages/graphrag/graphrag/index/update/incremental_index.py`
- [Pipeline runner](https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag/graphrag/index/run/run_pipeline.py): `packages/graphrag/graphrag/index/run/run_pipeline.py`

### Question answering

- [Query API](https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag/graphrag/api/query.py): `packages/graphrag/graphrag/api/query.py`
- [Search strategies](https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag/graphrag/query): `packages/graphrag/graphrag/query`
- [Vector stores](https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag-vectors/graphrag_vectors): `packages/graphrag-vectors/graphrag_vectors`

### Runtime services

- [Storage backends](https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag-storage/graphrag_storage): `packages/graphrag-storage/graphrag_storage`
- [Table providers](https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag-storage/graphrag_storage/tables/table_provider_factory.py): `packages/graphrag-storage/graphrag_storage/tables/table_provider_factory.py`
- [Cache backends](https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag-cache/graphrag_cache/cache.py): `packages/graphrag-cache/graphrag_cache/cache.py`
- [LLM runtime](https://github.com/plishh/relt-graphrag/tree/main/packages/graphrag-llm/graphrag_llm): `packages/graphrag-llm/graphrag_llm`
- [Template engine](https://github.com/plishh/relt-graphrag/blob/main/packages/graphrag-llm/graphrag_llm/templating/template_engine_factory.py): `packages/graphrag-llm/graphrag_llm/templating/template_engine_factory.py`

### Other components

- **User**
- **LLM provider**
- **Search result**

## Connections

- User → CLI commands: runs commands (evidence: `packages/graphrag/graphrag/cli/main.py`)
- CLI commands → Public APIs: dispatches to (evidence: `packages/graphrag/graphrag/cli/main.py`)
- User → Public APIs: submits query
- User → Prompt tuning: tunes prompts (evidence: `README.md`)
- Public APIs → Pipeline runner: starts indexing
- Pipeline runner → Storage backends: creates and reads (evidence: `packages/graphrag/graphrag/index/run/run_pipeline.py`)
- Pipeline runner → Table providers: creates providers (evidence: `packages/graphrag/graphrag/index/run/run_pipeline.py`)
- Pipeline runner → Cache backends: creates cache (evidence: `packages/graphrag/graphrag/index/run/run_pipeline.py`)
- Pipeline runner → Document readers: runs workflows (evidence: `packages/graphrag/graphrag/index/run/run_pipeline.py`)
- Document readers → Text chunking: provides documents
- Text chunking → Graph extraction: provides text units
- Graph extraction → Claim extraction: extracts claims
- Graph extraction → Community detection: builds graph
- Community detection → Community reports: summarizes groups
- Pipeline runner → Text embeddings: runs workflow
- Pipeline runner → Incremental indexing: supports updates (evidence: `packages/graphrag/graphrag/index/run/run_pipeline.py`)
- CLI commands → Query API: dispatches queries
- Query API → Search strategies: selects search (evidence: `packages/graphrag/graphrag/api/query.py`)
- Query API → Search result: returns result (evidence: `packages/graphrag/graphrag/api/query.py`)
- Search strategies → Vector stores: uses vector search
- Search strategies → LLM runtime: generates response
- LLM runtime → LLM provider: calls provider
- LLM runtime → Cache backends: caches calls (evidence: `packages/graphrag-llm/graphrag_llm/middleware/with_middleware_pipeline.py`)
- LLM runtime → Template engine: uses templates (evidence: `packages/graphrag-llm/graphrag_llm/templating/template_engine_factory.py`)
