Skip to content

Upgrade OpenAI dependency to 2.12.0#7608

Open
jozkee with Copilot wants to merge 1 commit into
mainfrom
copilot/upgrade-openai-dependency
Open

Upgrade OpenAI dependency to 2.12.0#7608
jozkee with Copilot wants to merge 1 commit into
mainfrom
copilot/upgrade-openai-dependency

Conversation

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Bumps the OpenAI NuGet package from 2.11.0 to 2.12.0 and fixes the one breaking API change that surfaced.

Changes

  • eng/packages/General.propsOpenAI version 2.11.02.12.0
  • OpenAIHostedFileClient.csContainerClient.GetContainerFilesAsync changed its signature from five flat parameters to a ContainerFileCollectionOptions object:
// Before (2.11.0)
containerClient.GetContainerFilesAsync(
    containerId, limit < int.MaxValue ? limit : null,
    null, after, new() { CancellationToken = cancellationToken });

// After (2.12.0)
containerClient.GetContainerFilesAsync(
    new ContainerFileCollectionOptions(containerId)
    {
        PageSizeLimit = limit < int.MaxValue ? limit : null,
        AfterId = after,
    }, cancellationToken);

The other 2.12.0 breaking changes (container type renames, Conversations parameter ordering, Responses type renames) are all in experimental APIs not referenced by this codebase.

Microsoft Reviewers: Open in CodeFlow

@dotnet-comment-bot

Copy link
Copy Markdown
Collaborator

‼️ Found issues ‼️

Project Coverage Type Expected Actual
Microsoft.Extensions.Diagnostics.Testing Line 99 98.65 🔻
Microsoft.Extensions.Telemetry Line 93 91.95 🔻
Microsoft.Extensions.AI Line 89 88.65 🔻
Microsoft.Extensions.AI Branch 89 88.57 🔻
Microsoft.Extensions.AI.OpenAI Line 75 62.93 🔻
Microsoft.Extensions.AI.OpenAI Branch 75 50.41 🔻
Microsoft.Extensions.DataIngestion.MarkItDown Line 75 4.46 🔻
Microsoft.Extensions.DataIngestion.MarkItDown Branch 75 0 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring Line 99 96.03 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring Branch 99 94.39 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Kubernetes Line 99 97.73 🔻
Microsoft.Extensions.ServiceDiscovery.Dns Line 75 68.32 🔻
Microsoft.Extensions.ServiceDiscovery.Abstractions Line 75 42.11 🔻
Microsoft.Extensions.ServiceDiscovery.Abstractions Branch 75 42.86 🔻
Microsoft.Extensions.ServiceDiscovery Line 75 69.82 🔻
Microsoft.Extensions.ServiceDiscovery Branch 75 71.43 🔻
Microsoft.Extensions.ServiceDiscovery.Yarp Line 75 73.85 🔻
Microsoft.Extensions.ServiceDiscovery.Yarp Branch 75 70 🔻
Microsoft.Extensions.VectorData.Abstractions Line 75 37.39 🔻
Microsoft.Extensions.VectorData.Abstractions Branch 75 22.73 🔻

🎉 Good job! The coverage increased 🎉
Update MinCodeCoverage in the project files.

Project Expected Actual
Microsoft.Gen.BuildMetadata 97 100
Microsoft.Gen.MetadataExtractor 57 73
Microsoft.Gen.MetricsReports 67 69
Microsoft.Extensions.AI.Abstractions 82 85
Microsoft.Extensions.AI.Evaluation.NLP 0 78
Microsoft.Extensions.Caching.Hybrid 82 84
Microsoft.Extensions.DataIngestion 75 89
Microsoft.Extensions.DataIngestion.Markdig 75 90
Microsoft.Extensions.Http.Resilience 97 100

Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1492107&view=codecoverage-tab

@jozkee jozkee marked this pull request as ready for review July 2, 2026 20:04
@jozkee jozkee requested review from a team as code owners July 2, 2026 20:04
Copilot AI review requested due to automatic review settings July 2, 2026 20:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the repo’s OpenAI SDK dependency to v2.12.0 and adapts Microsoft.Extensions.AI.OpenAI’s container-file listing implementation to the SDK’s updated API surface.

