Skip to content

.NET: [Issue]: .NET: AdditionalProperties saved to ChatResponseUpdate not stored in message store #3086

@stekiri

Description

@stekiri

Language

.NET

Type of Issue

Bug

Microsoft.Agents.AI

dotnet-1.0.0-preview.251219.1

Microsoft.Agents.AI.Abstractions

No response

Microsoft.Agents.AI.OpenAI

No response

Microsoft.Agents.AI.AzureAI

No response

Microsoft.Agents.AI.Anthropic

No response

Microsoft.Agents.AI.Hosting

No response

Microsoft.Agents.AI.Workflows

No response

Other .NET Packages

No response

agent-framework-core

No response

agent-framework-azure-ai

No response

agent-framework-anthropic

No response

agent-framework-azurefunctions

No response

Other Python Packages

No response

Description

In non-streaming mode: When adding AdditionalProperties to the ChatResponse in the GetResponseAsync method of a IChatClient implementation, the AdditionalProperties are stored correctly in a message store.

In streaming mode: When adding AdditionalProperties to a ChatResponseUpdate in the GetStreamingResponseAsync method of a IChatClient implementation, the AdditionalProperties are not stored in the message store.

The reason is as follows:

  1. The list of ChatResponseUpdates gets converted to a ChatResponse object (https://github.com/microsoft/agent-framework/blob/dotnet-1.0.0-preview.251219.1/dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs#L268).
  2. However, the conversion method only adds the AdditionalProperties to the ChatResponse and not the underlying list of ChatMessage objects (https://github.com/dotnet/extensions/blob/v10.0.0/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponseExtensions.cs#L581-L591).
  3. Then, these chat messages without the additional properties are sent to the message store (https://github.com/microsoft/agent-framework/blob/dotnet-1.0.0-preview.251219.1/dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs#L275).

I wasn't entirely sure if I should create an issue directly in Microsoft.Extensions.AI.Abstractions, I wanted to at least leave a trace here to justify the need.

Let me know how to proceed.

Code Sample

Additional Context

No response

Metadata

Metadata

Assignees

Labels

.NETbugSomething isn't workingv1.0Features being tracked for the version 1.0 GA

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions