# abinesha312/gemmagenai architecture

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

- Interactive diagram: https://gitdiagram.com/abinesha312/gemmagenai
- Repository: https://github.com/abinesha312/gemmagenai

## Overview

##### Project type and purpose
- This is a full-stack AI assistant: a real-time web UI built with Chainlit talks to a Python multi-agent backend, which in turn offloads heavy neural inference to a vLLM service running on NVIDIA H100 GPUs.
- Purpose: provide specialized academic support (email composition, research guidance, campus info) via modular, domain-specific agents.

##### File structure
- Top-level directories and files:
- .chainlit/ (UI config & locales)
- demo/ (video & screenshots)
- docker-compose.yml, podman-compose.yml, Containerfile.chainlit, Containerfile.vllm, podman_run.sh (deployment scripts)
- run.py, setup.py, requirements.txt
- src/ (application code)
- src/ breakdown:
- src/app.py – Chainlit server entrypoint
- src/agents/ – base_agent.py, registry.py, specialized_agents.py
- src/config/ – prompts.py, redis_config.py, settings.py
- src/models/ – classification.py (TF-IDF & cosine similarity), query_models.py
- src/utils/ – redis_manager.py, vector_db.py
- src/services/ – (any orchestrators or wrappers)

##### README for additional insights
- **Frontend**: Chainlit real-time web interface, handles routing & formatting
- **Inference**: vLLM hosting Gemma-3-27B & LLaMa 3.2 90B Vision models, optimized for parallel GPU inference
- **Data stores**: Redis for caching/session state; FAISS vector store for retrieval-augmented generation
- **Architecture**: modular multi-agent pipeline, intelligent query classification, containerized via Podman/Docker Compose on multi-GPU hosts

##### Detail
- Break out the **Application Backend** into sub-modules: Agent Registry, BaseAgent, Specialized Agents, config & utils
- Orchestration layer (docker-compose/podman-compose) as the deployment boundary
- Protocols and ports (WebSocket: 8000, gRPC: 50051, Redis: 6379)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer"
        Browser["Browser Client"]:::client
        ChainlitUI["Chainlit Frontend Server"]:::frontend
        ChainlitConfig["Chainlit Config"]:::frontend
        ChainlitTrans["Chainlit Translations"]:::frontend
        Browser -->|WebSocket/HTTP: 8000| ChainlitUI
        ChainlitUI -->|loads| ChainlitConfig
        ChainlitUI -->|loads| ChainlitTrans
    end

    %% Container and App Layer
    subgraph "Container Boundary"
        direction TB
        ContainerChainlit["Chainlit Frontend Container"]:::orchestration
        subgraph "Application Backend Container"
            direction TB
            AgentManager["Agent Manager"]:::backend
            Prompts["Prompt Definitions"]:::backend
            Settings["App Settings"]:::backend
            RedisConfig["Redis Configuration"]:::backend
            Services["Service Wrappers"]:::backend
            Classifier["Classification Models"]:::backend
            QueryModels["Query Embedding Models"]:::backend
            RedisMgr["Redis Manager"]:::data
            VectorDB["Vector DB Integration"]:::data
            AgentManager -->|uses prompts| Prompts
            AgentManager -->|reads settings| Settings
            AgentManager -->|uses config| RedisConfig
            AgentManager -->|orchestrates| Services
            AgentManager -->|classifies| Classifier
            AgentManager -->|embeds queries| QueryModels
            AgentManager -->|manages cache| RedisMgr
            AgentManager -->|manages vectors| VectorDB
            ChainlitUI -->|API calls| AgentManager
        end
        subgraph "Inference Container"
            direction TB
            vLLMContainer["vLLM Inference Container"]:::orchestration
            GPUCluster["GPU Cluster (8× H100 GPUs)"]:::inference
            vLLMContainer -->|executes| GPUCluster
        end
    end

    %% Data Stores
    Redis["Redis Cache"]:::data
    VectorStore["FAISS Vector Store"]:::data

    %% Orchestration
    Compose["Container Orchestration"]:::orchestration
    DemoAssets["Demo Assets"]:::orchestration

    %% Flows between services
    AgentManager -->|read/write: 6379| Redis
    AgentManager -->|query| VectorStore
    AgentManager -->|gRPC call: 50051| vLLMContainer
    vLLMContainer -->|token stream| AgentManager
    AgentManager -->|response| ChainlitUI

    %% Orchestration links
    Compose -.-> ContainerChainlit
    Compose -.-> vLLMContainer
    Compose -.-> Redis
    Compose -.-> VectorStore
    DemoAssets

    %% Click Events
    click Browser "https://github.com/abinesha312/gemmagenai/tree/main/public/"
    click ChainlitUI "https://github.com/abinesha312/gemmagenai/blob/main/src/app.py"
    click ChainlitConfig "https://github.com/abinesha312/gemmagenai/blob/main/.chainlit/config.toml"
    click ChainlitTrans "https://github.com/abinesha312/gemmagenai/tree/main/.chainlit/translations/"
    click ContainerChainlit "https://github.com/abinesha312/gemmagenai/blob/main/Containerfile.chainlit"
    click AgentManager "https://github.com/abinesha312/gemmagenai/blob/main/src/agents/registry.py"
    click AgentManager "https://github.com/abinesha312/gemmagenai/blob/main/src/agents/base_agent.py"
    click AgentManager "https://github.com/abinesha312/gemmagenai/blob/main/src/agents/specialized_agents.py"
    click Prompts "https://github.com/abinesha312/gemmagenai/blob/main/src/config/prompts.py"
    click Settings "https://github.com/abinesha312/gemmagenai/blob/main/src/config/settings.py"
    click RedisConfig "https://github.com/abinesha312/gemmagenai/blob/main/src/config/redis_config.py"
    click RedisMgr "https://github.com/abinesha312/gemmagenai/blob/main/src/utils/redis_manager.py"
    click Classifier "https://github.com/abinesha312/gemmagenai/blob/main/src/models/classification.py"
    click QueryModels "https://github.com/abinesha312/gemmagenai/blob/main/src/models/query_models.py"
    click VectorDB "https://github.com/abinesha312/gemmagenai/blob/main/src/utils/vector_db.py"
    click Services "https://github.com/abinesha312/gemmagenai/tree/main/src/services/"
    click vLLMContainer "https://github.com/abinesha312/gemmagenai/blob/main/Containerfile.vllm"
    click Compose "https://github.com/abinesha312/gemmagenai/blob/main/docker-compose.yml"
    click Compose "https://github.com/abinesha312/gemmagenai/blob/main/podman-compose.yml"
    click Compose "https://github.com/abinesha312/gemmagenai/blob/main/podman_run.sh"
    click Compose "https://github.com/abinesha312/gemmagenai/blob/main/run.py"
    click Compose "https://github.com/abinesha312/gemmagenai/blob/main/run_podman.sh"
    click DemoAssets "https://github.com/abinesha312/gemmagenai/tree/main/demo/"

    %% Styles
    classDef client fill:#f9f,stroke:#333
    classDef frontend fill:#bbf,stroke:#333
    classDef backend fill:#bfb,stroke:#333
    classDef data fill:#ffa,stroke:#333
    classDef inference fill:#fbb,stroke:#333
    classDef orchestration fill:#ddd,stroke:#333,stroke-dasharray:5 5
```
