-
Notifications
You must be signed in to change notification settings - Fork 850
Update to OpenAI 2.8.0 #7136
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
Update to OpenAI 2.8.0 #7136
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 updates the OpenAI package dependency from version 2.7.0 to 2.8.0 and adapts the codebase to accommodate breaking changes in OpenAI's Responses API. The update involves significant type and method renames, changes to how conversation IDs are represented, and adjustments to API behavior around tool choices and default values.
Key Changes
- API Type Renames: Updated all references from
OpenAIResponseClienttoResponsesClient,ResponseCreationOptionstoCreateResponseOptions, andOpenAIResponsetoResponseResultthroughout the codebase - Conversation ID Handling: Changed from passing conversation IDs as simple strings to wrapping them in
ConversationOptionsobjects, with a new helper method to identify conversation IDs by their "conv_" prefix - API Configuration Changes: Updated the "strictJsonSchema" key to "strict" in AdditionalProperties, removed explicit "tool_choice" settings (now handled as API defaults), and changed the default for
ParallelToolCallsEnabledfrom false to true
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| eng/packages/General.props | Updated OpenAI package version from 2.7.0 to 2.8.0 |
| src/Libraries/Microsoft.Extensions.AI.OpenAI/CHANGELOG.md | Documented the OpenAI 2.8.0 update and API signature changes |
| src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIClientExtensions.cs | Updated type references, changed strict key constant, added IsConversationId helper |
| src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs | Major refactoring to use new API types, conversation options, updated tool construction, added Debug.Assert for reflection calls |
| src/Libraries/Microsoft.Extensions.AI.OpenAI/ResponsesClientContinuationToken.cs | Renamed class from OpenAIResponsesContinuationToken to ResponsesClientContinuationToken |
| src/Libraries/Microsoft.Extensions.AI.OpenAI/MicrosoftExtensionsAIResponsesExtensions.cs | Updated method signatures and type references, changed AsOpenAIResponse to AsOpenAIResponseResult |
| test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientTests.cs | Updated all test type references, removed unused JsonNode import, updated test JSON payloads for conversation object structure |
| test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIResponseClientIntegrationTests.cs | Updated GetOpenAIResponseClient to GetResponsesClient call |
| test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIConversionTests.cs | Updated type references, test assertions for new defaults, method name changes |
| test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/OpenAIChatClientTests.cs | Updated strict key in test from "strictJsonSchema" to "strict" |
| test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/IntegrationTestHelpers.cs | Changed to read API key and mode from environment variables instead of configuration |
| test/Libraries/Microsoft.Extensions.AI.Integration.Tests/ChatClientIntegrationTests.cs | Updated strict key usage in integration tests |
| src/ProjectTemplates/.../Program.cs | Updated template code to use GetResponsesClient instead of GetOpenAIResponseClient |
| test/ProjectTemplates/.../Snapshots/.../Program.cs | Updated test snapshot to match template changes |
Comments suppressed due to low confidence (1)
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/IntegrationTestHelpers.cs:26
- The IntegrationTestHelpers now reads API key and mode from environment variables but still reads the endpoint from TestRunnerConfiguration. This creates an inconsistency in configuration sources. Either all three values should come from environment variables, or all should come from configuration.
Consider updating line 25 to also use environment variables:
var endpoint = Environment.GetEnvironmentVariable("AI:OpenAI:Endpoint")
string? apiKey = Environment.GetEnvironmentVariable("AI:OpenAI:ApiKey");
string? mode = Environment.GetEnvironmentVariable("AI:OpenAI:Mode");
if (string.Equals(mode, "AzureOpenAI", StringComparison.OrdinalIgnoreCase))
{
var endpoint = configuration["OpenAI:Endpoint"]
?? throw new InvalidOperationException("To use AzureOpenAI, set a value for OpenAI:Endpoint");
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIResponsesChatClient.cs
Show resolved
Hide resolved
test/Libraries/Microsoft.Extensions.AI.OpenAI.Tests/IntegrationTestHelpers.cs
Outdated
Show resolved
Hide resolved
ericstj
left a comment
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.
A lot of churn, but most looks reasonable. Just a couple suggestions.
* Update to OpenAI 2.8.0 * Fix merge and address feedback
Microsoft Reviewers: Open in CodeFlow