bedrock-access-gateway icon indicating copy to clipboard operation
bedrock-access-gateway copied to clipboard

Error when including multiple user messages in a single request

Open ysekiy opened this issue 1 year ago • 0 comments

Describe the bug When including multiple messages in a single request following the OpenAI format, an error occurs.

Please complete the following information:

  • [x] Which API you used: [e.g. /chat/completions]
  • [x] Which model you used: [e.g. anthropic.claude-3-sonnet-20240229-v1:0]

To Reproduce

export $OPENAI_BASE_URL=hogehoge
export $OPENAI_API_KEY=bedrock

curl $OPENAI_BASE_URL/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer $OPENAI_API_KEY" -d '{
"model": "anthropic.claude-3-sonnet-20240229-v1:0",
"messages": [
{
"role": "user",
"content": "Hello!"
},
{
"role": "user",
"content": "Hello!"
}
]
}'

Expected behavior

When providing the above messages, I expected to receive a valid response instead of an error.

Screenshots

{"detail":"An error occurred (ValidationException) when calling the Converse operation: A conversation must alternate between user and assistant roles. Make sure the con

ysekiy avatar Jun 26 '24 16:06 ysekiy