Skip to content

.Net: Chat history serialization for token counting is broken in StepwisePlanner #2773

@neodenit

Description

@neodenit

Describe the bug
When tokens are counted in StepwisePlanner, messages serialize incorrectly: Code URL

The outcome looks like this:

Microsoft.SemanticKernel.AI.ChatCompletion.ChatHistory+ChatMessage
Microsoft.SemanticKernel.AI.ChatCompletion.ChatHistory+ChatMessage
Microsoft.SemanticKernel.AI.ChatCompletion.ChatHistory+ChatMessage
Microsoft.SemanticKernel.AI.ChatCompletion.ChatHistory+ChatMessage

To Reproduce
Steps to reproduce the behavior:

  1. Put a breakpoint in GetChatHistoryTokens
  2. Run StepwisePlanner
  3. See messages string content

Expected behavior
Message content should be concatenated.

Screenshots
If applicable, add screenshots to help explain your problem.

Platform

  • OS: Windows
  • IDE: Visual Studio
  • Language: C#
  • Source: NuGet package version 0.23.230906.2-preview

Additional context
Add any other context about the problem here.

Metadata

Metadata

Labels

.NETIssue or Pull requests regarding .NET codebugSomething isn't workingkernelIssues or pull requests impacting the core kerneltriage

Type

No type

Projects

Status

Sprint: Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions