For those interested, I have attached
It appears that Gemini is the only one that requires the system to be in the first position.
Here is what I tested thus far:
1. Separate the system messages and use the "system" parameter. It ignored it, have commented it out.
2. Tried to keep all history in the messages parameter, this works but Genkit or something can throw errors if they are not in the order it expects e.g. if you have types of messages as user then model then model the LLM seems to blow up. This can happen in tool calls and other edge cases you might have user / user / model / model. To get around this, I dont pass the history in as separate messgaes I append to the system message and make sure that is the first one.
3. Use the history fully populated parameter with 1 and 2. Adding history still make no difference. Perhaps we should just remove it as it adds no value as far as I can tell... I have just set it to {}
In summary the "system" parameter and the "history" do not appear to work as one would expect.
Thank you for the insights into the "convert the system messages into "user" messages with some special handling." Can I clarify for Anthropic it will do this if I keep the system message as the first one? In my quick review of the Anthropic plugin it doesn't seem to support the system role at all?