# anshlambagit/microsoft_foundry_tutorial architecture

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

- Interactive diagram: https://gitdiagram.com/anshlambagit/microsoft_foundry_tutorial
- Repository: https://github.com/anshlambagit/microsoft_foundry_tutorial

## Overview

This repository is an educational Azure AI Foundry tutorial, not a single application pipeline. Its examples demonstrate separate ways to call language models, use document and speech services, explore AI Search, and invoke a Foundry agent. The README documents broader capabilities such as agent tool routing and conversation state, but the sampled agent code only shows an interactive request referencing a configured agent. AI Search is documented but its notebook was not sampled, so its internal flow is not shown.

Main entry points: [`CH-2_AI_Services/1_OCR.py`](https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-2_AI_Services/1_OCR.py) (Document OCR), [`CH-2_AI_Services/3_TTS.py`](https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-2_AI_Services/3_TTS.py) (Speech synthesis), [`CH-2_AI_Services/2_STT.py`](https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-2_AI_Services/2_STT.py) (Speech recognition), [`CH-1_Models/1_llms.py`](https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-1_Models/1_llms.py) (Direct LLM call)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_models["Models and orchestration"]
  node_model_demo["Direct LLM call<br/>[1_llms.py]"]
  node_langchain_demo["LangChain LLM<br/>[2_Langchain_LLM.py]"]
  node_foundry_models{{"Azure model endpoint"}}
end

subgraph group_services["AI service examples"]
  node_ocr["Document OCR<br/>[1_OCR.py]"]
  node_content_service{{"Content Understanding"}}
  node_ocr_result["Analysis result file"]
  node_stt["Speech recognition<br/>[2_STT.py]"]
  node_speech_service{{"Azure Speech"}}
  node_tts["Speech synthesis<br/>[3_TTS.py]"]
  node_ai_search["AI Search example<br/>[4_AISearch.ipynb]"]
end

subgraph group_agents["Agent example"]
  node_agent_demo["Foundry agent client<br/>[1_foundry_agent.py]"]
  node_foundry_agent{{"Configured Foundry agent"}}
end

node_user(("User"))
node_document_url["Document URL"]
node_microphone(("Microphone"))
node_speaker(("Audio output"))

node_user -->|"runs example"| node_model_demo
node_model_demo -->|"requests completion"| node_foundry_models
node_user -->|"runs example"| node_langchain_demo
node_langchain_demo -->|"invokes model"| node_foundry_models
node_document_url -->|"provides document URL"| node_ocr
node_ocr -->|"submits analysis"| node_content_service
node_ocr -->|"writes JSON result"| node_ocr_result
node_microphone -->|"provides audio"| node_stt
node_stt -->|"starts recognition"| node_speech_service
node_user -->|"starts example"| node_stt
node_user -->|"runs example"| node_tts
node_tts -->|"synthesizes text"| node_speech_service
node_tts -->|"plays synthesized audio"| node_speaker
node_user -->|"explores search"| node_ai_search
node_user -->|"enters message"| node_agent_demo
node_agent_demo -->|"sends agent request"| node_foundry_agent

click node_model_demo "https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-1_Models/1_llms.py"
click node_langchain_demo "https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-1_Models/2_Langchain_LLM.py"
click node_ocr "https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-2_AI_Services/1_OCR.py"
click node_stt "https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-2_AI_Services/2_STT.py"
click node_tts "https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-2_AI_Services/3_TTS.py"
click node_ai_search "https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-2_AI_Services/4_AISearch.ipynb"
click node_agent_demo "https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-3_Agent/1_foundry_agent.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_model_demo,node_langchain_demo,node_foundry_models,node_user toneBlue
class node_ocr,node_content_service,node_ocr_result,node_stt,node_speech_service,node_tts,node_ai_search toneAmber
class node_agent_demo,node_foundry_agent toneMint
class node_document_url,node_microphone,node_speaker toneIndigo
```

## Components

### Models and orchestration

- [Direct LLM call](https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-1_Models/1_llms.py): `CH-1_Models/1_llms.py`
- [LangChain LLM](https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-1_Models/2_Langchain_LLM.py): `CH-1_Models/2_Langchain_LLM.py`
- **Azure model endpoint**

### AI service examples

- [Document OCR](https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-2_AI_Services/1_OCR.py): `CH-2_AI_Services/1_OCR.py`
- **Content Understanding**
- **Analysis result file**
- [Speech recognition](https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-2_AI_Services/2_STT.py): `CH-2_AI_Services/2_STT.py`
- **Azure Speech**
- [Speech synthesis](https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-2_AI_Services/3_TTS.py): `CH-2_AI_Services/3_TTS.py`
- [AI Search example](https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-2_AI_Services/4_AISearch.ipynb): `CH-2_AI_Services/4_AISearch.ipynb`

### Agent example

- [Foundry agent client](https://github.com/anshlambagit/microsoft_foundry_tutorial/blob/main/CH-3_Agent/1_foundry_agent.py): `CH-3_Agent/1_foundry_agent.py`
- **Configured Foundry agent**

### Other components

- **User**
- **Document URL**
- **Microphone**
- **Audio output**

## Connections

- User → Direct LLM call: runs example (evidence: `README.md`)
- Direct LLM call → Azure model endpoint: requests completion (evidence: `CH-1_Models/1_llms.py`)
- User → LangChain LLM: runs example (evidence: `README.md`)
- LangChain LLM → Azure model endpoint: invokes model (evidence: `CH-1_Models/2_Langchain_LLM.py`)
- Document URL → Document OCR: provides document URL (evidence: `CH-2_AI_Services/1_OCR.py`)
- Document OCR → Content Understanding: submits analysis (evidence: `CH-2_AI_Services/1_OCR.py`)
- Document OCR → Analysis result file: writes JSON result (evidence: `CH-2_AI_Services/1_OCR.py`)
- Microphone → Speech recognition: provides audio (evidence: `CH-2_AI_Services/2_STT.py`)
- Speech recognition → Azure Speech: starts recognition (evidence: `CH-2_AI_Services/2_STT.py`)
- User → Speech recognition: starts example (evidence: `README.md`)
- User → Speech synthesis: runs example (evidence: `README.md`)
- Speech synthesis → Azure Speech: synthesizes text (evidence: `CH-2_AI_Services/3_TTS.py`)
- Speech synthesis → Audio output: plays synthesized audio (evidence: `CH-2_AI_Services/3_TTS.py`)
- User → AI Search example: explores search (evidence: `README.md`)
- User → Foundry agent client: enters message (evidence: `CH-3_Agent/1_foundry_agent.py`)
- Foundry agent client → Configured Foundry agent: sends agent request (evidence: `CH-3_Agent/1_foundry_agent.py`)
