# vishalmysore/tools4ai architecture

> Architecture diagram of the GitHub repository vishalmysore/tools4ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vishalmysore/tools4ai
- Repository: https://github.com/vishalmysore/tools4ai

## Overview

##### Main Components Identification

a) Core Processing Layer:
- Action Processors (OpenAI, Gemini, Anthropic)
- Spring Integration Components
- Selenium Integration Components

b) Prediction Layer:
- Java Prediction Loader
- HTTP/Swagger Prediction Loader
- Shell Prediction Loader
- Extended Prediction Loader

c) Action Layer:
- Java Actions
- HTTP Actions
- Shell Actions
- Custom Actions

d) Validation Layer:
- Hallucination Detection
- Bias Detection
- Guard Rails

**[User/Client Layer]**
- ↓
**[Integration Layer (Spring/Selenium)]**
- ↓
**[Processing Layer]**
- ↓
**[Prediction Layer]**
- ↓
**[Action Layer]**
- ↓
**[Validation Layer]**

##### Component Relationships

Following interactions:
- Validation Layer connections to Processing Layer
- Integration Layer connections to external systems

##### Specific Implementation Details

Key elements:
**[Processing Layer]**
- AIActionProcessor
- OpenAIProcessor
- GeminiProcessor
- AnthropicProcessor
- ImageProcessor
- ScriptProcessor

**[Prediction Layer]**
- JavaPredictionLoader
- SwaggerPredictionLoader
- ShellPredictionLoader
- ExtendedPredictionLoader

**[Action Layer]**
- JavaMethodActions
- HttpPredictedActions
- ShellPredictedActions
- ExtendedPredictedActions

**[Validation Layer]**
- HallucinationDetector
- BiasDetector
- GuardRails

##### External Integrations

Connections to:
- Spring Framework
- Selenium WebDriver
- External AI Services (OpenAI, Gemini, Anthropic)
- HTTP/REST Services
- Shell/Script Systems

##### Additional Elements

Include:
- Version information
- Data flow indicators
- Security boundaries
- Error handling paths

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef core fill:#E1F5FE,stroke:#01579B
    classDef safety fill:#C8E6C9,stroke:#1B5E20
    classDef ai fill:#E1BEE7,stroke:#4A148C
    classDef action fill:#FFE0B2,stroke:#E65100
    classDef external fill:#EEEEEE,stroke:#424242
    classDef app fill:#B3E5FC,stroke:#01579B

    %% Application Layer
    subgraph Applications
        GameEngine["Game Engine"]:::external
        GameAI["Game AI Application"]:::app
        WebServices["Web Services"]:::app
        ShellScripts["Shell Scripts"]:::app
    end

    %% Core Processing Layer
    subgraph ProcessingLayer["Action Processing Layer"]
        ActionProcessor["Action Processor"]:::core
        JavaAct["Java Actions"]:::action
        HTTPAct["HTTP/REST Actions"]:::action
        ShellAct["Shell Actions"]:::action
    end

    %% AI Integration Layer
    subgraph AILayer["AI Platform Integration"]
        OpenAI["OpenAI"]:::ai
        Gemini["Gemini"]:::ai
        Anthropic["Anthropic"]:::ai
    end

    %% Safety Layer
    subgraph SafetyLayer["Safety & Detection Layer"]
        HallDet["Hallucination Detection"]:::safety
        BiasDet["Bias Detection"]:::safety
        GuardRails["Guard Rails"]:::safety
    end

    %% Side Systems
    PredictionSystem["Prediction System"]:::core
    TransformSystem["Transformation System"]:::core

    %% Connections
    GameEngine --> GameAI
    GameAI --> ActionProcessor
    WebServices --> ActionProcessor
    ShellScripts --> ActionProcessor

    ActionProcessor --> JavaAct
    ActionProcessor --> HTTPAct
    ActionProcessor --> ShellAct

    JavaAct --> AILayer
    HTTPAct --> AILayer
    ShellAct --> AILayer

    AILayer --> OpenAI
    AILayer --> Gemini
    AILayer --> Anthropic

    AILayer --> SafetyLayer
    SafetyLayer --> HallDet
    SafetyLayer --> BiasDet
    SafetyLayer --> GuardRails

    PredictionSystem --> ActionProcessor
    TransformSystem --> ActionProcessor

    %% Click Events
    click ActionProcessor "https://github.com/vishalmysore/Tools4AI/tree/main/src/main/java/com/t4a/processor/"
    click OpenAI "https://github.com/vishalmysore/Tools4AI/blob/main/src/main/java/com/t4a/processor/OpenAiActionProcessor.java"
    click Gemini "https://github.com/vishalmysore/Tools4AI/blob/main/src/main/java/com/t4a/processor/GeminiV2ActionProcessor.java"
    click Anthropic "https://github.com/vishalmysore/Tools4AI/blob/main/src/main/java/com/t4a/processor/AnthropicActionProcessor.java"
    click JavaAct "https://github.com/vishalmysore/Tools4AI/blob/main/src/main/java/com/t4a/api/JavaMethodAction.java"
    click HTTPAct "https://github.com/vishalmysore/Tools4AI/tree/main/src/main/java/com/t4a/action/http/"
    click ShellAct "https://github.com/vishalmysore/Tools4AI/tree/main/src/main/java/com/t4a/action/shell/"
    click HallDet "https://github.com/vishalmysore/Tools4AI/blob/main/src/main/java/com/t4a/detect/HallucinationDetectorType.java"
    click BiasDet "https://github.com/vishalmysore/Tools4AI/blob/main/src/main/java/com/t4a/detect/BiasDetector.java"
    click GuardRails "https://github.com/vishalmysore/Tools4AI/blob/main/src/main/java/com/t4a/api/GuardRails.java"
    click PredictionSystem "https://github.com/vishalmysore/Tools4AI/tree/main/src/main/java/com/t4a/predict/"
    click TransformSystem "https://github.com/vishalmysore/Tools4AI/tree/main/src/main/java/com/t4a/transform/"
    click SafetyLayer "https://github.com/vishalmysore/Tools4AI/tree/main/src/main/java/com/t4a/detect/"

    %% Legend
    subgraph Legend
        L1["→ Action Flow"]
        L2["⊗ Integration Point"]
        L3["⚡ Safety Check"]
        L4["🧠 AI Processing"]
        L5["🎮 Game State"]
    end
```
