In the Claude Messages API, what are the valid roles for messages in the 'messages' array?
Select an answer to reveal the explanation.
Short Explanation
In the messages array it's a back-and-forth between 'user' and 'assistant'. The system prompt lives at the top level — it's not one of the messages.
Full Explanation
The Anthropic Messages API has a specific structure: the 'system' prompt is a top-level parameter (not inside the messages array), while the messages array alternates between 'user' and 'assistant' roles. The conversation must start with a 'user' message, and roles must alternate. Option A is wrong because 'system' is a top-level parameter, not a role inside the messages array. Option C uses 'human' and 'ai' which are from older APIs or other providers (like Anthropic's legacy Text Completions API). Option D uses entirely made-up role names.