# raushan291/enterprise-ai-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/raushan291/enterprise-ai-assistant
- Repository: https://github.com/raushan291/enterprise-ai-assistant

## Overview

Enterprise Knowledge Assistant is a RAG chat application: users submit questions through a chat UI or API, receive safety-checked answers grounded in retrieved knowledge, and can inspect or reset conversation history. Its supporting capabilities include document and QA-dataset ingestion, model fine-tuning and evaluation, caching, and operational monitoring. The graph reflects sampled calls and indexed imports; deployment wiring and some unsampled integrations are represented only where documented, not inferred from their presence in the tree.

Main entry points: [`src/rag_pipeline/orchestrator.py`](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/rag_pipeline/orchestrator.py) (RAG Orchestrator), [`src/data_pipeline/build_chroma_db.py`](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/build_chroma_db.py) (Index Builder), [`src/data_pipeline/qa_builder/run_pipeline.py`](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/qa_builder/run_pipeline.py) (QA Dataset Pipeline), [`src/api/main.py`](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/api/main.py) (FastAPI Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Chat Experience"]
  node_chat_ui["Chat UI<br/>[chat_app.py]"]
  node_api["FastAPI Service<br/>[main.py]"]
  node_query_route["Query and History<br/>[query.py]"]
end

subgraph group_rag["RAG Runtime"]
  node_rag_orchestrator["RAG Orchestrator<br/>[orchestrator.py]"]
  node_retriever["Context Retriever<br/>[retriever.py]"]
  node_prompt["Prompt Builder<br/>[prompt_template.py]"]
  node_guardrails["Safety Validation<br/>[orchestrator.py]"]
  node_cache["Response Cache<br/>[cache.py]"]
  node_memory["Conversation Memory"]
end

subgraph group_ingestion["Knowledge Ingestion"]
  node_raw_docs["Raw Documents"]
  node_loader["Document Loader<br/>[loader.py]"]
  node_chunker["Text Chunker<br/>[chunker.py]"]
  node_embedder["Text Embedder<br/>[embedder.py]"]
  node_index_builder["Index Builder<br/>[build_chroma_db.py]"]
  node_vector_store["Vector Store Writer<br/>[vector_store.py]"]
  node_qa_pipeline["QA Dataset Pipeline<br/>[run_pipeline.py]"]
  node_preprocess["QA Preprocessing<br/>[preprocess.py]"]
  node_qa_generator["QA Generation<br/>[qa_generator.py]"]
  node_qa_embed["QA Embedding"]
end

subgraph group_models["Model Lifecycle"]
  node_inference["Model Inference<br/>[inference.py]"]
  node_finetune["Model Fine-tuning<br/>[finetune.py]"]
  node_evaluator["Model Evaluation<br/>[evaluator.py]"]
end

subgraph group_operations["Operations"]
  node_settings["Application Settings<br/>[settings.py]"]
  node_mlflow["MLflow Tracking<br/>[mlflow_utils.py]"]
  node_metrics_config["Prometheus Config<br/>[prometheus.yml]"]
  node_logging["Logging<br/>[logging_config.py]"]
end

node_user(("User"))
node_chroma[("ChromaDB")]
node_redis[("Redis")]
node_openai["OpenAI API"]
node_prometheus["Prometheus"]
node_grafana["Grafana"]

node_user -->|"asks"| node_chat_ui
node_user -->|"submits query"| node_api
node_api -->|"routes requests"| node_query_route
node_query_route -->|"invokes"| node_rag_orchestrator
node_query_route -->|"reads and clears"| node_memory
node_query_route -->|"clears"| node_cache
node_rag_orchestrator -->|"validates input and output"| node_guardrails
node_rag_orchestrator -->|"reads and updates"| node_memory
node_rag_orchestrator -->|"checks and stores"| node_cache
node_rag_orchestrator -->|"retrieves context"| node_retriever
node_rag_orchestrator -->|"builds prompt"| node_prompt
node_rag_orchestrator -->|"generates answer"| node_inference
node_retriever -->|"queries"| node_chroma
node_retriever -.->|"embeds when configured"| node_openai
node_inference -.->|"fallback generation"| node_openai
node_cache -->|"reads and writes"| node_redis
node_raw_docs -->|"provides source files"| node_index_builder
node_index_builder -->|"imports loader"| node_loader
node_index_builder -->|"imports chunker"| node_chunker
node_index_builder -->|"imports embedder"| node_embedder
node_index_builder -->|"imports writer"| node_vector_store
node_vector_store -->|"writes documents"| node_chroma
node_qa_pipeline -->|"preprocesses data"| node_preprocess
node_qa_pipeline -->|"generates pairs"| node_qa_generator
node_qa_pipeline -->|"embeds pairs"| node_qa_embed
node_qa_pipeline -->|"stores chunks and pairs"| node_chroma
node_qa_generator -->|"requests generated answers"| node_rag_orchestrator
node_qa_embed -->|"uses embedding helpers"| node_embedder
node_finetune -->|"uses evaluation"| node_evaluator
node_api -->|"exposes scrape metrics"| node_prometheus
node_metrics_config -->|"configures scraping"| node_prometheus
node_prometheus -->|"supplies metrics for dashboards"| node_grafana
node_api -->|"gets logger"| node_logging

click node_chat_ui "https://github.com/raushan291/enterprise-ai-assistant/blob/master/ui/chat_app.py"
click node_api "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/api/main.py"
click node_query_route "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/api/routes/query.py"
click node_settings "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/config/settings.py"
click node_rag_orchestrator "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/rag_pipeline/orchestrator.py"
click node_retriever "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/rag_pipeline/retriever.py"
click node_prompt "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/rag_pipeline/prompt_template.py"
click node_inference "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/models/inference.py"
click node_guardrails "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/rag_pipeline/orchestrator.py"
click node_cache "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/utils/cache.py"
click node_memory "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/utils/conversation_memory.py"
click node_raw_docs "https://github.com/raushan291/enterprise-ai-assistant/tree/master/data/raw"
click node_loader "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/loader.py"
click node_chunker "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/chunker.py"
click node_embedder "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/embedder.py"
click node_index_builder "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/build_chroma_db.py"
click node_vector_store "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/vector_store.py"
click node_qa_pipeline "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/qa_builder/run_pipeline.py"
click node_preprocess "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/qa_builder/preprocess.py"
click node_qa_generator "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/qa_builder/qa_generator.py"
click node_qa_embed "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/qa_builder/embed_qa_dataset.py"
click node_finetune "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/models/finetune.py"
click node_evaluator "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/models/evaluator.py"
click node_mlflow "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/mlops/mlflow_utils.py"
click node_metrics_config "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/config/prometheus.yml"
click node_logging "https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/config/logging_config.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_chat_ui,node_api,node_query_route,node_user toneBlue
class node_rag_orchestrator,node_retriever,node_prompt,node_guardrails,node_cache,node_memory,node_chroma,node_redis toneAmber
class node_raw_docs,node_loader,node_chunker,node_embedder,node_index_builder,node_vector_store,node_qa_pipeline,node_preprocess,node_qa_generator,node_qa_embed,node_openai toneMint
class node_inference,node_finetune,node_evaluator toneRose
class node_settings,node_mlflow,node_metrics_config,node_logging,node_prometheus,node_grafana toneIndigo
```

## Components

### Chat Experience

- [Chat UI](https://github.com/raushan291/enterprise-ai-assistant/blob/master/ui/chat_app.py): `ui/chat_app.py`
- [FastAPI Service](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/api/main.py): `src/api/main.py`
- [Query and History](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/api/routes/query.py): `src/api/routes/query.py`

### RAG Runtime

- [RAG Orchestrator](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/rag_pipeline/orchestrator.py): `src/rag_pipeline/orchestrator.py`
- [Context Retriever](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/rag_pipeline/retriever.py): `src/rag_pipeline/retriever.py`
- [Prompt Builder](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/rag_pipeline/prompt_template.py): `src/rag_pipeline/prompt_template.py`
- [Safety Validation](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/rag_pipeline/orchestrator.py): `src/rag_pipeline/orchestrator.py`
- [Response Cache](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/utils/cache.py): `src/utils/cache.py`
- [Conversation Memory](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/utils/conversation_memory.py): `src/utils/conversation_memory.py`

### Knowledge Ingestion

- [Raw Documents](https://github.com/raushan291/enterprise-ai-assistant/tree/master/data/raw): `data/raw`
- [Document Loader](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/loader.py): `src/data_pipeline/loader.py`
- [Text Chunker](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/chunker.py): `src/data_pipeline/chunker.py`
- [Text Embedder](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/embedder.py): `src/data_pipeline/embedder.py`
- [Index Builder](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/build_chroma_db.py): `src/data_pipeline/build_chroma_db.py`
- [Vector Store Writer](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/vector_store.py): `src/data_pipeline/vector_store.py`
- [QA Dataset Pipeline](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/qa_builder/run_pipeline.py): `src/data_pipeline/qa_builder/run_pipeline.py`
- [QA Preprocessing](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/qa_builder/preprocess.py): `src/data_pipeline/qa_builder/preprocess.py`
- [QA Generation](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/qa_builder/qa_generator.py): `src/data_pipeline/qa_builder/qa_generator.py`
- [QA Embedding](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/data_pipeline/qa_builder/embed_qa_dataset.py): `src/data_pipeline/qa_builder/embed_qa_dataset.py`

### Model Lifecycle

- [Model Inference](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/models/inference.py): `src/models/inference.py`
- [Model Fine-tuning](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/models/finetune.py): `src/models/finetune.py`
- [Model Evaluation](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/models/evaluator.py): `src/models/evaluator.py`

### Operations

- [Application Settings](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/config/settings.py): `src/config/settings.py`
- [MLflow Tracking](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/mlops/mlflow_utils.py): `src/mlops/mlflow_utils.py`
- [Prometheus Config](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/config/prometheus.yml): `src/config/prometheus.yml`
- [Logging](https://github.com/raushan291/enterprise-ai-assistant/blob/master/src/config/logging_config.py): `src/config/logging_config.py`

### Other components

- **User**
- **ChromaDB**
- **Redis**
- **OpenAI API**
- **Prometheus**
- **Grafana**

## Connections

- User → Chat UI: asks (evidence: `README.md`)
- User → FastAPI Service: submits query (evidence: `README.md`)
- FastAPI Service → Query and History: routes requests (evidence: `src/api/main.py`)
- Query and History → RAG Orchestrator: invokes (evidence: `src/api/routes/query.py`)
- Query and History → Conversation Memory: reads and clears (evidence: `src/api/routes/query.py`)
- Query and History → Response Cache: clears (evidence: `src/api/routes/query.py`)
- RAG Orchestrator → Safety Validation: validates input and output (evidence: `src/rag_pipeline/orchestrator.py`)
- RAG Orchestrator → Conversation Memory: reads and updates (evidence: `src/rag_pipeline/orchestrator.py`)
- RAG Orchestrator → Response Cache: checks and stores (evidence: `src/rag_pipeline/orchestrator.py`)
- RAG Orchestrator → Context Retriever: retrieves context (evidence: `src/rag_pipeline/orchestrator.py`)
- RAG Orchestrator → Prompt Builder: builds prompt (evidence: `src/rag_pipeline/orchestrator.py`)
- RAG Orchestrator → Model Inference: generates answer (evidence: `src/rag_pipeline/orchestrator.py`)
- Context Retriever → ChromaDB: queries (evidence: `src/rag_pipeline/retriever.py`)
- Context Retriever → OpenAI API: embeds when configured (evidence: `src/rag_pipeline/retriever.py`)
- Model Inference → OpenAI API: fallback generation (evidence: `src/models/inference.py`)
- Response Cache → Redis: reads and writes (evidence: `src/utils/cache.py`)
- Raw Documents → Index Builder: provides source files (evidence: `src/data_pipeline/build_chroma_db.py`)
- Index Builder → Document Loader: imports loader (evidence: `src/data_pipeline/build_chroma_db.py`)
- Index Builder → Text Chunker: imports chunker (evidence: `src/data_pipeline/build_chroma_db.py`)
- Index Builder → Text Embedder: imports embedder (evidence: `src/data_pipeline/build_chroma_db.py`)
- Index Builder → Vector Store Writer: imports writer (evidence: `src/data_pipeline/build_chroma_db.py`)
- Vector Store Writer → ChromaDB: writes documents (evidence: `src/data_pipeline/vector_store.py`)
- QA Dataset Pipeline → QA Preprocessing: preprocesses data (evidence: `src/data_pipeline/qa_builder/run_pipeline.py`)
- QA Dataset Pipeline → QA Generation: generates pairs (evidence: `src/data_pipeline/qa_builder/run_pipeline.py`)
- QA Dataset Pipeline → QA Embedding: embeds pairs (evidence: `src/data_pipeline/qa_builder/run_pipeline.py`)
- QA Dataset Pipeline → ChromaDB: stores chunks and pairs (evidence: `src/data_pipeline/qa_builder/run_pipeline.py`)
- QA Generation → RAG Orchestrator: requests generated answers (evidence: `src/data_pipeline/qa_builder/qa_generator.py`)
- QA Embedding → Text Embedder: uses embedding helpers (evidence: `src/data_pipeline/qa_builder/embed_qa_dataset.py`)
- Model Fine-tuning → Model Evaluation: uses evaluation (evidence: `src/models/finetune.py`)
- FastAPI Service → Prometheus: exposes scrape metrics (evidence: `src/api/main.py`)
- Prometheus Config → Prometheus: configures scraping (evidence: `README.md`)
- Prometheus → Grafana: supplies metrics for dashboards (evidence: `README.md`)
- FastAPI Service → Logging: gets logger (evidence: `src/api/main.py`)
