-
Notifications
You must be signed in to change notification settings - Fork 1.1k
.NET: Allow overriding the ChatMessageStore to be used per agent run. #3330
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
.NET: Allow overriding the ChatMessageStore to be used per agent run. #3330
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds functionality to allow overriding the ChatMessageStore on a per-agent-run basis via AdditionalProperties. The PR also reorganizes tests by moving ChatMessageStore and ConversationId related tests into a separate file.
Changes:
- Added AdditionalPropertiesExtensions with type-based key storage/retrieval for AdditionalPropertiesDictionary
- Implemented ResolveChatMessageStore to support ChatMessageStore overrides via AdditionalProperties
- Made ChatMessageStoreMessages nullable in InvokedContext to handle first-run scenarios
- Reorganized tests by moving chat history management tests to a dedicated file
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI.Abstractions/AdditionalPropertiesExtensions.cs | New extension methods for type-based storage/retrieval in AdditionalPropertiesDictionary |
| dotnet/src/Microsoft.Agents.AI.Abstractions/ChatMessageStore.cs | Made ChatMessageStoreMessages parameter nullable in InvokedContext constructor |
| dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs | Added ResolveChatMessageStore method and updated all notification call sites to pass chatOptions |
| dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AdditionalPropertiesExtensionsTests.cs | Comprehensive tests for AdditionalPropertiesExtensions |
| dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgent_ChatHistoryManagementTests.cs | New test file consolidating ChatMessageStore and ConversationId tests, including override test |
| dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgentTests.cs | Removed tests that were moved to ChatHistoryManagementTests |
| dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgent_DeserializeThreadTests.cs | Namespace changed for consistency |
| dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgent_GetNewThreadTests.cs | Namespace changed for consistency |
| dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgentContinuationTokenTests.cs | Namespace changed for consistency |
...tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgent_ChatHistoryManagementTests.cs
Show resolved
Hide resolved
dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AdditionalPropertiesExtensionsTests.cs
Show resolved
Hide resolved
...tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgent_ChatHistoryManagementTests.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Abstractions/AdditionalPropertiesExtensions.cs
Show resolved
Hide resolved
…#3330) * Allow overriding the ChatMessageStore to be used per agent run. * Fix typos * Fix Add and add TryAdd, Contains and Remove
Motivation and Context
#3104
Description
Contribution Checklist