Changes:

  • Bumped the OpenAI NuGet dependency from 2.11.0 to 2.12.0.
  • Updated OpenAIHostedFileClient.ListFilesAsync to call ContainerClient.GetContainerFilesAsync using the new ContainerFileCollectionOptions parameter object while preserving the “single raw page only” pagination workaround.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
eng/packages/General.props Updates the centrally-managed OpenAI package version to 2.12.0.
src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIHostedFileClient.cs Adjusts container file listing to the new GetContainerFilesAsync(ContainerFileCollectionOptions, …) signature without changing the existing manual paging + raw JSON parsing behavior.

{
PageSizeLimit = limit < int.MaxValue ? limit : null,
AfterId = after,
}, cancellationToken);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment a few lines up still says "Use OpenAI's protocol overload," but in 2.12.0 the only GetContainerFilesAsync overload is the convenience one returning AsyncCollectionResult<T> (upcast to the base here). The workaround still holds, since you only read the first raw page via GetRawPagesAsync(), but the comment is now inaccurate and worth updating.

AsyncCollectionResult result = containerClient.GetContainerFilesAsync(
containerId, limit < int.MaxValue ? limit : null,
null, after, new() { CancellationToken = cancellationToken });
new ContainerFileCollectionOptions(containerId)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: 2.12.0 adds GetContainerFileCollectionPageAsync(containerId, limit, order, after, RequestOptions), which returns a single raw ClientResult page. That is the actual protocol single-page primitive and matches the "single page, handle paging manually" intent more directly than upcasting a convenience collection and relying on GetRawPagesAsync() to avoid deserialization. It would also keep the comment above accurate.

@dotnet-comment-bot

Copy link
Copy Markdown
Collaborator

‼️ Found issues ‼️

Project Coverage Type Expected Actual
Microsoft.Extensions.Diagnostics.Testing Line 99 98.65 🔻
Microsoft.Extensions.Telemetry Line 93 91.95 🔻
Microsoft.Extensions.AI Line 89 88.6 🔻
Microsoft.Extensions.AI Branch 89 88.57 🔻
Microsoft.Extensions.AI.OpenAI Line 75 62.93 🔻
Microsoft.Extensions.AI.OpenAI Branch 75 50.41 🔻
Microsoft.Extensions.DataIngestion.MarkItDown Line 75 4.46 🔻
Microsoft.Extensions.DataIngestion.MarkItDown Branch 75 0 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring Line 99 96.03 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring Branch 99 94.39 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Kubernetes Line 99 97.73 🔻
Microsoft.Extensions.ServiceDiscovery.Dns Line 75 68.32 🔻
Microsoft.Extensions.ServiceDiscovery.Abstractions Line 75 42.11 🔻
Microsoft.Extensions.ServiceDiscovery.Abstractions Branch 75 42.86 🔻
Microsoft.Extensions.ServiceDiscovery Line 75 67.21 🔻
Microsoft.Extensions.ServiceDiscovery Branch 75 71.43 🔻
Microsoft.Extensions.ServiceDiscovery.Yarp Line 75 73.85 🔻
Microsoft.Extensions.ServiceDiscovery.Yarp Branch 75 70 🔻
Microsoft.Extensions.VectorData.Abstractions Line 75 37.39 🔻
Microsoft.Extensions.VectorData.Abstractions Branch 75 22.73 🔻

🎉 Good job! The coverage increased 🎉
Update MinCodeCoverage in the project files.

Project Expected Actual
Microsoft.Gen.BuildMetadata 97 100
Microsoft.Gen.MetadataExtractor 57 73
Microsoft.Gen.MetricsReports 67 69
Microsoft.Extensions.AI.Abstractions 82 85
Microsoft.Extensions.AI.Evaluation.NLP 0 78
Microsoft.Extensions.Caching.Hybrid 82 89
Microsoft.Extensions.DataIngestion 75 89
Microsoft.Extensions.DataIngestion.Markdig 75 90
Microsoft.Extensions.Http.Resilience 97 100

Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1492273&view=codecoverage-tab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants