-
Notifications
You must be signed in to change notification settings - Fork 6.1k
OpenAI library updates #50548
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
OpenAI library updates #50548
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 Azure SDK dependency injection code snippets to migrate from the Azure.AI.OpenAI package (version 2.1.0) to the OpenAI package (version 2.7.0). The changes affect multiple example projects demonstrating dependency injection patterns with different application builders.
- Replaces
Azure.AI.OpenAIwithOpenAIpackage and updates client usage patterns - Introduces
OpenAIResponseClientwithBearerTokenPolicyfor Azure authentication - Adds environment variable validation for
AZURE_OPENAI_ENDPOINT
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/WebApplicationBuilder.csproj | Replaces Azure.AI.OpenAI package reference with OpenAI package |
| docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/Program.cs | Updates OpenAI client registration to use new OpenAI package with custom authentication |
| docs/azure/sdk/snippets/dependency-injection/HostBuilder/Program.cs | Updates OpenAI client registration to use new OpenAI package with custom authentication |
| docs/azure/sdk/snippets/dependency-injection/HostBuilder/HostBuilder.csproj | Replaces Azure.AI.OpenAI package reference with OpenAI package |
| docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/Program.cs | Updates OpenAI client registration to use new OpenAI package with custom authentication |
| docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/HostApplicationBuilder.csproj | Replaces Azure.AI.OpenAI package reference with OpenAI package |
| docs/azure/sdk/snippets/dependency-injection/Directory.Packages.props | Updates central package version management from Azure.AI.OpenAI 2.1.0 to OpenAI 2.7.0 |
| docs/azure/sdk/snippets/authentication/Directory.Packages.props | Updates central package version management from Azure.AI.OpenAI 2.1.0 to OpenAI 2.7.0 |
docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/WebApplicationBuilder.csproj
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Scott Addie <[email protected]>
docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/Program.cs
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/Program.cs
Show resolved
Hide resolved
Co-authored-by: Scott Addie <[email protected]>
docs/azure/sdk/snippets/authentication/Directory.Packages.props
Outdated
Show resolved
Hide resolved
scottaddie
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.
These changes will successfully upgrade the code to use v2.8.0 of the OpenAI package
docs/azure/sdk/snippets/authentication/Directory.Packages.props
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/Directory.Packages.props
Outdated
Show resolved
Hide resolved
Co-authored-by: Scott Addie <[email protected]>
docs/azure/sdk/snippets/dependency-injection/HostBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/HostApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
docs/azure/sdk/snippets/dependency-injection/WebApplicationBuilder/Program.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Scott Addie <[email protected]>
Summary
Describe your changes here.
Fixes #Issue_Number (if available)
Internal previews