Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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." #10277

Closed
sophialagerkranspandey opened this issue Jan 23, 2025 · 1 comment
Assignees
Labels
agents .NET Issue or Pull requests regarding .NET code python Pull requests for the Python Semantic Kernel

Comments

@sophialagerkranspandey
Copy link
Contributor

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

@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code python Pull requests for the Python Semantic Kernel triage labels Jan 23, 2025
@github-actions github-actions bot changed the title 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." .Net: 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." Jan 23, 2025
@github-actions github-actions bot changed the title .Net: 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." 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." Jan 23, 2025
@moonbox3
Copy link
Contributor

Closing as a duplicate of #10281

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agents .NET Issue or Pull requests regarding .NET code python Pull requests for the Python Semantic Kernel
Projects
None yet
Development

No branches or pull requests

4 participants