# remyc0des/agilestem_openai_api architecture

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

- Interactive diagram: https://gitdiagram.com/remyc0des/agilestem_openai_api
- Repository: https://github.com/remyc0des/agilestem_openai_api

## Overview

This is a small FastAPI chat service for a manufacturing simulation game. A player sends a question and a game-state snapshot to `/chat`; the handler combines them with factory-operations mentoring guidance, calls Azure OpenAI, and returns the generated reply. The game-state interpretation and educational behavior are prompt content inside the same handler, not separate runtime modules. The graph reflects only relationships visible in `main.py`; there are no sampled game-client or simulation-engine components.

Main entry points: [`main.py`](https://github.com/remyc0des/agilestem_openai_api/blob/main/main.py) (Chat handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_service["Chat service"]
  node_chat_handler["Chat handler<br/>[main.py]"]
  node_game_context["Game context<br/>[main.py]"]
  node_advisor_guidance["Advisor guidance<br/>[main.py]"]
  node_reply["Chat reply<br/>[main.py]"]
end

node_player(("Player"))
node_azure_openai["Azure OpenAI"]

node_player -->|"sends question"| node_chat_handler
node_chat_handler -->|"uses snapshot"| node_game_context
node_chat_handler -->|"sets guidance"| node_advisor_guidance
node_chat_handler -->|"requests completion"| node_azure_openai
node_azure_openai -->|"returns completion"| node_chat_handler
node_chat_handler -->|"returns reply"| node_reply

click node_chat_handler "https://github.com/remyc0des/agilestem_openai_api/blob/main/main.py"
click node_game_context "https://github.com/remyc0des/agilestem_openai_api/blob/main/main.py"
click node_advisor_guidance "https://github.com/remyc0des/agilestem_openai_api/blob/main/main.py"
click node_reply "https://github.com/remyc0des/agilestem_openai_api/blob/main/main.py"

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_chat_handler,node_game_context,node_advisor_guidance,node_reply toneBlue
class node_player,node_azure_openai toneIndigo
```

## Components

### Chat service

- [Chat handler](https://github.com/remyc0des/agilestem_openai_api/blob/main/main.py): `main.py`
- [Game context](https://github.com/remyc0des/agilestem_openai_api/blob/main/main.py): `main.py`
- [Advisor guidance](https://github.com/remyc0des/agilestem_openai_api/blob/main/main.py): `main.py`
- [Chat reply](https://github.com/remyc0des/agilestem_openai_api/blob/main/main.py): `main.py`

### Other components

- **Player**
- **Azure OpenAI**

## Connections

- Player → Chat handler: sends question (evidence: `main.py`)
- Chat handler → Game context: uses snapshot (evidence: `main.py`)
- Chat handler → Advisor guidance: sets guidance (evidence: `main.py`)
- Chat handler → Azure OpenAI: requests completion (evidence: `main.py`)
- Azure OpenAI → Chat handler: returns completion (evidence: `main.py`)
- Chat handler → Chat reply: returns reply (evidence: `main.py`)
