# ragook6/rag_production architecture

> Architecture diagram of the GitHub repository ragook6/rag_production, 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/ragook6/rag_production
- Repository: https://github.com/ragook6/rag_production

## Overview

This is a documentation-focused RAG assistant. Its user workflow is query → retrieval → grounded prompt → cited answer; its separate ingestion workflow chunks Markdown, embeds chunks, and persists them for retrieval. The graph also preserves character-versus-semantic chunking comparison and standalone vector search. Query-stage calls are supported by excerpts; ingestion-to-storage links reflect README-described behavior and are marked unverified because the ingestion orchestrators were not excerpted.

Main entry points: [`pipeline/nodes.py`](https://github.com/ragook6/rag_production/blob/main/pipeline/nodes.py) (Pipeline nodes), [`generation/answer_generator.py`](https://github.com/ragook6/rag_production/blob/main/generation/answer_generator.py) (Answer generation), [`vectorstore/embedder.py`](https://github.com/ragook6/rag_production/blob/main/vectorstore/embedder.py) (Text embeddings), [`retrieval/hybrid_search.py`](https://github.com/ragook6/rag_production/blob/main/retrieval/hybrid_search.py) (Hybrid retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Document ingestion"]
  node_markdown["Markdown documents"]
  node_char_split["Character splitting"]
  node_semantic_split["Semantic splitting"]
  node_comparison["Chunk comparison<br/>[comparison.py]"]
  node_embedder["Text embeddings<br/>[embedder.py]"]
  node_store[("ChromaDB collection<br/>[store.py]")]
end

subgraph group_retrieve["Retrieval"]
  node_hybrid["Hybrid retrieval<br/>[hybrid_search.py]"]
  node_semantic_search["Vector search<br/>[semantic_search.py]"]
end

subgraph group_answer["Answer generation"]
  node_prompt["Grounded prompt<br/>[prompt_builder.py]"]
  node_generator["Answer generation"]
  node_openai{{"OpenAI API"}}
  node_answer["Cited answer"]
end

subgraph group_runtime["Pipeline runtime"]
  node_settings["Runtime settings<br/>[settings.py]"]
  node_state["RAG state<br/>[state.py]"]
  node_nodes["Pipeline nodes<br/>[nodes.py]"]
  node_graph["Query entry point<br/>[graph.py]"]
end

node_user(("Questioner"))

node_user -->|"asks query"| node_graph
node_graph -->|"runs graph"| node_nodes
node_nodes -->|"uses state"| node_state
node_nodes -->|"retrieves chunks"| node_hybrid
node_hybrid -->|"reads collection"| node_store
node_hybrid -->|"encodes query"| node_embedder
node_nodes -->|"builds prompt"| node_prompt
node_prompt -->|"uses chunk type"| node_semantic_search
node_nodes -->|"generates answer"| node_generator
node_generator -->|"consumes prompt"| node_prompt
node_generator -->|"calls API"| node_openai
node_generator -->|"returns answer"| node_answer
node_markdown -.->|"splits characters"| node_char_split
node_markdown -.->|"splits sections"| node_semantic_split
node_char_split -.->|"embeds chunks"| node_embedder
node_semantic_split -.->|"embeds chunks"| node_embedder
node_embedder -.->|"stores vectors"| node_store
node_comparison -->|"compares strategy"| node_char_split
node_comparison -->|"compares strategy"| node_semantic_split
node_semantic_search -->|"queries vectors"| node_store
node_settings -->|"configures runtime"| node_nodes

click node_markdown "https://github.com/ragook6/rag_production/tree/main/docs"
click node_char_split "https://github.com/ragook6/rag_production/blob/main/chunking/character_splitter.py"
click node_semantic_split "https://github.com/ragook6/rag_production/blob/main/chunking/semantic_splitter.py"
click node_comparison "https://github.com/ragook6/rag_production/blob/main/chunking/comparison.py"
click node_settings "https://github.com/ragook6/rag_production/blob/main/config/settings.py"
click node_embedder "https://github.com/ragook6/rag_production/blob/main/vectorstore/embedder.py"
click node_store "https://github.com/ragook6/rag_production/blob/main/vectorstore/store.py"
click node_hybrid "https://github.com/ragook6/rag_production/blob/main/retrieval/hybrid_search.py"
click node_semantic_search "https://github.com/ragook6/rag_production/blob/main/retrieval/semantic_search.py"
click node_state "https://github.com/ragook6/rag_production/blob/main/pipeline/state.py"
click node_nodes "https://github.com/ragook6/rag_production/blob/main/pipeline/nodes.py"
click node_graph "https://github.com/ragook6/rag_production/blob/main/pipeline/graph.py"
click node_prompt "https://github.com/ragook6/rag_production/blob/main/generation/prompt_builder.py"
click node_generator "https://github.com/ragook6/rag_production/blob/main/generation/answer_generator.py"
click node_answer "https://github.com/ragook6/rag_production/blob/main/generation/answer_generator.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_markdown,node_char_split,node_semantic_split,node_comparison,node_embedder,node_store toneBlue
class node_hybrid,node_semantic_search toneAmber
class node_prompt,node_generator,node_openai,node_answer toneMint
class node_settings,node_state,node_nodes,node_graph toneRose
class node_user toneIndigo
```

## Components

### Document ingestion

- [Markdown documents](https://github.com/ragook6/rag_production/tree/main/docs): `docs`
- [Character splitting](https://github.com/ragook6/rag_production/blob/main/chunking/character_splitter.py): `chunking/character_splitter.py`
- [Semantic splitting](https://github.com/ragook6/rag_production/blob/main/chunking/semantic_splitter.py): `chunking/semantic_splitter.py`
- [Chunk comparison](https://github.com/ragook6/rag_production/blob/main/chunking/comparison.py): `chunking/comparison.py`
- [Text embeddings](https://github.com/ragook6/rag_production/blob/main/vectorstore/embedder.py): `vectorstore/embedder.py`
- [ChromaDB collection](https://github.com/ragook6/rag_production/blob/main/vectorstore/store.py): `vectorstore/store.py`

### Retrieval

- [Hybrid retrieval](https://github.com/ragook6/rag_production/blob/main/retrieval/hybrid_search.py): `retrieval/hybrid_search.py`
- [Vector search](https://github.com/ragook6/rag_production/blob/main/retrieval/semantic_search.py): `retrieval/semantic_search.py`

### Answer generation

- [Grounded prompt](https://github.com/ragook6/rag_production/blob/main/generation/prompt_builder.py): `generation/prompt_builder.py`
- [Answer generation](https://github.com/ragook6/rag_production/blob/main/generation/answer_generator.py): `generation/answer_generator.py`
- **OpenAI API**
- [Cited answer](https://github.com/ragook6/rag_production/blob/main/generation/answer_generator.py): `generation/answer_generator.py`

### Pipeline runtime

- [Runtime settings](https://github.com/ragook6/rag_production/blob/main/config/settings.py): `config/settings.py`
- [RAG state](https://github.com/ragook6/rag_production/blob/main/pipeline/state.py): `pipeline/state.py`
- [Pipeline nodes](https://github.com/ragook6/rag_production/blob/main/pipeline/nodes.py): `pipeline/nodes.py`
- [Query entry point](https://github.com/ragook6/rag_production/blob/main/pipeline/graph.py): `pipeline/graph.py`

### Other components

- **Questioner**

## Connections

- Questioner → Query entry point: asks query (evidence: `README.md`)
- Query entry point → Pipeline nodes: runs graph (evidence: `pipeline/graph.py`)
- Pipeline nodes → RAG state: uses state (evidence: `pipeline/nodes.py`)
- Pipeline nodes → Hybrid retrieval: retrieves chunks (evidence: `pipeline/nodes.py`)
- Hybrid retrieval → ChromaDB collection: reads collection (evidence: `retrieval/hybrid_search.py`)
- Hybrid retrieval → Text embeddings: encodes query (evidence: `retrieval/hybrid_search.py`)
- Pipeline nodes → Grounded prompt: builds prompt (evidence: `pipeline/nodes.py`)
- Grounded prompt → Vector search: uses chunk type (evidence: `generation/prompt_builder.py`)
- Pipeline nodes → Answer generation: generates answer (evidence: `pipeline/nodes.py`)
- Answer generation → Grounded prompt: consumes prompt (evidence: `generation/answer_generator.py`)
- Answer generation → OpenAI API: calls API (evidence: `generation/answer_generator.py`)
- Answer generation → Cited answer: returns answer (evidence: `generation/answer_generator.py`)
- Markdown documents → Character splitting: splits characters (evidence: `README.md`)
- Markdown documents → Semantic splitting: splits sections (evidence: `README.md`)
- Character splitting → Text embeddings: embeds chunks (evidence: `README.md`)
- Semantic splitting → Text embeddings: embeds chunks (evidence: `README.md`)
- Text embeddings → ChromaDB collection: stores vectors (evidence: `README.md`)
- Chunk comparison → Character splitting: compares strategy (evidence: `chunking/comparison.py`)
- Chunk comparison → Semantic splitting: compares strategy (evidence: `chunking/comparison.py`)
- Vector search → ChromaDB collection: queries vectors (evidence: `retrieval/semantic_search.py`)
- Runtime settings → Pipeline nodes: configures runtime (evidence: `pipeline/nodes.py`)
