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
ItemValue
Packageopenai
ClassAzureOpenAI
Methodchat.completions.create()
Headerapi-key
EndpointPOST /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:
ParameterRequiredDefaultExam Note
model✓—Deployment name
messages✓—Array of role/content objects
temperature1.0Lower = deterministic, Higher = creative
max_tokensModel maxLimits response length
top_p1.0Alternative to temperature

Message roles define who is speaking in the conversation. The system role is particularly important for setting behavior constraints.

Message Roles:
RolePurpose
systemSets behavior, persona, constraints
userUser input
assistantModel's previous responses
Alvin Varughese
Written byAlvin Varughese
Founder•15 professional certifications