Skip to content

Python: Agents - Chat throwing "A conversation must alternate between user and assistant roles. Make sure the conversation alternates between user and assistant roles and try again." #10281

Closed
@sophialagerkranspandey

Description

@sophialagerkranspandey

Discussed in #10271

Originally posted by yarns123 January 23, 2025
Hi,

im trying to use this example https://github.com/microsoft/semantic-kernel/blob/main/python/samples/getting_started_with_agents/step3_chat.py with AWS Bedrock Claude Sonnet 3.5. Unfortunately I get this error:
botocore.errorfactory.ValidationException: An error occurred (ValidationException) when calling the Converse operation: A conversation must alternate between user and assistant roles. Make sure the conversation alternates between user and assistant roles and try again.

It seems that ChatHistory for this model cannot have two consecutive responses from the assistant. I would be grateful for any ideas on how to solve this problem

Metadata

Metadata

Assignees

Labels

agentspythonPull requests for the Python Semantic Kernelsk team issueA tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions