0
0
Prompt Engineering / GenAIml~6 mins

Message roles (system, user, assistant) in Prompt Engineering / GenAI - Full Explanation

Choose your learning style9 modes available
Introduction
When people interact with AI chat systems, the system needs to understand who is saying what. This helps the AI respond correctly and keep the conversation clear. Different roles in messages help organize the flow between the AI, the user, and the system itself.
Explanation
System Role
The system role sets the overall instructions or context for the AI. It guides how the AI should behave during the conversation, like setting the tone or rules. This role is not part of the conversation itself but shapes how the assistant responds.
The system role controls the AI's behavior and sets the conversation context.
User Role
The user role represents the person talking to the AI. Messages from the user are questions, commands, or statements that the AI needs to understand and respond to. This role drives the conversation forward by providing input.
The user role is the source of input that the AI responds to.
Assistant Role
The assistant role is the AI itself replying to the user. It generates answers, suggestions, or any output based on the user's messages and the system's instructions. This role completes the conversation loop by providing helpful responses.
The assistant role delivers the AI's responses to the user.
Real World Analogy

Imagine a play where the director gives instructions, the actor listens and acts, and the audience asks questions. The director sets the scene, the audience drives the story with questions, and the actor responds accordingly.

System Role → The director who sets the rules and tone for the play
User Role → The audience member asking questions or making requests
Assistant Role → The actor who responds and acts based on the director's instructions and audience input
Diagram
Diagram
┌─────────────┐      ┌─────────────┐      ┌──────────────┐
│   System    │─────▶│  Assistant  │◀─────│    User      │
│  (Director) │      │  (Actor)    │      │ (Audience)   │
└─────────────┘      └─────────────┘      └──────────────┘
Diagram showing the system directing the assistant, who responds to the user.
Key Facts
System RoleProvides instructions and context to guide the AI's behavior.
User RoleRepresents the person interacting with the AI by sending messages.
Assistant RoleThe AI that generates responses based on user input and system instructions.
Common Confusions
Thinking the system role is a participant in the conversation like the user or assistant.
Thinking the system role is a participant in the conversation like the user or assistant. The system role only sets the rules and context; it does not send conversational messages.
Believing the assistant role can initiate conversation without user input.
Believing the assistant role can initiate conversation without user input. The assistant responds to user messages and system instructions but does not start the conversation.
Summary
Message roles organize who says what in AI conversations to keep interactions clear.
The system role sets the AI's behavior and context but does not chat directly.
The user sends messages, and the assistant replies based on those messages and system guidance.