-
Notifications
You must be signed in to change notification settings - Fork 1k
.NET: Seal factory contexts and add non JSO deserialize overloads #3066
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
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 PR enhances the ChatClientAgent API by sealing factory context classes to prevent unintended inheritance and adding convenience overloads for structured output deserialization that use default JSON serializer options.
- Sealed
AIContextProviderFactoryContextandChatMessageStoreFactoryContextclasses to prevent inheritance - Added parameterless
Deserialize<T>()andTryDeserialize<T>()overloads that use default JSON serializer options - Updated tests to verify both the new parameterless overloads and existing JSO-based overloads with conditional compilation for .NET Framework
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgentOptions.cs | Sealed the factory context classes to prevent inheritance |
| dotnet/src/Microsoft.Agents.AI.Abstractions/AgentRunResponse.cs | Added parameterless overloads for Deserialize<T>() and TryDeserialize<T>() that use default JSON serializer options |
| dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgentRunResponse{T}.cs | Removed outdated documentation reference to TryDeserialize{T} |
| dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AgentRunResponseTests.cs | Added tests for new parameterless deserialization overloads with conditional compilation directives for .NET Framework |
dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AgentRunResponseTests.cs
Outdated
Show resolved
Hide resolved
dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AgentRunResponseTests.cs
Outdated
Show resolved
Hide resolved
dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AgentRunResponseTests.cs
Outdated
Show resolved
Hide resolved
dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AgentRunResponseTests.cs
Outdated
Show resolved
Hide resolved
dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AgentRunResponseTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Motivation and Context
The ChatClientAgent factory context classes do not ever make sense to derive from, since they are only created by the ChatClientAgent.
Description
Contribution Checklist