Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.
3.2.1.1. Message Structure and Roles
3.2.1.1. Message Structure and Roles
Messages are the core building blocks of chat completions. Each message has a role and content, and the conversation history shapes the model's response.
🔧 Implementation Reference: Chat Completions
| Item | Value |
|---|---|
| Package | openai |
| Class | AzureOpenAI |
| Method | chat.completions.create() |
| Header | api-key |
| Endpoint | POST /openai/deployments/{deployment}/chat/completions |
The following parameters control chat completion behavior. Pay attention to the "Exam Note" column—these distinctions are frequently tested.
Required Parameters:
| Parameter | Required | Default | Exam Note |
|---|---|---|---|
model | ✓ | — | Deployment name |
messages | ✓ | — | Array of role/content objects |
temperature | 1.0 | Lower = deterministic, Higher = creative | |
max_tokens | Model max | Limits response length | |
top_p | 1.0 | Alternative to temperature |
Message roles define who is speaking in the conversation. The system role is particularly important for setting behavior constraints.
Message Roles:
| Role | Purpose |
|---|---|
system | Sets behavior, persona, constraints |
user | User input |
assistant | Model's previous responses |
Written byAlvin Varughese
Founder•15 professional certifications