# otrf/genai-security-adventures architecture

> Architecture diagram of the GitHub repository otrf/genai-security-adventures, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/otrf/genai-security-adventures
- Repository: https://github.com/otrf/genai-security-adventures

## Overview

##### Main Components
- Jupyter Book & Documentation: The root contains configuration files (_config.yml, _toc.yml) and a README that indicates this is a Jupyter Book project serving as a documentation and presentation hub.
- Experiments: This is the heart of the repository. Under the “experiments” directory, you see distinct subdirectories:
- Agents (with further experiments like Chain-of-Thought and tool-calling agents)
- Basics (containing several introductory experiments and supporting scripts)
- Bloodhound-GPT (which includes database creation logic and a Dockerfile, indicating heavier integration and possibly stateful components)
- ExternalAPIs (demonstrating integrations, e.g., with MSGraph, with supporting OpenAPI specs)
- Local-GPT (a collection of experiments running local variants of generative models)
- RAG (focused on Threat Intelligence with Retrieval-Augmented Generation experiments, including extensive document sets and notebooks)
- ROADTools-GPT (which has database components, suggesting its role in network or reconnaissance tasks)
- Getting Started: A lightweight guide that introduces fundamental concepts in AI and deep learning, which supports the hands-on experiments.
- Images: Supporting assets for documentation or instructions (API keys illustration).

- Document the high-level separation between the documentation (Jupyter Book) and the experiments. Represent the Jupyter Book as a central hub that references all experiments.
- Agents Module: Highlighting the different strategic approaches (CoT, ReAct, Tool-Calling) and the notebooks that demonstrate each.
- Basics Module: Represent experiments that illustrate fundamental interactions with LLMs (chat completions, sentiment analysis, tokenizing).
- Threat Intelligence/RAG Module: Show a detailed view of how document sources, intermediate processing (source-knowledge, templates), and notebook-based analyses interact.
- Local Integration Components: Sketch how local model experiments (Local-GPT, Ollama setups) are separated from cloud-based or API-driven experiments.
- Database/Stateful Components: In Bloodhound-GPT and ROADTools-GPT, emphasize the handling of databases and associated scripts/tools (like DBCreator in Bloodhound-GPT and the roadrecon.db in ROADTools-GPT).
- Cross-Cutting Concerns:
- Security and LLM integration as a conceptual overlay across all experiments.
- Reusable code scripts (e.g., m365d.py, requirements.txt) that ensure consistency for local dependencies.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Documentation Subgraph
    subgraph "Documentation (Jupyter Book)"
        D1["Configuration"]:::documentation
        D2["Table of Contents"]:::documentation
        D3["README"]:::documentation
    end

    %% Additional Guides and Assets
    G1["Getting Started Guide"]:::documentation
    A1["Assets/Images"]:::documentation

    %% Experiments Subgraph
    subgraph "Experiments"
        E0["Main Experiments Container"]:::experiments
        E1["Agents Module"]:::experiments
        E2["Basics Module"]:::experiments
        E2a["Basics Scripts"]:::experiments
        E3["Bloodhound-GPT"]:::experiments
        E3a["DBCreator"]:::experiments
        E3b["Dockerfile"]:::experiments
        E4["External APIs Module"]:::experiments
        E5["Local Integration (Local-GPT)"]:::experiments
        E6["Threat Intelligence/RAG Module"]:::experiments
        E7["ROADTools-GPT"]:::experiments
        E7a["ROADTools Database"]:::experiments
    end

    %% External and Conceptual Components
    LLM["LLM Engine (Generative AI)"]:::guiding
    DB["Database Engine"]:::database
    API_MS["MSGraph API"]:::api

    %% Relationships 
    %% Documentation --> Experiments
    D3 -->|"references"| E0

    %% Experiments composition
    E0 --> E1
    E0 --> E2
    E0 --> E3
    E0 --> E4
    E0 --> E5
    E0 --> E6
    E0 --> E7

    E2 --> E2a
    E3 --> E3a
    E3 --> E3b
    E7 --> E7a

    %% Experiments interacting with LLM Engine
    E1 --> LLM
    E2 --> LLM
    E3 --> LLM
    E4 --> LLM
    E5 --> LLM
    E6 --> LLM
    E7 --> LLM

    %% Database connections from stateful components
    E3 --> DB
    E7 --> DB

    %% External API connection
    E4 --> API_MS

    %% Styling Classes
    classDef documentation fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef experiments fill:#A9DFBF,stroke:#196F3D,stroke-width:2px;
    classDef api fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef database fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
    classDef guiding fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;

    %% Click Events for Documentation
    click D1 "https://github.com/otrf/genai-security-adventures/blob/main//_config.yml"
    click D2 "https://github.com/otrf/genai-security-adventures/blob/main//_toc.yml"
    click D3 "https://github.com/otrf/genai-security-adventures/blob/main//README.md"

    %% Click Events for Additional Guides and Assets
    click G1 "https://github.com/otrf/genai-security-adventures/tree/main//getting-started"
    click A1 "https://github.com/otrf/genai-security-adventures/tree/main//images"

    %% Click Events for Experiments and Submodules
    click E0 "https://github.com/otrf/genai-security-adventures/tree/main//experiments"
    click E1 "https://github.com/otrf/genai-security-adventures/tree/main//experiments/Agents"
    click E2 "https://github.com/otrf/genai-security-adventures/tree/main//experiments/Basics"
    click E2a "https://github.com/otrf/genai-security-adventures/blob/main//experiments/Basics/scripts/m365d.py"
    click E3 "https://github.com/otrf/genai-security-adventures/tree/main//experiments/Bloodhound-GPT"
    click E3a "https://github.com/otrf/genai-security-adventures/tree/main//experiments/Bloodhound-GPT/DBCreator"
    click E3b "https://github.com/otrf/genai-security-adventures/tree/main//experiments/Bloodhound-GPT/Dockerfile"
    click E4 "https://github.com/otrf/genai-security-adventures/tree/main//experiments/ExternalAPIs/MSGraph"
    click E5 "https://github.com/otrf/genai-security-adventures/tree/main//experiments/Local-GPT"
    click E6 "https://github.com/otrf/genai-security-adventures/tree/main//experiments/RAG"
    click E7 "https://github.com/otrf/genai-security-adventures/tree/main//experiments/ROADTools-GPT"
    click E7a "https://github.com/otrf/genai-security-adventures/blob/main//experiments/ROADTools-GPT/db/roadrecon.db"
```
