# mdipietro09/generativeai architecture

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

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

## Overview

This repository is a collection of Python GenAI/LLM examples, not one integrated application. Its main user-facing workflows are a voice chatbot, a multimodal agent team that prepares a social post, and a RAG chat app. Separate notebook projects explore agent patterns and frameworks. The graph follows the sampled runtime code for the three apps; notebook topics are inferred from filenames, and their internal wiring is not shown.

Main entry points: [`Agents_WebSearching/agents.py`](https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/agents.py) (Crew orchestration), [`Chatbot/chatbot.py`](https://github.com/mdipietro09/generativeai/blob/main/Chatbot/chatbot.py) (Chatbot loop), [`RAG/rag_app.py`](https://github.com/mdipietro09/generativeai/blob/main/RAG/rag_app.py) (RAG responder), [`Agents_WebSearching/data`](https://github.com/mdipietro09/generativeai/tree/main/Agents_WebSearching/data) (Image inputs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_chat["Voice chatbot"]
  node_chatbot["Chatbot loop<br/>[chatbot.py]"]
  node_speech_in["Speech recognition<br/>[chatbot.py]"]
  node_command["Command handling<br/>[chatbot.py]"]
  node_ollama_chat["Ollama response<br/>[chatbot.py]"]
  node_speech_out["Speech synthesis<br/>[chatbot.py]"]
end

subgraph group_agents["Agent workflow"]
  node_image_data["Image inputs"]
  node_image_descriptions["Image descriptions<br/>[agents.py]"]
  node_crew["Crew orchestration<br/>[agents.py]"]
  node_photographer["Photographer task<br/>[agents.py]"]
  node_social_manager["Social caption task<br/>[agents.py]"]
  node_manager["Manager task<br/>[agents.py]"]
  node_search_tool["Web search tools<br/>[agents.py]"]
  node_post_result["Post proposal<br/>[agents.py]"]
end

subgraph group_rag["RAG chat"]
  node_streamlit["Chat interface<br/>[rag_app.py]"]
  node_rag_ai["RAG responder<br/>[rag_app.py]"]
  node_retrieval["Context retrieval<br/>[rag_app.py]"]
  node_rag_reply["Streamed answer<br/>[rag_app.py]"]
  node_rag_documents["NVIDIA PDF<br/>[doc_nvidia.pdf]"]
end

subgraph group_learning["Learning examples"]
  node_coding_agents["Coding agents"]
  node_web_agents_notebook["Web-search agents<br/>[notebook.ipynb]"]
  node_zero_basics["Agent fundamentals"]
  node_zero_dataframes["Dataframes"]
  node_zero_memory["Agent memory"]
end

node_speaker(("User"))
node_mic(("Microphone"))
node_speech_services["Speech services"]
node_audio_output["Audio output"]
node_agent_user(("Post requester"))
node_vision_model["Vision model"]
node_search_service["DuckDuckGo"]
node_approval(("Human approver"))
node_rag_user(("Questioner"))
node_chroma[("Document collection")]
node_ollama["Ollama chat model"]

node_speaker -->|"speaks into"| node_mic
node_mic -->|"audio input"| node_speech_in
node_chatbot -->|"captures speech"| node_speech_in
node_speech_in -->|"transcribes"| node_chatbot
node_chatbot -->|"checks text"| node_command
node_chatbot -->|"generates reply"| node_ollama_chat
node_ollama_chat -.->|"uses Ollama"| node_speech_services
node_chatbot -->|"speaks reply"| node_speech_out
node_speech_out -.->|"uses gTTS"| node_speech_services
node_speech_out -->|"plays audio"| node_audio_output
node_agent_user -->|"requests post"| node_crew
node_image_data -->|"provides images"| node_image_descriptions
node_image_descriptions -.->|"describes images"| node_vision_model
node_image_descriptions -->|"supplies descriptions"| node_crew
node_crew -->|"dispatches task"| node_photographer
node_crew -->|"dispatches task"| node_social_manager
node_crew -->|"dispatches task"| node_manager
node_photographer -->|"searches trends"| node_search_tool
node_social_manager -->|"searches trends"| node_search_tool
node_search_tool -.->|"queries"| node_search_service
node_manager -->|"requests approval"| node_approval
node_crew -->|"returns result"| node_post_result
node_rag_user -->|"asks question"| node_streamlit
node_streamlit -->|"calls responder"| node_rag_ai
node_rag_ai -->|"retrieves context"| node_retrieval
node_retrieval -->|"queries documents"| node_chroma
node_rag_ai -.->|"streams completion"| node_ollama
node_rag_ai -->|"yields chunks"| node_streamlit
node_streamlit -->|"shows answer"| node_rag_reply

click node_chatbot "https://github.com/mdipietro09/generativeai/blob/main/Chatbot/chatbot.py"
click node_speech_in "https://github.com/mdipietro09/generativeai/blob/main/Chatbot/chatbot.py"
click node_command "https://github.com/mdipietro09/generativeai/blob/main/Chatbot/chatbot.py"
click node_ollama_chat "https://github.com/mdipietro09/generativeai/blob/main/Chatbot/chatbot.py"
click node_speech_out "https://github.com/mdipietro09/generativeai/blob/main/Chatbot/chatbot.py"
click node_image_data "https://github.com/mdipietro09/generativeai/tree/main/Agents_WebSearching/data"
click node_image_descriptions "https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/agents.py"
click node_crew "https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/agents.py"
click node_photographer "https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/agents.py"
click node_social_manager "https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/agents.py"
click node_manager "https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/agents.py"
click node_search_tool "https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/agents.py"
click node_post_result "https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/agents.py"
click node_streamlit "https://github.com/mdipietro09/generativeai/blob/main/RAG/rag_app.py"
click node_rag_ai "https://github.com/mdipietro09/generativeai/blob/main/RAG/rag_app.py"
click node_retrieval "https://github.com/mdipietro09/generativeai/blob/main/RAG/rag_app.py"
click node_rag_reply "https://github.com/mdipietro09/generativeai/blob/main/RAG/rag_app.py"
click node_rag_documents "https://github.com/mdipietro09/generativeai/blob/main/RAG/data/doc_nvidia.pdf"
click node_coding_agents "https://github.com/mdipietro09/generativeai/tree/main/Agents_Coding"
click node_web_agents_notebook "https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/notebook.ipynb"
click node_zero_basics "https://github.com/mdipietro09/generativeai/blob/main/Agents_ZeroToHero/notebook_I_basics.ipynb"
click node_zero_dataframes "https://github.com/mdipietro09/generativeai/blob/main/Agents_ZeroToHero/notebook_II_dataframes.ipynb"
click node_zero_memory "https://github.com/mdipietro09/generativeai/blob/main/Agents_ZeroToHero/notebook_III_memory.ipynb"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_chatbot,node_speech_in,node_command,node_ollama_chat,node_speech_out,node_speaker toneBlue
class node_image_data,node_image_descriptions,node_crew,node_photographer,node_social_manager,node_manager,node_search_tool,node_post_result,node_chroma toneAmber
class node_streamlit,node_rag_ai,node_retrieval,node_rag_reply,node_rag_documents,node_agent_user toneMint
class node_coding_agents,node_web_agents_notebook,node_zero_basics,node_zero_dataframes,node_zero_memory toneRose
class node_mic,node_speech_services,node_audio_output,node_vision_model,node_search_service,node_approval,node_rag_user,node_ollama toneIndigo
```

## Components

### Voice chatbot

- [Chatbot loop](https://github.com/mdipietro09/generativeai/blob/main/Chatbot/chatbot.py): `Chatbot/chatbot.py`
- [Speech recognition](https://github.com/mdipietro09/generativeai/blob/main/Chatbot/chatbot.py): `Chatbot/chatbot.py`
- [Command handling](https://github.com/mdipietro09/generativeai/blob/main/Chatbot/chatbot.py): `Chatbot/chatbot.py`
- [Ollama response](https://github.com/mdipietro09/generativeai/blob/main/Chatbot/chatbot.py): `Chatbot/chatbot.py`
- [Speech synthesis](https://github.com/mdipietro09/generativeai/blob/main/Chatbot/chatbot.py): `Chatbot/chatbot.py`

### Agent workflow

- [Image inputs](https://github.com/mdipietro09/generativeai/tree/main/Agents_WebSearching/data): `Agents_WebSearching/data`
- [Image descriptions](https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/agents.py): `Agents_WebSearching/agents.py`
- [Crew orchestration](https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/agents.py): `Agents_WebSearching/agents.py`
- [Photographer task](https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/agents.py): `Agents_WebSearching/agents.py`
- [Social caption task](https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/agents.py): `Agents_WebSearching/agents.py`
- [Manager task](https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/agents.py): `Agents_WebSearching/agents.py`
- [Web search tools](https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/agents.py): `Agents_WebSearching/agents.py`
- [Post proposal](https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/agents.py): `Agents_WebSearching/agents.py`

### RAG chat

- [Chat interface](https://github.com/mdipietro09/generativeai/blob/main/RAG/rag_app.py): `RAG/rag_app.py`
- [RAG responder](https://github.com/mdipietro09/generativeai/blob/main/RAG/rag_app.py): `RAG/rag_app.py`
- [Context retrieval](https://github.com/mdipietro09/generativeai/blob/main/RAG/rag_app.py): `RAG/rag_app.py`
- [Streamed answer](https://github.com/mdipietro09/generativeai/blob/main/RAG/rag_app.py): `RAG/rag_app.py`
- [NVIDIA PDF](https://github.com/mdipietro09/generativeai/blob/main/RAG/data/doc_nvidia.pdf): `RAG/data/doc_nvidia.pdf`

### Learning examples

- [Coding agents](https://github.com/mdipietro09/generativeai/tree/main/Agents_Coding): `Agents_Coding`
- [Web-search agents](https://github.com/mdipietro09/generativeai/blob/main/Agents_WebSearching/notebook.ipynb): `Agents_WebSearching/notebook.ipynb`
- [Agent fundamentals](https://github.com/mdipietro09/generativeai/blob/main/Agents_ZeroToHero/notebook_I_basics.ipynb): `Agents_ZeroToHero/notebook_I_basics.ipynb`
- [Dataframes](https://github.com/mdipietro09/generativeai/blob/main/Agents_ZeroToHero/notebook_II_dataframes.ipynb): `Agents_ZeroToHero/notebook_II_dataframes.ipynb`
- [Agent memory](https://github.com/mdipietro09/generativeai/blob/main/Agents_ZeroToHero/notebook_III_memory.ipynb): `Agents_ZeroToHero/notebook_III_memory.ipynb`

### Other components

- **User**
- **Microphone**
- **Speech services**
- **Audio output**
- **Post requester**
- **Vision model**
- **DuckDuckGo**
- **Human approver**
- **Questioner**
- **Document collection**
- **Ollama chat model**

## Connections

- User → Microphone: speaks into
- Microphone → Speech recognition: audio input
- Chatbot loop → Speech recognition: captures speech
- Speech recognition → Chatbot loop: transcribes
- Chatbot loop → Command handling: checks text
- Chatbot loop → Ollama response: generates reply
- Ollama response → Speech services: uses Ollama
- Chatbot loop → Speech synthesis: speaks reply
- Speech synthesis → Speech services: uses gTTS
- Speech synthesis → Audio output: plays audio
- Post requester → Crew orchestration: requests post
- Image inputs → Image descriptions: provides images
- Image descriptions → Vision model: describes images
- Image descriptions → Crew orchestration: supplies descriptions
- Crew orchestration → Photographer task: dispatches task
- Crew orchestration → Social caption task: dispatches task
- Crew orchestration → Manager task: dispatches task
- Photographer task → Web search tools: searches trends
- Social caption task → Web search tools: searches trends
- Web search tools → DuckDuckGo: queries
- Manager task → Human approver: requests approval
- Crew orchestration → Post proposal: returns result
- Questioner → Chat interface: asks question
- Chat interface → RAG responder: calls responder
- RAG responder → Context retrieval: retrieves context
- Context retrieval → Document collection: queries documents
- RAG responder → Ollama chat model: streams completion
- RAG responder → Chat interface: yields chunks
- Chat interface → Streamed answer: shows answer
