System messages must be followed by at least another message
Google Vertex 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 Vertex would be empty, which would result in an error.
Copy
Ask AI
{ "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 a Google Vertex provider:
Copy
Ask AI
---provider: MyVertexProvidermodel: gemini-1.0-pro---This is a system message
This would generate the following warning:Instead, add at least another message wrapped in a <user> or <assistant> tag:
Copy
Ask AI
---provider: MyVertexProvidermodel: gemini-1.0-pro---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:
Copy
Ask AI
---provider: MyVertexProvidermodel: gemini-1.0-pro---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 Google Vertex does not consider system messages as part of the list of general messages and thus they can’t be concatenated with other messages.
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.