# xalp/echo architecture

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

- Interactive diagram: https://gitdiagram.com/xalp/echo
- Repository: https://github.com/xalp/echo

## Overview

##### Main Components

a) Data Processing Layer
- Dataset Handler (Multiple datasets: AQuA, AddSub, CommonsenseQA, etc.)
- Demo Creation Module
- Log Management System

b) Core Processing Layer
- ECHO Engine
- Zero-Shot CoT Processor
- Inference Engine (with parallel processing capability)

c) Model Integration Layer
- OpenAI API Interface
- Mistral API Interface

d) Output/Results Layer
- Demonstration Storage
- Performance Logging

##### Specific Design Elements

- Rectangle: Core processing modules
- Hexagon: API endpoints
- Rounded Rectangle: Processing results

##### Implementation Details

Technical annotations:
- Model specifications (GPT-3.5-turbo-0301)
- Supported datasets (10 different types)
- Demo variations (8-32 demonstrations)
- Processing parameters (T=4 recommended)

##### Key Features to Highlight

Architectural elements:
- Parallel inference capability (20x speed improvement)
- Demo selection clustering mechanism
- Self-harmonization process
- Multiple model support (OpenAI, Mistral)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef data fill:#E6F3FF,stroke:#666
    classDef core fill:#FFEB99,stroke:#666
    classDef api fill:#90EE90,stroke:#666
    classDef storage fill:#E6E6E6,stroke:#666
    classDef output fill:#E6E6FF,stroke:#666

    %% Legend
    subgraph Legend
        L1[Data Processing]:::data
        L2[Core Processing]:::core
        L3[API Integration]:::api
        L4[Storage]:::storage
        L5[Output/Results]:::output
    end

    %% Data Processing Layer
    subgraph DataLayer[Data Processing Layer]
        DH[Dataset Handler]:::data
        DCM[Demo Creation Module]:::data
        LMS[Log Management System]:::data
    end

    %% Core Processing Layer
    subgraph CoreLayer[Core Processing Layer]
        ECHO[ECHO Engine]:::core
        ZSC[Zero-Shot CoT Processor]:::core
        IE[Inference Engine]:::core
    end

    %% Model Integration Layer
    subgraph APILayer[Model Integration Layer]
        OAI[OpenAI API Interface]:::api
        MAI[Mistral API Interface]:::api
    end

    %% Output Layer
    subgraph OutputLayer[Output/Results Layer]
        DS[Demonstration Storage]:::storage
        PL[Performance Logging]:::output
    end

    %% Relationships
    DH --> DCM
    DCM --> ECHO
    ECHO --> ZSC
    ZSC --> IE
    IE --> OAI & MAI
    OAI & MAI --> PL
    DCM --> DS
    LMS --> PL

    %% Notes
    note[Note: T=4 recommended<br/>8-32 demonstrations<br/>20x speed improvement]

    %% Click events
    click DH "https://github.com/Xalp/ECHO/tree/main/dataset"
    click DCM "https://github.com/Xalp/ECHO/blob/main/run_demo.py"
    click LMS "https://github.com/Xalp/ECHO/tree/main/log"
    click ECHO "https://github.com/Xalp/ECHO/blob/main/run_ECHO.py"
    click ZSC "https://github.com/Xalp/ECHO/blob/main/zero_shot_cot.py"
    click IE "https://github.com/Xalp/ECHO/blob/main/run_inference.py"
    click MAI "https://github.com/Xalp/ECHO/blob/main/run_inference_mistral_api.py"
    click DS "https://github.com/Xalp/ECHO/tree/main/demos"
    click PL "https://github.com/Xalp/ECHO/blob/main/log/*.log"
```
