# sufian-01/customer-support-rag-agent architecture

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

- Interactive diagram: https://gitdiagram.com/sufian-01/customer-support-rag-agent
- Repository: https://github.com/sufian-01/customer-support-rag-agent

## Overview

This is a Streamlit customer-support RAG app. Users can ask questions against a PDF knowledge base; the backend prepares that PDF for retrieval, retrieves relevant passages and prior conversation, generates an answer, and saves the exchange. The graph reflects the backend’s explicit calls and LangGraph workflow. The app excerpt shows its backend imports but omits the interaction code, so the UI-to-backend call is shown as unverified; the README is empty.

Main entry points: [`customer_service_backend.py`](https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py) (PDF processing), [`app.py`](https://github.com/sufian-01/customer-support-rag-agent/blob/main/app.py) (Streamlit chat), [`data/book.pdf`](https://github.com/sufian-01/customer-support-rag-agent/blob/main/data/book.pdf) (Knowledge PDF)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_app["Streamlit chat<br/>[app.py]"]
end

subgraph group_prep["Knowledge preparation"]
  node_pdf["Knowledge PDF<br/>[book.pdf]"]
  node_process["PDF processing"]
  node_loader["PDF loading"]
  node_split["Text splitting"]
  node_embed["Embedding model"]
  node_store[("FAISS index")]
  node_retriever["Document retriever"]
end

subgraph group_qa["Answer and memory"]
  node_ask["Question entry"]
  node_graph["LangGraph workflow"]
  node_retrieve["Context retrieval"]
  node_history[("Chat history")]
  node_prompt["Answer prompt"]
  node_generate["Answer generation"]
  node_llm["Gemini model"]
  node_save["Save exchange"]
end

node_user(("Support user"))

node_user -.->|"asks question"| node_app
node_app -.->|"uses backend"| node_ask
node_process -->|"loads PDF"| node_loader
node_pdf -->|"read by"| node_loader
node_process -->|"splits documents"| node_split
node_process -->|"creates embeddings"| node_embed
node_process -->|"builds index"| node_store
node_process -->|"creates retriever"| node_retriever
node_process -->|"loads model"| node_llm
node_process -->|"creates prompt"| node_prompt
node_ask -->|"invokes workflow"| node_graph
node_graph -->|"dispatches first"| node_retrieve
node_graph -->|"dispatches next"| node_generate
node_graph -->|"dispatches last"| node_save
node_retrieve -->|"searches index"| node_retriever
node_retrieve -->|"loads history"| node_history
node_generate -->|"formats prompt"| node_prompt
node_generate -->|"requests answer"| node_llm
node_save -->|"writes exchange"| node_history

click node_app "https://github.com/sufian-01/customer-support-rag-agent/blob/main/app.py"
click node_pdf "https://github.com/sufian-01/customer-support-rag-agent/blob/main/data/book.pdf"
click node_process "https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py"
click node_loader "https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py"
click node_split "https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py"
click node_embed "https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py"
click node_store "https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py"
click node_retriever "https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py"
click node_ask "https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py"
click node_graph "https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py"
click node_retrieve "https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py"
click node_history "https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py"
click node_prompt "https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py"
click node_generate "https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py"
click node_llm "https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py"
click node_save "https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.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_app,node_user toneBlue
class node_pdf,node_process,node_loader,node_split,node_embed,node_store,node_retriever toneAmber
class node_ask,node_graph,node_retrieve,node_history,node_prompt,node_generate,node_llm,node_save toneMint
```

## Components

### User interface

- [Streamlit chat](https://github.com/sufian-01/customer-support-rag-agent/blob/main/app.py): `app.py`

### Knowledge preparation

- [Knowledge PDF](https://github.com/sufian-01/customer-support-rag-agent/blob/main/data/book.pdf): `data/book.pdf`
- [PDF processing](https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py): `customer_service_backend.py`
- [PDF loading](https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py): `customer_service_backend.py`
- [Text splitting](https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py): `customer_service_backend.py`
- [Embedding model](https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py): `customer_service_backend.py`
- [FAISS index](https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py): `customer_service_backend.py`
- [Document retriever](https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py): `customer_service_backend.py`

### Answer and memory

- [Question entry](https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py): `customer_service_backend.py`
- [LangGraph workflow](https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py): `customer_service_backend.py`
- [Context retrieval](https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py): `customer_service_backend.py`
- [Chat history](https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py): `customer_service_backend.py`
- [Answer prompt](https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py): `customer_service_backend.py`
- [Answer generation](https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py): `customer_service_backend.py`
- [Gemini model](https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py): `customer_service_backend.py`
- [Save exchange](https://github.com/sufian-01/customer-support-rag-agent/blob/main/customer_service_backend.py): `customer_service_backend.py`

### Other components

- **Support user**

## Connections

- Support user → Streamlit chat: asks question
- Streamlit chat → Question entry: uses backend (evidence: `app.py`)
- PDF processing → PDF loading: loads PDF (evidence: `customer_service_backend.py`)
- Knowledge PDF → PDF loading: read by (evidence: `customer_service_backend.py`)
- PDF processing → Text splitting: splits documents (evidence: `customer_service_backend.py`)
- PDF processing → Embedding model: creates embeddings (evidence: `customer_service_backend.py`)
- PDF processing → FAISS index: builds index (evidence: `customer_service_backend.py`)
- PDF processing → Document retriever: creates retriever (evidence: `customer_service_backend.py`)
- PDF processing → Gemini model: loads model (evidence: `customer_service_backend.py`)
- PDF processing → Answer prompt: creates prompt (evidence: `customer_service_backend.py`)
- Question entry → LangGraph workflow: invokes workflow (evidence: `customer_service_backend.py`)
- LangGraph workflow → Context retrieval: dispatches first (evidence: `customer_service_backend.py`)
- LangGraph workflow → Answer generation: dispatches next (evidence: `customer_service_backend.py`)
- LangGraph workflow → Save exchange: dispatches last (evidence: `customer_service_backend.py`)
- Context retrieval → Document retriever: searches index (evidence: `customer_service_backend.py`)
- Context retrieval → Chat history: loads history (evidence: `customer_service_backend.py`)
- Answer generation → Answer prompt: formats prompt (evidence: `customer_service_backend.py`)
- Answer generation → Gemini model: requests answer (evidence: `customer_service_backend.py`)
- Save exchange → Chat history: writes exchange (evidence: `customer_service_backend.py`)
