# taiyoung12/rag-poc-was architecture

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

- Interactive diagram: https://gitdiagram.com/taiyoung12/rag-poc-was
- Repository: https://github.com/taiyoung12/rag-poc-was

## Overview

##### Main Components

a) Client Layer:
- Both REST endpoints (WebController, RagController, HealthCheckController)

b) Application Layer:
- Inside this container, create sections for:
- Controllers Package (handling HTTP requests)
- Service Layer (RagService, RagListener)
- Base Components (exception handling, response formatting)

c) Message Queue Layer:
- Message queues (use QueueName.kt definitions)
- MessageSender and QueueManagement components

d) External Services Layer:
- External LLM API component
- ExternalApiClient connection

##### Detailed Component Breakdown

For each major component, include:

a) Controllers:
- HealthCheckController
- RagController
- WebController

b) Service Layer:
- RagService
- RagListener

c) Message Handling:
- MessageSender
- QueueManagement
- RagMessage structure

d) Base Components:
- Exception handling
- Response formatting
- Configuration (FeignConfig, RabbitMqConfig)

##### Technical Details

- Spring Boot 3.3.2 framework
- Kotlin as the programming language
- RabbitMQ message queue
- External LLM API integration
- JUnit test framework

Remember to emphasize the asynchronous nature of the system, showing how the RabbitMQ integration enables decoupled processing of RAG requests and responses.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        WC[Web Client]
    end

    subgraph "Spring Boot Application"
        direction TB
        
        subgraph Controllers
            HC["HealthCheckController"]:::controller
            RC["RagController"]:::controller
            WBC["WebController"]:::controller
        end

        subgraph Services
            RS["RagService"]:::service
            RL["RagListener"]:::service
        end

        subgraph "Message Components"
            MS["MessageSender"]:::queue
            QM["QueueManagement"]:::queue
            QN["QueueName"]:::queue
            RM["RagMessage"]:::queue
        end

        subgraph "Base Components"
            BE["BaseException"]:::base
            RE["Response"]:::base
            EX["Exception"]:::base
        end

        subgraph Configuration
            FC["FeignConfig"]:::config
            RMC["RabbitMqConfig"]:::config
            AL["application-local.yml"]:::config
            AT["application-test.yml"]:::config
        end

        subgraph "Response Models"
            LLMR["LLMResponse"]:::model
            RR["RagResponse"]:::model
        end

        subgraph "Exception Handling"
            RAGE["RagException"]:::error
            MT["MsgType"]:::error
        end

        MA["PocApplication"]:::main
    end

    subgraph "Message Queue"
        RMQ[RabbitMQ]:::queue
    end

    subgraph "External Services"
        EAC["External LLM API Client"]:::external
    end

    %% Connections
    WC --> HC & RC & WBC
    RC --> MS
    MS --> RMQ
    RMQ --> RL
    RL --> RS
    RS --> EAC
    EAC --> RS
    RS --> RR
    
    %% Click Events
    click MA "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/PocApplication.kt"
    click HC "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/controller/HealthCheckController.kt"
    click RC "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/controller/RagController.kt"
    click WBC "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/controller/WebController.kt"
    click RS "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/service/RagService.kt"
    click RL "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/service/RagListener.kt"
    click MS "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/rabbitmq/queue/MessageSender.kt"
    click QM "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/rabbitmq/queue/QueueManagement.kt"
    click QN "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/rabbitmq/queue/QueueName.kt"
    click RM "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/rabbitmq/message/RagMessage.kt"
    click EAC "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/util/ExternalApiClient.kt"
    click BE "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/base/exception/BaseException.kt"
    click RE "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/base/response/Response.kt"
    click EX "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/base/response/Exception.kt"
    click FC "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/conifg/FeignConfig.kt"
    click RMC "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/conifg/RabbitMqConfig.kt"
    click AL "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/resources/application-local.yml"
    click AT "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/resources/application-test.yml"
    click LLMR "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/controller/response/LLMResponse.kt"
    click RR "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/controller/response/RagResponse.kt"
    click RAGE "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/message/RagException.kt"
    click MT "https://github.com/taiyoung12/rag-poc-was/blob/main/src/main/kotlin/com/rag/poc/message/MsgType.kt"

    %% Styles
    classDef main fill:#1e88e5,stroke:#13579e,color:white
    classDef controller fill:#42a5f5,stroke:#1976d2,color:white
    classDef service fill:#90caf9,stroke:#42a5f5,color:black
    classDef queue fill:#81c784,stroke:#4caf50,color:black
    classDef base fill:#ce93d8,stroke:#ab47bc,color:white
    classDef config fill:#fff59d,stroke:#fdd835,color:black
    classDef model fill:#ffcc80,stroke:#ff9800,color:black
    classDef error fill:#ef9a9a,stroke:#e57373,color:black
    classDef external fill:#f48fb1,stroke:#ec407a,color:white

    %% Legend
    subgraph Legend
        L1[Main Application]:::main
        L2[Controllers]:::controller
        L3[Services]:::service
        L4[Queue Components]:::queue
        L5[Base Components]:::base
        L6[Configuration]:::config
        L7[Response Models]:::model
        L8[Error Handling]:::error
        L9[External Services]:::external
    end
```
