# foundation-model-stack/fms-dgt architecture

> Architecture diagram of the GitHub repository foundation-model-stack/fms-dgt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/foundation-model-stack/fms-dgt
- Repository: https://github.com/foundation-model-stack/fms-dgt

## Overview

##### Project Type and Core Purpose
This is a framework for generating synthetic data using Large Language Models (LLMs). The system is designed to be modular, scalable, and supports multiple LLM providers.

##### Main Components

a. Core Framework Components:
- Base Layer (fms_dgt/base/): Contains fundamental abstractions
- Blocks Layer (fms_dgt/blocks/): Implements core functionalities
- DataBuilders Layer (fms_dgt/databuilders/): Handles data generation logic
- Resources Layer (fms_dgt/resources/): Manages external resources

b. External Integrations:
- LLM Providers:
- IBM GenAI
- OpenAI
- vLLM
- RITS
- Data Processing Tools:
- IBM Data Prep Kit (DPK)

**┌─ External Layer ─────────────────────┐**
- [LLM Providers] [Processing Tools]   │
- ┘
- ↑
**┌─ Resource Management Layer ──────────┐**
- [API Handlers] [GPU Management]      │
- ┘
- ↑
**┌─ Core Processing Layer ──────────────┐**
- [Generators] [Validators] [Pipeline] │
- ┘
- ↑
**┌─ Data Management Layer ─────────────┐**
- [DataBuilders] [DataLoaders] [Store]│
- ┘

##### Specific Implementation Details

**┌─ Blocks ─────────┐**
- Generators     │
- Validators     │
- Postprocessors │
- Trainers      │
- ┘

##### Additional Elements

- A configuration section showing the relationship between .env files and API configurations
- Parallel processing capabilities
- Validation and quality control points

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and Classes
    classDef external fill:#90EE90,stroke:#333,stroke-width:2px
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:2px
    classDef processing fill:#FFE4B5,stroke:#333,stroke-width:2px
    classDef data fill:#D3D3D3,stroke:#333,stroke-width:2px
    classDef resource fill:#DDA0DD,stroke:#333,stroke-width:2px

    %% External Layer
    subgraph ExternalLayer["External Integrations"]
        LLMProviders["LLM Providers"]
        IBMGenAI["IBM GenAI"]:::external
        OpenAI["OpenAI"]:::external
        vLLM["vLLM"]:::external
        RITS["RITS"]:::external
        DPK["IBM Data Prep Kit"]:::external
        
        LLMProviders --> IBMGenAI & OpenAI & vLLM & RITS
    end

    %% Resource Management Layer
    subgraph ResourceLayer["Resource Management"]
        APIResources["API Resources"]:::resource
        GPUManagement["GPU Management"]:::resource
        WatsonResources["Watson Resources"]:::resource
    end

    %% Core Processing Layer
    subgraph CoreLayer["Core Processing"]
        Generators["Generators"]:::core
        Validators["Validators"]:::core
        Pipeline["Pipeline"]:::core
        PostProcessors["Post Processors"]:::core
    end

    %% Data Management Layer
    subgraph DataLayer["Data Management"]
        DataBuilders["Data Builders"]:::data
        DataLoaders["Data Loaders"]:::data
        DataStore["Data Store"]:::data
    end

    %% Relationships
    ExternalLayer --> ResourceLayer
    ResourceLayer --> CoreLayer
    CoreLayer --> DataLayer

    %% Click Events
    click APIResources "https://github.com/foundation-model-stack/fms-dgt/blob/main/fms_dgt/resources/api.py"
    click GPUManagement "https://github.com/foundation-model-stack/fms-dgt/blob/main/fms_dgt/resources/gpu.py"
    click WatsonResources "https://github.com/foundation-model-stack/fms-dgt/blob/main/fms_dgt/resources/watsonx.py"
    click Generators "https://github.com/foundation-model-stack/fms-dgt/tree/main/fms_dgt/blocks/generators/"
    click Validators "https://github.com/foundation-model-stack/fms-dgt/tree/main/fms_dgt/blocks/validators/"
    click Pipeline "https://github.com/foundation-model-stack/fms-dgt/blob/main/fms_dgt/blocks/compositions/sequence.py"
    click DataBuilders "https://github.com/foundation-model-stack/fms-dgt/tree/main/fms_dgt/databuilders/"
    click DataLoaders "https://github.com/foundation-model-stack/fms-dgt/blob/main/fms_dgt/dataloaders/default.py"
    click DataStore "https://github.com/foundation-model-stack/fms-dgt/blob/main/fms_dgt/datastores/default.py"
    click IBMGenAI "https://github.com/foundation-model-stack/fms-dgt/blob/main/fms_dgt/blocks/generators/genai.py"
    click OpenAI "https://github.com/foundation-model-stack/fms-dgt/blob/main/fms_dgt/blocks/generators/openai.py"
    click vLLM "https://github.com/foundation-model-stack/fms-dgt/tree/main/fms_dgt/blocks/generators/vllm/"
    click DPK "https://github.com/foundation-model-stack/fms-dgt/tree/main/fms_dgt/blocks/postprocessors/dpk/"

    %% Legend
    subgraph Legend
        L1["External Services"]:::external
        L2["Core Components"]:::core
        L3["Processing Units"]:::processing
        L4["Data Components"]:::data
        L5["Resource Management"]:::resource
    end
```
