Which role carries the rules?

Take your time, follow the code and check your understanding.

The codeLLM API basics
const messages = [
  { role: "system", content: "Answer in one short sentence." },
  { role: "user", content: "What is an API?" }
];
// Standing instructions are the ones that start with "Answer".
console.log(messages.find(m => m.content.startsWith("Answer")).role);
Your answer4 min · no timer
What will the code print?

Show solution and explanation

The system message carries standing instructions such as tone, format or limits for the whole conversation. The user message is the request, and assistant messages are earlier model replies.

system