# ash-blanc/zepto-support-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/ash-blanc/zepto-support-assistant
- Repository: https://github.com/ash-blanc/zepto-support-assistant

## Overview

Zepto Support Assistant accepts a customer question through Flask, validates it, and invokes a LangGraph workflow. Intent classification routes policy questions through embedding-based ChromaDB retrieval before LLM response generation, while general questions go directly to the LLM; both return an answer to the API/UI. A separate indexing workflow chunks policy documents and writes embeddings to the same store. README-documented UI details are represented from its description; source excerpts show the backend calls and storage behavior.

Main entry points: [`rag.py`](https://github.com/ash-blanc/zepto-support-assistant/blob/main/rag.py) (Policy retrieval), [`app.py`](https://github.com/ash-blanc/zepto-support-assistant/blob/main/app.py) (Flask API), [`graph.py`](https://github.com/ash-blanc/zepto-support-assistant/blob/main/graph.py) (Intent classifier), [`templates/index.html`](https://github.com/ash-blanc/zepto-support-assistant/blob/main/templates/index.html) (Chat interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Customer interaction"]
  node_web_ui["Chat interface<br/>[index.html]"]
  node_web_server["Flask API<br/>[app.py]"]
  node_answer["Answer response<br/>[app.py]"]
end

subgraph group_routing["Question routing"]
  node_workflow["LangGraph workflow<br/>[graph.py]"]
  node_intent["Intent classifier<br/>[graph.py]"]
  node_policy_route["Policy answer node<br/>[graph.py]"]
  node_general_route["General answer node<br/>[graph.py]"]
end

subgraph group_knowledge["Policy knowledge"]
  node_policy_docs["Policy documents"]
  node_indexer["Document indexer<br/>[load_documents.py]"]
  node_chunking["Text chunking<br/>[load_documents.py]"]
  node_embedding["Embedding model<br/>[load_documents.py]"]
  node_vector_db[("ChromaDB store")]
end

subgraph group_responses["Answer generation"]
  node_retrieval["Policy retrieval<br/>[rag.py]"]
  node_query_embedding["Query embedding<br/>[rag.py]"]
  node_prompt["Prompt builder<br/>[rag.py]"]
  node_llm_client["LLM client<br/>[rag.py]"]
  node_kie_service["Kie.ai GPT"]
end

node_customer(("Customer"))

node_customer -->|"asks question"| node_web_ui
node_web_ui -.->|"submits question"| node_web_server
node_web_server -->|"invokes"| node_workflow
node_workflow -->|"runs classification"| node_intent
node_intent -->|"routes policy"| node_policy_route
node_intent -->|"routes general"| node_general_route
node_policy_route -->|"calls retrieval"| node_retrieval
node_general_route -->|"calls direct answer"| node_llm_client
node_policy_docs -->|"supplies text"| node_indexer
node_indexer -->|"splits documents"| node_chunking
node_chunking -->|"encodes chunks"| node_embedding
node_embedding -->|"upserts vectors"| node_vector_db
node_retrieval -->|"encodes query"| node_query_embedding
node_retrieval -->|"queries chunks"| node_vector_db
node_retrieval -->|"builds context prompt"| node_prompt
node_prompt -->|"provides prompt"| node_llm_client
node_llm_client -->|"requests completion"| node_kie_service
node_llm_client -->|"returns answer"| node_answer
node_web_server -->|"returns JSON"| node_answer

click node_web_ui "https://github.com/ash-blanc/zepto-support-assistant/blob/main/templates/index.html"
click node_web_server "https://github.com/ash-blanc/zepto-support-assistant/blob/main/app.py"
click node_workflow "https://github.com/ash-blanc/zepto-support-assistant/blob/main/graph.py"
click node_intent "https://github.com/ash-blanc/zepto-support-assistant/blob/main/graph.py"
click node_policy_route "https://github.com/ash-blanc/zepto-support-assistant/blob/main/graph.py"
click node_general_route "https://github.com/ash-blanc/zepto-support-assistant/blob/main/graph.py"
click node_policy_docs "https://github.com/ash-blanc/zepto-support-assistant/tree/main/docs"
click node_indexer "https://github.com/ash-blanc/zepto-support-assistant/blob/main/load_documents.py"
click node_chunking "https://github.com/ash-blanc/zepto-support-assistant/blob/main/load_documents.py"
click node_embedding "https://github.com/ash-blanc/zepto-support-assistant/blob/main/load_documents.py"
click node_vector_db "https://github.com/ash-blanc/zepto-support-assistant/tree/main/vector_store"
click node_retrieval "https://github.com/ash-blanc/zepto-support-assistant/blob/main/rag.py"
click node_query_embedding "https://github.com/ash-blanc/zepto-support-assistant/blob/main/rag.py"
click node_prompt "https://github.com/ash-blanc/zepto-support-assistant/blob/main/rag.py"
click node_llm_client "https://github.com/ash-blanc/zepto-support-assistant/blob/main/rag.py"
click node_answer "https://github.com/ash-blanc/zepto-support-assistant/blob/main/app.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_web_ui,node_web_server,node_answer toneBlue
class node_workflow,node_intent,node_policy_route,node_general_route toneAmber
class node_policy_docs,node_indexer,node_chunking,node_embedding,node_vector_db toneMint
class node_retrieval,node_query_embedding,node_prompt,node_llm_client,node_kie_service toneRose
class node_customer toneIndigo
```

## Components

### Customer interaction

- [Chat interface](https://github.com/ash-blanc/zepto-support-assistant/blob/main/templates/index.html): `templates/index.html`
- [Flask API](https://github.com/ash-blanc/zepto-support-assistant/blob/main/app.py): `app.py`
- [Answer response](https://github.com/ash-blanc/zepto-support-assistant/blob/main/app.py): `app.py`

### Question routing

- [LangGraph workflow](https://github.com/ash-blanc/zepto-support-assistant/blob/main/graph.py): `graph.py`
- [Intent classifier](https://github.com/ash-blanc/zepto-support-assistant/blob/main/graph.py): `graph.py`
- [Policy answer node](https://github.com/ash-blanc/zepto-support-assistant/blob/main/graph.py): `graph.py`
- [General answer node](https://github.com/ash-blanc/zepto-support-assistant/blob/main/graph.py): `graph.py`

### Policy knowledge

- [Policy documents](https://github.com/ash-blanc/zepto-support-assistant/tree/main/docs): `docs`
- [Document indexer](https://github.com/ash-blanc/zepto-support-assistant/blob/main/load_documents.py): `load_documents.py`
- [Text chunking](https://github.com/ash-blanc/zepto-support-assistant/blob/main/load_documents.py): `load_documents.py`
- [Embedding model](https://github.com/ash-blanc/zepto-support-assistant/blob/main/load_documents.py): `load_documents.py`
- [ChromaDB store](https://github.com/ash-blanc/zepto-support-assistant/tree/main/vector_store): `vector_store`

### Answer generation

- [Policy retrieval](https://github.com/ash-blanc/zepto-support-assistant/blob/main/rag.py): `rag.py`
- [Query embedding](https://github.com/ash-blanc/zepto-support-assistant/blob/main/rag.py): `rag.py`
- [Prompt builder](https://github.com/ash-blanc/zepto-support-assistant/blob/main/rag.py): `rag.py`
- [LLM client](https://github.com/ash-blanc/zepto-support-assistant/blob/main/rag.py): `rag.py`
- **Kie.ai GPT**

### Other components

- **Customer**

## Connections

- Customer → Chat interface: asks question (evidence: `README.md`)
- Chat interface → Flask API: submits question
- Flask API → LangGraph workflow: invokes (evidence: `app.py`)
- LangGraph workflow → Intent classifier: runs classification (evidence: `graph.py`)
- Intent classifier → Policy answer node: routes policy (evidence: `graph.py`)
- Intent classifier → General answer node: routes general (evidence: `graph.py`)
- Policy answer node → Policy retrieval: calls retrieval (evidence: `graph.py`)
- General answer node → LLM client: calls direct answer (evidence: `rag.py`)
- Policy documents → Document indexer: supplies text (evidence: `README.md`)
- Document indexer → Text chunking: splits documents (evidence: `load_documents.py`)
- Text chunking → Embedding model: encodes chunks (evidence: `load_documents.py`)
- Embedding model → ChromaDB store: upserts vectors (evidence: `load_documents.py`)
- Policy retrieval → Query embedding: encodes query (evidence: `rag.py`)
- Policy retrieval → ChromaDB store: queries chunks (evidence: `rag.py`)
- Policy retrieval → Prompt builder: builds context prompt (evidence: `rag.py`)
- Prompt builder → LLM client: provides prompt (evidence: `rag.py`)
- LLM client → Kie.ai GPT: requests completion (evidence: `rag.py`)
- LLM client → Answer response: returns answer (evidence: `app.py`)
- Flask API → Answer response: returns JSON (evidence: `app.py`)
