# romiconez/llamator architecture

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

- Interactive diagram: https://gitdiagram.com/romiconez/llamator
- Repository: https://github.com/romiconez/llamator

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) Core Framework Components:
- Attack Provider System
- Client Interface Layer
- Report Generation System
- Attack Data Storage

b) External Integration Points:
- LangChain Integration
- OpenAI-like API Support
- Custom Client Support (Telegram, Selenium, etc.)

##### Specific Implementation Details

- How attacks flow from the Attack Provider to Clients
- How results are collected and passed to Report Generators
- Data flow between Attack Data Storage and Attack Provider
- Integration points with external services

##### Key Architectural Patterns to Highlight

- Registry Pattern (attack_registry.py)
- Factory Pattern (chat_client.py)
- Strategy Pattern (different attack implementations)
- Observer Pattern (work_progress_pool.py)

##### Important Relationships

Critical interactions:
- Attack Provider → Client Interface
- Client Interface → External Services
- Report Generators ← Test Results
- Attack Data Storage → Attack Provider

##### Additional Elements

Include:
- Version information
- Supported languages (Russian/English) indication
- License information reference

##### Technical Details

Key technical aspects:
- Python-based framework
- Parquet file format for attack data
- JSON configuration support
- Multiple output formats (CSV, Excel, DOCX)

Remember to indicate the extensibility points where custom attacks can be integrated, as this is a unique feature of the system.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef core fill:#2374ab,color:white
    classDef external fill:#7dba84,color:black
    classDef data fill:#f2c14e,color:black
    classDef attack fill:#d64933,color:white
    classDef utility fill:#808080,color:white

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[External Integrations]:::external
        L3[Data Storage]:::data
        L4[Attack Components]:::attack
        L5[Utility Components]:::utility
    end

    %% Client Layer
    subgraph "Client Layer"
        LC["LangChain Client"]:::external
        OA["OpenAI API"]:::external
        CC["Custom Clients"]:::external
    end

    %% Core Framework
    subgraph "Core Framework"
        %% Attack Provider Module
        subgraph "Attack Provider"
            AR["Attack Registry"]:::attack
            AL["Attack Loader"]:::attack
            WP["Work Progress Pool"]:::core
        end

        %% Client Module
        subgraph "Client Interface"
            CB["Chat Client Base"]:::core
            CCF["Client Configuration"]:::core
            AC["Attack Configuration"]:::core
            LI["LangChain Integration"]:::external
        end

        %% Report Generation
        subgraph "Report Generators"
            EG["Excel Generator"]:::utility
            WG["Word Generator"]:::utility
        end
    end

    %% Data Layer
    subgraph "Data Layer"
        ADS["Attack Data Storage"]:::data
        AD["Attack Descriptions"]:::data
        TR["Test Results"]:::data
    end

    %% Attack Implementations
    subgraph "Attack Types"
        DAN["DAN Attack"]:::attack
        UCAR["UCAR Attack"]:::attack
        B64["Base64 Injection"]:::attack
        EC["Ethical Compliance"]:::attack
    end

    %% Connections
    LC & OA & CC --> CB
    AR --> AL
    AL --> WP
    WP --> CB
    CB --> CCF
    CB --> AC
    LI --> CB
    ADS --> AL
    AD --> AR
    CB --> TR
    TR --> EG & WG
    AR --> DAN & UCAR & B64 & EC

    %% Click Events
    click AR "https://github.com/RomiconEZ/llamator/blob/release/src/llamator/attack_provider/attack_registry.py"
    click AL "https://github.com/RomiconEZ/llamator/blob/release/src/llamator/attack_provider/attack_loader.py"
    click WP "https://github.com/RomiconEZ/llamator/blob/release/src/llamator/attack_provider/work_progress_pool.py"
    click CB "https://github.com/RomiconEZ/llamator/blob/release/src/llamator/client/chat_client.py"
    click CCF "https://github.com/RomiconEZ/llamator/blob/release/src/llamator/client/client_config.py"
    click AC "https://github.com/RomiconEZ/llamator/blob/release/src/llamator/client/attack_config.py"
    click LI "https://github.com/RomiconEZ/llamator/blob/release/src/llamator/client/langchain_integration.py"
    click EG "https://github.com/RomiconEZ/llamator/blob/release/src/llamator/report_generators/excel_report_generator.py"
    click WG "https://github.com/RomiconEZ/llamator/blob/release/src/llamator/report_generators/word_report_generator.py"
    click ADS "https://github.com/RomiconEZ/llamator/tree/release/src/llamator/attack_data/"
    click AD "https://github.com/RomiconEZ/llamator/blob/release/src/llamator/attacks/attack_descriptions.json"
    click DAN "https://github.com/RomiconEZ/llamator/blob/release/src/llamator/attacks/dan.py"
    click UCAR "https://github.com/RomiconEZ/llamator/blob/release/src/llamator/attacks/ucar.py"
    click B64 "https://github.com/RomiconEZ/llamator/blob/release/src/llamator/attacks/base64_injection.py"
    click EC "https://github.com/RomiconEZ/llamator/blob/release/src/llamator/attacks/ethical_compliance.py"
```
