google / google/generative-ai-docs
API rejects multiple role: "user" messages in a row
Open
component:support
type:bug
- Dominant language
- Jupyter Notebook
- Stars
- 2.3k
- Forks
- 735
- PR merge metrics
- No merged PRs in 30d
Description
### Description of the bug:
If you submit a prompt like this to Gemini Pro:
```
{
contents: [
{ role: "user", ...}
{ role: "user", ....}
]
}
```
The API will respond that the last message must come from user.
This occurred when I was translating my GPT role: "system" messages to be role: "user". (But GPT also doesn't reject multiple user messages in a row)
### Actual vs expected behavior:
1. The error message should be accurate
2. The API shouldn't reject two user messages in a row
### Any other information you'd like to share?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.