# themlguy-tf/generative-ai architecture

> Architecture diagram of the GitHub repository themlguy-tf/generative-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/themlguy-tf/generative-ai
- Repository: https://github.com/themlguy-tf/generative-ai

## Overview

##### Main System Components
- Jupyter Notebooks Environment: These notebooks (e.g., those in the PaLM2 folder) are used to run and demonstrate different Gen AI scenarios on Vertex AI.
- Google Cloud Vertex AI: Represent this as the core machine learning platform running the LLMs and generative tasks.
- LangChain Integration: Indicate the use of LangChain for orchestrating interactions and chaining calls, as mentioned in various notebooks.
- Agent Builder Modules: Show these as specialized components that use structured data (like BigQuery), process PDFs (Q&A-pdf), and integrate with external APIs (e.g., weather data).
- Gemini Module: Highlight the separate folder “gemini” to reflect a component dealing with function calling and multimodal retrieval-augmented generation (RAG).

##### Out Relationships and Interactions
- Flow: The Jupyter notebooks (as your development interface) send requests to the Vertex AI platform, which runs the LLMs, accessed via the LangChain framework.
- From Vertex AI, data may be passed to or integrated with external services:
- BigQuery (shown in the agent-builder/BigQuery-Structured module) for structured data queries.
- External APIs like weather services.
- The Gemini module might sit as a parallel or complementary mechanism for handling function calling or multimodal tasks. Represent this as either a side module that can be invoked as needed or as an alternative processing pipeline.

##### Architectural Choices
- Service Separation: Illustrate clear boundaries between the core machine learning engine (Vertex AI) and the integrations (LangChain, BigQuery, External APIs).
- Extensibility: Make a note that the architecture allows flexibility to add more agents or data sources as required.

##### Relevant Technologies
- Vertex AI, Google Cloud libraries (as per the dependencies in the README), and LangChain should be prominently indicated.
- If desired, include Gradio (even if not seen directly in the file tree, it is mentioned in the repo name) as a possible interactive front end.
- How notebooks serve as both the instructional and operational layer for these demonstrations.

##### Final Recommendations
- Dependencies and Integration Points: Clearly show how data moves from your notebooks to cloud services and then to external APIs, capturing both the synchronous and asynchronous interactions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Jupyter Notebook Environment"]:::notebooks
    B["LangChain Integration"]:::integration
    C["Google Cloud Vertex AI (Generative LLM Service)"]:::ai
    D["Agent Builder - BigQuery Integration"]:::agent
    E["Agent Builder - PDF Q&A Module"]:::agent
    F["Agent Builder - External APIs (Weather Data) Integration"]:::agent
    G["Gemini Module for Function Calling & Multimodal RAG"]:::integration

    A -->|"uses"| B
    B -->|"orchestrates"| C
    C -->|"integrates"| D
    C -->|"integrates"| E
    C -->|"integrates"| F
    A -->|"alternativeFlow"| G

    click A "https://github.com/themlguy-tf/generative-ai/tree/main/PaLM2/"
    click B "https://github.com/themlguy-tf/generative-ai/blob/main/PaLM2/#3a_[NJ]_LangChain_&_GCP_PaLM_Introduction.ipynb"
    click C "https://github.com/themlguy-tf/generative-ai/blob/main/PaLM2/#0_[NJ]_Getting_Started_LLM_Vertex_Gen_AI.ipynb"
    click D "https://github.com/themlguy-tf/generative-ai/tree/main/agent-builder/BigQuery-Structured"
    click E "https://github.com/themlguy-tf/generative-ai/tree/main/agent-builder/Q&A-pdf"
    click F "https://github.com/themlguy-tf/generative-ai/tree/main/agent-builder/external-apis-weather"
    click G "https://github.com/themlguy-tf/generative-ai/tree/main/gemini/"

    classDef notebooks fill:#b3cde0,stroke:#333,stroke-width:2px;
    classDef ai fill:#ccebc5,stroke:#333,stroke-width:2px;
    classDef integration fill:#fbb4ae,stroke:#333,stroke-width:2px;
    classDef agent fill:#d9f9d9,stroke:#333,stroke-width:2px;
```
