# kenneth-pro/generativeai architecture

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

- Interactive diagram: https://gitdiagram.com/kenneth-pro/generativeai
- Repository: https://github.com/kenneth-pro/generativeai

## Overview

##### High-Level System Overview

- LLM Chatbot
- Agents System
- RAG (Retrieval Augmented Generation) System

##### Detailed Component Breakdown

A. LLM Chatbot Component:
- It to the Ollama LLM component
- Voice output component
- A component for chatbot.py as the orchestrator

B. Agents System Component:
- Create three sub-sections for different agent types:
- Web Searching Agents
- Coding Agents (with data_titanic.csv and database.db integration)
- From Scratch Agents
- How agents.py coordinates these components

C. RAG System Component:
- Document ingestion pipeline (PDF handling)
- Vector database component
- Query processing flow
- Rag_app.py as the main application controller
- How the data directory integrates with the system

##### Technical Stack Representation

- Blue: Core LLM components (Ollama)
- Green: Data storage components (database.db, vector stores)
- Yellow: Processing components (agents, RAG pipeline)
- Gray: Input/Output interfaces

##### Integration Points

How each system can:
- Access shared requirements from requirements.txt
- Operate independently
- Share common utilities or resources

## Diagram (Mermaid)

```mermaid
graph TB
    %% Main Systems
    subgraph MainSystems
        LLM[LLM Chatbot System]:::core
        AG[Agents System]:::core
        RAG[RAG System]:::core
    end

    %% LLM Chatbot Components
    subgraph ChatbotSystem
        SR[Speech Recognition]:::io
        CB[Chatbot Controller]:::controller
        VO[Voice Output]:::io
        OL[Ollama LLM]:::external
        
        SR --> CB
        CB <--> OL
        CB --> VO
    end

    %% Agents System Components
    subgraph AgentsSystem
        subgraph WebSearching
            WA[Web Searching Agents]:::agent
            WS[Web Services]:::external
            WA <--> WS
        end

        subgraph CodingAgents
            CA[Coding Agents]:::agent
            TD[(Titanic Dataset)]:::data
            DB[(SQLite Database)]:::data
            CA --> TD
            CA --> DB
        end

        subgraph FromScratch
            FA[From Scratch Agents]:::agent
        end
    end

    %% RAG System Components
    subgraph RAGSystem
        RC[RAG Controller]:::controller
        DP[Document Processor]:::processor
        VDB[(Vector Database)]:::data
        DD[Document Storage]:::storage
        SD[Sample Document]:::file

        DD --> DP
        SD --> DP
        DP --> VDB
        RC <--> VDB
    end

    %% Shared Resources
    DEP[Requirements.txt]:::config
    DOC[Documentation]:::docs

    %% Connections between main systems
    LLM --- AG
    AG --- RAG

    %% Component connections
    LLM --> CB
    AG --> WA
    AG --> CA
    AG --> FA
    RAG --> RC

    %% Click events for component mapping
    click LLM "https://github.com/kenneth-pro/GenerativeAI/blob/main/Chatbot/chatbot.py"
    click WA "https://github.com/kenneth-pro/GenerativeAI/blob/main/Agents_WebSearching/agents.py"
    click CA "https://github.com/kenneth-pro/GenerativeAI/tree/main/Agents_Coding/"
    click FA "https://github.com/kenneth-pro/GenerativeAI/tree/main/Agents_fromScratch/"
    click RC "https://github.com/kenneth-pro/GenerativeAI/blob/main/RAG/rag_app.py"
    click DD "https://github.com/kenneth-pro/GenerativeAI/tree/main/RAG/data/"
    click SD "https://github.com/kenneth-pro/GenerativeAI/blob/main/RAG/data/doc_nvidia.pdf"
    click TD "https://github.com/kenneth-pro/GenerativeAI/blob/main/Agents_Coding/data_titanic.csv"
    click DB "https://github.com/kenneth-pro/GenerativeAI/blob/main/Agents_Coding/database.db"
    click DEP "https://github.com/kenneth-pro/GenerativeAI/blob/main/requirements.txt"
    click DOC "https://github.com/kenneth-pro/GenerativeAI/tree/main/_docs/"

    %% Styling
    classDef core fill:#2374ab,stroke:#000,stroke-width:2px
    classDef controller fill:#48cae4,stroke:#000
    classDef processor fill:#90e0ef,stroke:#000
    classDef agent fill:#ade8f4,stroke:#000
    classDef data fill:#caf0f8,stroke:#000
    classDef storage fill:#bee1e6,stroke:#000
    classDef external fill:#fb8500,stroke:#000
    classDef io fill:#ffb703,stroke:#000
    classDef config fill:#8ecae6,stroke:#000
    classDef docs fill:#219ebc,stroke:#000
    classDef file fill:#e9ecef,stroke:#000
```
