Skip to content
BENIBIX Learn

Message Roles

AI💬 LLMsLLM Basics

Also known as Chat Roles, Chat Message Roles, System, User and Assistant Roles

Tags on chat messages. They say who wrote each one: the app, the person or the model.

Think of it like

It is like a play script. Each line has a name on it, so you know who said it.

Example

A tutor app sends three messages. The system one says to be a kind maths tutor. The user one asks what 7 x 8 is. The assistant one holds the model's answer, 56.

Why it matters

Roles let the model tell your rules apart from the user's words. That is how it knows which to follow.

Definition

Message roles are the tags that say who wrote each message in a chat with a language model. The system role holds the app's standing rules. The user role holds what the person typed. The assistant role holds what the model said back. The model reads the whole list in order each time it answers. Some APIs call the first role developer, and some send it as its own field.

Example code

json
[
  { "role": "system", "content": "You are a kind maths tutor." },
  { "role": "user", "content": "What is 7 x 8?" },
  { "role": "assistant", "content": "7 x 8 is 56." }
]
Each message in the list carries a role that says who wrote it.
Each message has a tag on it. The tag is system, user or assistant.

Common mistake

Putting your app's rules in a user message. The model treats them as one more request, not as rules.

Key takeaways

  1. 1
    System. The app's standing rules.
  2. 2
    User. What the person typed.
  3. 3
    Assistant. What the model said back.

Learn it properly