# vardhan9/enterprise-grade-scalable-advance-rag-application architecture

> Architecture diagram of the GitHub repository vardhan9/enterprise-grade-scalable-advance-rag-application, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vardhan9/enterprise-grade-scalable-advance-rag-application
- Repository: https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application

## Overview

This is an enterprise RAG application with document ingestion, a guarded conversational API, retrieval and answer generation, and a separate evaluation UI. The main user workflow is query → guardrails → LangGraph routing → (retrieval and reranking, when technical) → response. A second workflow ingests documents into Qdrant; evaluation runs golden questions against the live API and measures responses. The graph follows the excerpts and README; some documented capabilities, including observability and evaluation metrics, have limited implementation evidence here.

Main entry points: [`app/ingestion/processor.py`](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/ingestion/processor.py) (Ingestion Processor), [`app/agents/graph.py`](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/agents/graph.py) (Agent Graph), [`evals/app.py`](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/evals/app.py) (Evaluation UI), [`app/main.py`](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/main.py) (FastAPI API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interfaces"]
  node_chat_ui["Chat UI<br/>[app.py]"]
  node_api["FastAPI API<br/>[main.py]"]
  node_eval_ui["Evaluation UI<br/>[app.py]"]
end

subgraph group_query["Query Processing"]
  node_guardrails["Guardrails<br/>[rails.py]"]
  node_rules["Guardrail Rules<br/>[colang_rules.py]"]
  node_graph["Agent Graph<br/>[graph.py]"]
  node_state["Conversation State<br/>[state.py]"]
  node_planner["Planner<br/>[planner.py]"]
  node_retriever["Retriever<br/>[retriever.py]"]
  node_responder["Responder<br/>[responder.py]"]
  node_gateway["LLM Gateway Client<br/>[client.py]"]
  node_config["Configuration<br/>[config.py]"]
end

subgraph group_knowledge["Knowledge Pipeline"]
  node_qdrant["Qdrant Search<br/>[qdrant_service.py]"]
  node_query_embed["Query Embeddings"]
  node_reranker["FlashRank Reranker<br/>[ranking_service.py]"]
  node_ingestion["Ingestion Processor<br/>[processor.py]"]
  node_pdf["PDF Loader<br/>[pdf.py]"]
  node_html["HTML Loader<br/>[html.py]"]
  node_text["Text Loader<br/>[text.py]"]
  node_office["Office Loader<br/>[office.py]"]
  node_chunker["Text Chunker<br/>[splitter.py]"]
  node_doc_embed["Document Embeddings<br/>[embeddings.py]"]
  node_vector_store[("Qdrant Collection")]
end

subgraph group_quality["Evaluation"]
  node_live_eval["Live Pipeline<br/>[pipeline.py]"]
  node_metrics["RAG Metrics<br/>[metrics.py]"]
  node_guard_eval["Guardrail Metrics<br/>[guardrails_eval.py]"]
  node_golden["Golden Dataset"]
end

node_user(("User"))
node_logfire(("Logfire"))

node_user -->|"asks"| node_chat_ui
node_chat_ui -->|"queries"| node_api
node_api -->|"checks input"| node_guardrails
node_guardrails -->|"loads rules"| node_rules
node_api -->|"runs agent"| node_graph
node_graph -->|"dispatches"| node_planner
node_graph -->|"routes technical"| node_retriever
node_graph -->|"routes conversational"| node_responder
node_graph -->|"uses state"| node_state
node_planner -->|"updates"| node_state
node_planner -->|"calls"| node_gateway
node_retriever -->|"searches"| node_qdrant
node_retriever -->|"reranks results"| node_reranker
node_retriever -->|"reads query"| node_state
node_qdrant -->|"embeds query"| node_query_embed
node_qdrant -.->|"searches"| node_vector_store
node_responder -->|"calls"| node_gateway
node_responder -->|"uses state"| node_state
node_gateway -->|"reads settings"| node_config
node_ingestion -->|"parses PDFs"| node_pdf
node_ingestion -->|"parses HTML"| node_html
node_ingestion -->|"parses text"| node_text
node_ingestion -->|"parses office files"| node_office
node_ingestion -->|"chunks text"| node_chunker
node_ingestion -->|"embeds chunks"| node_doc_embed
node_ingestion -->|"indexes vectors"| node_vector_store
node_eval_ui -.->|"loads samples"| node_golden
node_eval_ui -->|"runs pipeline"| node_live_eval
node_live_eval -->|"posts queries"| node_api
node_eval_ui -.->|"shows scores"| node_metrics
node_eval_ui -.->|"shows guardrail scores"| node_guard_eval
node_user -->|"evaluates"| node_eval_ui
node_api -.->|"traces stages"| node_logfire

click node_chat_ui "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/ui/app.py"
click node_api "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/main.py"
click node_eval_ui "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/evals/app.py"
click node_guardrails "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/guardrails/rails.py"
click node_rules "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/guardrails/colang_rules.py"
click node_graph "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/agents/graph.py"
click node_state "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/agents/state.py"
click node_planner "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/agents/nodes/planner.py"
click node_retriever "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/agents/nodes/retriever.py"
click node_responder "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/agents/nodes/responder.py"
click node_gateway "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/gateway/client.py"
click node_config "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/config.py"
click node_qdrant "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/services/retrieval/qdrant_service.py"
click node_query_embed "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/services/retrieval/embeddings_local.py"
click node_reranker "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/services/retrieval/ranking_service.py"
click node_ingestion "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/ingestion/processor.py"
click node_pdf "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/ingestion/loaders/pdf.py"
click node_html "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/ingestion/loaders/html.py"
click node_text "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/ingestion/loaders/text.py"
click node_office "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/ingestion/loaders/office.py"
click node_chunker "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/ingestion/chunking/splitter.py"
click node_doc_embed "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/services/retrieval/embeddings.py"
click node_live_eval "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/evals/pipeline.py"
click node_metrics "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/evals/metrics.py"
click node_guard_eval "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/evals/guardrails_eval.py"
click node_golden "https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/evals/golden_dataset.json"

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_chat_ui,node_api,node_eval_ui,node_user toneBlue
class node_guardrails,node_rules,node_graph,node_state,node_planner,node_retriever,node_responder,node_gateway,node_config toneAmber
class node_qdrant,node_query_embed,node_reranker,node_ingestion,node_pdf,node_html,node_text,node_office,node_chunker,node_doc_embed,node_vector_store toneMint
class node_live_eval,node_metrics,node_guard_eval,node_golden toneRose
class node_logfire toneIndigo
```

## Components

### User Interfaces

- [Chat UI](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/ui/app.py): `ui/app.py`
- [FastAPI API](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/main.py): `app/main.py`
- [Evaluation UI](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/evals/app.py): `evals/app.py`

### Query Processing

- [Guardrails](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/guardrails/rails.py): `app/guardrails/rails.py`
- [Guardrail Rules](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/guardrails/colang_rules.py): `app/guardrails/colang_rules.py`
- [Agent Graph](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/agents/graph.py): `app/agents/graph.py`
- [Conversation State](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/agents/state.py): `app/agents/state.py`
- [Planner](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/agents/nodes/planner.py): `app/agents/nodes/planner.py`
- [Retriever](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/agents/nodes/retriever.py): `app/agents/nodes/retriever.py`
- [Responder](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/agents/nodes/responder.py): `app/agents/nodes/responder.py`
- [LLM Gateway Client](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/gateway/client.py): `app/gateway/client.py`
- [Configuration](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/config.py): `app/config.py`

### Knowledge Pipeline

- [Qdrant Search](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/services/retrieval/qdrant_service.py): `app/services/retrieval/qdrant_service.py`
- [Query Embeddings](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/services/retrieval/embeddings_local.py): `app/services/retrieval/embeddings_local.py`
- [FlashRank Reranker](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/services/retrieval/ranking_service.py): `app/services/retrieval/ranking_service.py`
- [Ingestion Processor](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/ingestion/processor.py): `app/ingestion/processor.py`
- [PDF Loader](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/ingestion/loaders/pdf.py): `app/ingestion/loaders/pdf.py`
- [HTML Loader](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/ingestion/loaders/html.py): `app/ingestion/loaders/html.py`
- [Text Loader](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/ingestion/loaders/text.py): `app/ingestion/loaders/text.py`
- [Office Loader](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/ingestion/loaders/office.py): `app/ingestion/loaders/office.py`
- [Text Chunker](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/ingestion/chunking/splitter.py): `app/ingestion/chunking/splitter.py`
- [Document Embeddings](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/app/services/retrieval/embeddings.py): `app/services/retrieval/embeddings.py`
- **Qdrant Collection**

### Evaluation

- [Live Pipeline](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/evals/pipeline.py): `evals/pipeline.py`
- [RAG Metrics](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/evals/metrics.py): `evals/metrics.py`
- [Guardrail Metrics](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/evals/guardrails_eval.py): `evals/guardrails_eval.py`
- [Golden Dataset](https://github.com/vardhan9/enterprise-grade-scalable-advance-rag-application/blob/main/evals/golden_dataset.json): `evals/golden_dataset.json`

### Other components

- **User**
- **Logfire**

## Connections

- User → Chat UI: asks (evidence: `README.md`)
- Chat UI → FastAPI API: queries (evidence: `README.md`)
- FastAPI API → Guardrails: checks input (evidence: `app/main.py`)
- Guardrails → Guardrail Rules: loads rules (evidence: `app/guardrails/rails.py`)
- FastAPI API → Agent Graph: runs agent (evidence: `app/main.py`)
- Agent Graph → Planner: dispatches (evidence: `app/agents/graph.py`)
- Agent Graph → Retriever: routes technical (evidence: `app/agents/graph.py`)
- Agent Graph → Responder: routes conversational (evidence: `app/agents/graph.py`)
- Agent Graph → Conversation State: uses state (evidence: `app/agents/graph.py`)
- Planner → Conversation State: updates (evidence: `app/agents/nodes/planner.py`)
- Planner → LLM Gateway Client: calls (evidence: `app/agents/nodes/planner.py`)
- Retriever → Qdrant Search: searches (evidence: `app/agents/nodes/retriever.py`)
- Retriever → FlashRank Reranker: reranks results (evidence: `app/agents/nodes/retriever.py`)
- Retriever → Conversation State: reads query (evidence: `app/agents/nodes/retriever.py`)
- Qdrant Search → Query Embeddings: embeds query (evidence: `app/services/retrieval/qdrant_service.py`)
- Qdrant Search → Qdrant Collection: searches (evidence: `app/services/retrieval/qdrant_service.py`)
- Responder → LLM Gateway Client: calls (evidence: `app/agents/nodes/responder.py`)
- Responder → Conversation State: uses state (evidence: `app/agents/nodes/responder.py`)
- LLM Gateway Client → Configuration: reads settings (evidence: `app/gateway/client.py`)
- Ingestion Processor → PDF Loader: parses PDFs (evidence: `app/ingestion/processor.py`)
- Ingestion Processor → HTML Loader: parses HTML (evidence: `app/ingestion/processor.py`)
- Ingestion Processor → Text Loader: parses text (evidence: `app/ingestion/processor.py`)
- Ingestion Processor → Office Loader: parses office files (evidence: `app/ingestion/processor.py`)
- Ingestion Processor → Text Chunker: chunks text (evidence: `app/ingestion/processor.py`)
- Ingestion Processor → Document Embeddings: embeds chunks (evidence: `app/ingestion/processor.py`)
- Ingestion Processor → Qdrant Collection: indexes vectors (evidence: `app/ingestion/processor.py`)
- Evaluation UI → Golden Dataset: loads samples (evidence: `evals/app.py`)
- Evaluation UI → Live Pipeline: runs pipeline (evidence: `evals/app.py`)
- Live Pipeline → FastAPI API: posts queries (evidence: `evals/pipeline.py`)
- Evaluation UI → RAG Metrics: shows scores (evidence: `evals/app.py`)
- Evaluation UI → Guardrail Metrics: shows guardrail scores (evidence: `evals/app.py`)
- User → Evaluation UI: evaluates (evidence: `README.md`)
- FastAPI API → Logfire: traces stages (evidence: `README.md`)
