AI engineering glossary · Prompt context engineering
What is message roles?
Message roles: The labels attached to each message in a chat-style API call, typically system, user, assistant and tool. The role tells the model who is speaking and how much weight to give the text. Getting the roles right keeps instructions, questions, model replies and tool outputs separate.
Message roles: an example
A request holds three messages: {role: system, ...}, {role: user, 'What is my EMI?'} and {role: assistant, 'Please share the loan amount.'}.
Related terms
More Prompt context engineering terms
- Meta-prompting
- Multi-turn conversation
- Needle in a haystack test
- One-shot prompting
- Outlines library
- Output format specification
- Output parser
- Output repair
Where you learn it
Message roles is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.