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, you only use 'user' and 'assistant'. The system prompt sits at the top level, so it isn't 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. The option listing 'system, user, assistant' is wrong because 'system' is a top-level parameter, not a role inside the messages array. The option using 'human, ai, and system' is wrong because 'human' and 'ai' are from older APIs or other providers (like Anthropic's legacy Text Completions API). The option using 'input, output, and context' is wrong because those are entirely made-up role names.