1. System messages must be followed by at least by another message
  2. No system messages are allowed after an assistant or user message

System messages must be followed by at least another message

Anthropic does not consider system messages as part of the list of general messages and thus, if you don’t add at least a user or assistant message, the list of messages sent to anthropic would be empty, which would result in an error.

{
  "system": [
    {
      "type": "text",
      "text": "You are an AI assistant tasked with analyzing literary works. Your goal is to provide insightful commentary on themes, characters, and writing style.\n"
    },
    {
      "type": "text",
      "text": "<the entire contents of Pride and Prejudice>",
      "cache_control": { "type": "ephemeral" }
    }
  ],
  "messages": [] // this is invalid
}

So, the following prompt in Latitude is invalid for an Anthropic provider:

---
provider: Anthropic
model: claude-3-5-sonnet-latest
---

This is a system message

This would generate the following warning:

Instead, add at least another message wrapped in a <user> or <assistant> tag:

---
provider: Anthropic
model: claude-3-5-sonnet-latest
---

This is a system message

<user>This is a user message</user>

No system messages are allowed after an assistant or user message

Any system message added after an assistant or user message will be automatically converted into a user message:

---
provider: Anthropic
model: claude-3-5-sonnet-latest
---

This is a system message

<user>This is a user message</user>

<system>This is another system message</system> /* This message will be converted to a user message */

This is because Anthropic does not consider system messages as part of the list of general messages and thus they can’t be concatenated with other messages.