Skip to content

.Net: Bug: ChatHistory function call ordering is broken in streaming mode #13243

@bjornhandersson

Description

@bjornhandersson

When using GetStreamingChatMessageContentsAsync with function calls, the results are added to ChatHistory in order of completion rather than order of execution causing error when submitting history in subsequence "chats" to bedrock.

Expected toolResult blocks at messages.7.content for the following Ids: tooluse_DiChMHwyRF2Ww0ib_XXXXX, but found: tooluse_IH0P-g2aTgi_ufQ0OXXXXX

To Reproduce
See code in comment below

Expected behavior
Bedrock tool use and tool result should maintain the order in the history.

Platform

  • Language: C#
  • AI model: Bedrock - claude sonnet 4.5
  • Versions
    • Microsoft.SemanticKernel: 1.65
    • Microsoft.SemanticKernel.Connectors.Amazon: 1.65-alpha

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETIssue or Pull requests regarding .NET codebugSomething isn't workingtriage

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions