-
Notifications
You must be signed in to change notification settings - Fork 847
Add content to represent service-side actions #7109
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
base: main
Are you sure you want to change the base?
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 introduces ServiceActionContent as a new base class for content types representing service-side actions. It refactors CodeInterpreterToolCallContent, CodeInterpreterToolResultContent, McpServerToolCallContent, and McpServerToolResultContent to extend this base class, consolidating the common Id property (previously CallId). This change improves the type hierarchy and provides a cleaner abstraction for service-hosted operations.
Key Changes
- Introduces
ServiceActionContentbase class with a requiredIdproperty - Updates code interpreter and MCP server tool content classes to inherit from
ServiceActionContent - Standardizes property naming from
CallIdtoIdacross all service action content types - Makes
ida required constructor parameter (previously nullable/optional)
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/ServiceActionContent.cs |
New base class for service-side actions with required Id property |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/CodeInterpreterToolCallContent.cs |
Updated to extend ServiceActionContent and require id in constructor |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/CodeInterpreterToolResultContent.cs |
Updated to extend ServiceActionContent and require id in constructor |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/McpServerToolCallContent.cs |
Updated to extend ServiceActionContent, removing duplicate CallId property |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/McpServerToolResultContent.cs |
Updated to extend ServiceActionContent, removing duplicate CallId property |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Contents/AIContent.cs |
Added ServiceActionContent to polymorphic type comments |
src/Libraries/Microsoft.Extensions.AI.Abstractions/Utilities/AIJsonUtilities.Defaults.cs |
Registered ServiceActionContent for JSON serialization |
src/Libraries/Microsoft.Extensions.AI.Abstractions/ChatCompletion/ChatResponseExtensions.cs |
Updated coalescing logic to use Id property |
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs |
Updated to use Id property and new constructors |
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIAssistantsChatClient.cs |
Updated to use new constructors with required id |
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/ServiceActionContentTests.cs |
New comprehensive test suite for ServiceActionContent |
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/CodeInterpreterToolCallContentTests.cs |
Updated tests for constructor changes and added serialization test |
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/CodeInterpreterToolResultContentTests.cs |
Updated tests for constructor changes and added validation test |
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/McpServerToolCallContentTests.cs |
Updated tests for property renaming and added serialization test |
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/McpServerToolResultContentTests.cs |
Updated tests for property renaming |
test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/AIContentTests.cs |
Added ServiceActionContent to polymorphic serialization test |
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientTests.cs |
Updated integration tests to use Id property |
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientIntegrationTests.cs |
Updated integration tests to use Id property |
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIAssistantChatClientIntegrationTests.cs |
Simplified assertions to use required Id property |
Introduce ServiceActionContent and implement it in CodeInterpreter and McpServerTool contents.
Naming considerations:
Microsoft Reviewers: Open in CodeFlow