-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
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:
- The list of
ChatResponseUpdatesgets converted to aChatResponseobject (https://github.com/microsoft/agent-framework/blob/dotnet-1.0.0-preview.251219.1/dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs#L268). - However, the conversion method only adds the
AdditionalPropertiesto theChatResponseand not the underlying list ofChatMessageobjects (https://github.com/dotnet/extensions/blob/v10.0.0/src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponseExtensions.cs#L581-L591). - 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