message role
The label on each message in a conversation, usually user or assistant, that tells the model who said it.
In more detail
A chat request is a list of alternating user and assistant turns, with the system prompt alongside. Each call is stateless, so the whole list is sent every time, and earlier assistant turns can be written by your code to steer the next reply.
Related terms
- system prompt — The instructions sent apart from the conversation that set a model's role, rules and context for every turn.
- Messages API — Anthropic's main API for Claude: you send a model name, an optional system prompt and a list of messages, and get back content blocks, a stop reason and usage.
Taught in
- Tokens And The Context Window — AI Engineering: LLM Apps, RAG & Agents
- The Request And The Response — AI Engineering: LLM Apps, RAG & Agents
- Anatomy Of A Prompt — AI Engineering: LLM Apps, RAG & Agents
- Reasoning Techniques — AI Engineering: LLM Apps, RAG & Agents
- Structured Output — AI Engineering: LLM Apps, RAG & Agents
- Memory And Compaction — AI Engineering: LLM Apps, RAG & Agents
- Function Calling — AI Engineering: LLM Apps, RAG & Agents
- The Agent Loop — AI Engineering: LLM Apps, RAG & Agents
- Connect An Agent To MCP — AI Engineering: LLM Apps, RAG & Agents
- Images, Audio And Speech — AI Engineering: LLM Apps, RAG & Agents
References
- Anthropic: Messages API reference (temperature, top_k, top_p, stop_sequences, stop_reason)
- OpenAI: Prompt engineering guide