e768098d0e
tools_continuous_delivery / Private PyPI non-main branch release (push) Has been skipped
tools_continuous_delivery / Private PyPI main branch release (push) Failing after 2m42s
Publish Promptflow Doc / Build (push) Has been cancelled
Publish Promptflow Doc / Deploy (push) Has been cancelled
Flake8 Lint / flake8 (push) Has been cancelled
Spell check CI / Spell_Check (push) Has been cancelled
47 lines
1.5 KiB
Markdown
47 lines
1.5 KiB
Markdown
# Basic Chat — Microsoft Agent Framework
|
|
|
|
This is the [Microsoft Agent Framework (MAF)](https://devblogs.microsoft.com/agent-framework/microsoft-agent-framework-version-1-0/) version of the [chat-basic](../chat-basic/) Prompt Flow example.
|
|
|
|
It implements the same behaviour: a helpful assistant chatbot that remembers conversation history and responds to user questions.
|
|
|
|
## Architecture
|
|
|
|
```
|
|
[InputExecutor] ──→ [ChatExecutor]
|
|
(question + (Agent with
|
|
chat_history) FoundryChatClient)
|
|
```
|
|
|
|
| Prompt Flow concept | MAF equivalent |
|
|
|---|---|
|
|
| `flow.dag.yaml` | `WorkflowBuilder` in `chat_flow.py` |
|
|
| `chat.jinja2` (system prompt) | `Agent(instructions="You are a helpful assistant.")` |
|
|
| LLM node (`api: chat`) | `FoundryChatClient` + `Agent.run()` |
|
|
| `chat_history` input | Message list assembled in `InputExecutor` |
|
|
| `open_ai_connection` | Environment variables (`FOUNDRY_PROJECT_ENDPOINT`, `FOUNDRY_MODEL`) + `DefaultAzureCredential` |
|
|
|
|
## Prerequisites
|
|
|
|
- Python 3.10+
|
|
- An Azure subscription with a Microsoft Foundry project (or Azure OpenAI resource)
|
|
- `az login` completed
|
|
|
|
## Setup
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
|
|
cp .env.example .env
|
|
# Edit .env with your Foundry project endpoint and model deployment name
|
|
```
|
|
|
|
## Run
|
|
|
|
```bash
|
|
python chat_flow.py
|
|
```
|
|
|
|
This runs two test interactions:
|
|
1. A single-turn question with no history
|
|
2. A follow-up question with one prior turn of chat history
|