# sk7440/applied_ai architecture

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

- Interactive diagram: https://gitdiagram.com/sk7440/applied_ai
- Repository: https://github.com/sk7440/applied_ai

## Overview

This tree is a collection of small GenAI experiments, centered on `chatbot_practice`: a user selects a model and response depth, optionally attaches an image, streams a reply, and the app persists the conversation. Separate examples demonstrate direct Ollama, LangChain/Ollama, and a LangChain OpenAI-compatible proxy. The README is empty; edges reflect only the shown source references and calls, so unsampled notebooks and modules are not inferred as runtime stages.

Main entry points: [`chatbot_practice/app.py`](https://github.com/sk7440/applied_ai/blob/main/chatbot_practice/app.py) (Chat UI and flow), [`chatbot_practice/ollama_client.py`](https://github.com/sk7440/applied_ai/blob/main/chatbot_practice/ollama_client.py) (Ollama client), [`chatbot_practice/history_manager.py`](https://github.com/sk7440/applied_ai/blob/main/chatbot_practice/history_manager.py) (History manager), [`chatbot_practice/main.py`](https://github.com/sk7440/applied_ai/blob/main/chatbot_practice/main.py) (Streaming CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Chatbot workspace"]
  node_workspace_app["Chat UI and flow<br/>[app.py]"]
  node_ollama_client["Ollama client<br/>[ollama_client.py]"]
  node_history_manager["History manager<br/>[history_manager.py]"]
  node_chat_history[("Chat history file<br/>[chat_history.json]")]
end

subgraph group_ollama_demos["Ollama examples"]
  node_chatbot_cli["Streaming CLI<br/>[main.py]"]
  node_support_demo["Support response demo<br/>[main.py]"]
  node_api_demo["API invocation demo<br/>[main.py]"]
end

subgraph group_langchain_demos["LangChain examples"]
  node_proxy_cli["Prompt streaming CLI<br/>[index.js]"]
end

node_user(("User"))
node_ollama_service{{"Ollama service"}}
node_proxy_service{{"OpenAI-compatible endpoint"}}

node_user -->|"submits prompt"| node_workspace_app
node_workspace_app -->|"lists models"| node_ollama_client
node_workspace_app -->|"checks vision"| node_ollama_client
node_workspace_app -->|"streams chat"| node_ollama_client
node_workspace_app -->|"loads history"| node_history_manager
node_workspace_app -->|"saves or clears"| node_history_manager
node_history_manager -->|"reads and writes"| node_chat_history
node_ollama_client -->|"requests models and chat"| node_ollama_service
node_user -->|"enters prompt"| node_chatbot_cli
node_chatbot_cli -->|"streams chat"| node_ollama_service
node_support_demo -->|"streams support reply"| node_ollama_service
node_api_demo -->|"invokes model"| node_ollama_service
node_user -->|"enters prompt"| node_proxy_cli
node_proxy_cli -->|"streams completion"| node_proxy_service

click node_workspace_app "https://github.com/sk7440/applied_ai/blob/main/chatbot_practice/app.py"
click node_ollama_client "https://github.com/sk7440/applied_ai/blob/main/chatbot_practice/ollama_client.py"
click node_history_manager "https://github.com/sk7440/applied_ai/blob/main/chatbot_practice/history_manager.py"
click node_chat_history "https://github.com/sk7440/applied_ai/blob/main/chatbot_practice/chat_history.json"
click node_chatbot_cli "https://github.com/sk7440/applied_ai/blob/main/chatbot_practice/main.py"
click node_support_demo "https://github.com/sk7440/applied_ai/blob/main/genai-foundations/code/main.py"
click node_api_demo "https://github.com/sk7440/applied_ai/blob/main/genai-foundations/api/app/main.py"
click node_proxy_cli "https://github.com/sk7440/applied_ai/blob/main/langchain-practice/index.js"

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_workspace_app,node_ollama_client,node_history_manager,node_chat_history,node_user toneBlue
class node_chatbot_cli,node_support_demo,node_api_demo toneAmber
class node_proxy_cli toneMint
class node_ollama_service,node_proxy_service toneIndigo
```

## Components

### Chatbot workspace

- [Chat UI and flow](https://github.com/sk7440/applied_ai/blob/main/chatbot_practice/app.py): `chatbot_practice/app.py`
- [Ollama client](https://github.com/sk7440/applied_ai/blob/main/chatbot_practice/ollama_client.py): `chatbot_practice/ollama_client.py`
- [History manager](https://github.com/sk7440/applied_ai/blob/main/chatbot_practice/history_manager.py): `chatbot_practice/history_manager.py`
- [Chat history file](https://github.com/sk7440/applied_ai/blob/main/chatbot_practice/chat_history.json): `chatbot_practice/chat_history.json`

### Ollama examples

- [Streaming CLI](https://github.com/sk7440/applied_ai/blob/main/chatbot_practice/main.py): `chatbot_practice/main.py`
- [Support response demo](https://github.com/sk7440/applied_ai/blob/main/genai-foundations/code/main.py): `genai-foundations/code/main.py`
- [API invocation demo](https://github.com/sk7440/applied_ai/blob/main/genai-foundations/api/app/main.py): `genai-foundations/api/app/main.py`

### LangChain examples

- [Prompt streaming CLI](https://github.com/sk7440/applied_ai/blob/main/langchain-practice/index.js): `langchain-practice/index.js`

### Other components

- **User**
- **Ollama service**
- **OpenAI-compatible endpoint**

## Connections

- User → Chat UI and flow: submits prompt (evidence: `chatbot_practice/app.py`)
- Chat UI and flow → Ollama client: lists models (evidence: `chatbot_practice/app.py`)
- Chat UI and flow → Ollama client: checks vision (evidence: `chatbot_practice/app.py`)
- Chat UI and flow → Ollama client: streams chat (evidence: `chatbot_practice/app.py`)
- Chat UI and flow → History manager: loads history (evidence: `chatbot_practice/app.py`)
- Chat UI and flow → History manager: saves or clears (evidence: `chatbot_practice/app.py`)
- History manager → Chat history file: reads and writes (evidence: `chatbot_practice/history_manager.py`)
- Ollama client → Ollama service: requests models and chat (evidence: `chatbot_practice/ollama_client.py`)
- User → Streaming CLI: enters prompt (evidence: `chatbot_practice/main.py`)
- Streaming CLI → Ollama service: streams chat (evidence: `chatbot_practice/main.py`)
- Support response demo → Ollama service: streams support reply (evidence: `genai-foundations/code/main.py`)
- API invocation demo → Ollama service: invokes model (evidence: `genai-foundations/api/app/main.py`)
- User → Prompt streaming CLI: enters prompt (evidence: `langchain-practice/index.js`)
- Prompt streaming CLI → OpenAI-compatible endpoint: streams completion (evidence: `langchain-practice/index.js`)
