-
Notifications
You must be signed in to change notification settings - Fork 593
.NET: Switch use of AzureOpenAIClient to OpenAIClient #1167
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 successfully migrates all usage of AzureOpenAIClient from the Azure.AI.OpenAI package to the base OpenAIClient class from the OpenAI SDK, following Microsoft's recommendation to use OpenAIClient with the /openai/v1 route instead of AzureOpenAIClient.
Key changes:
- Replaced all
AzureOpenAIClientinstantiations withOpenAIClientusing proper endpoint configuration and authentication - Updated authentication to use
BearerTokenPolicywrapper for Azure credentials - Removed Azure.AI.OpenAI package dependencies across all affected projects
Reviewed Changes
Copilot reviewed 67 out of 67 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Multiple Program.cs files | Updated client instantiation from AzureOpenAIClient to OpenAIClient with proper endpoint and authentication configuration |
| Multiple .csproj files | Removed Azure.AI.OpenAI package references |
| Directory.Packages.props | Removed centralized Azure.AI.OpenAI package version declaration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: stephentoub <[email protected]>
Co-authored-by: stephentoub <[email protected]>
…OpenAIClient Co-authored-by: stephentoub <[email protected]>
…Directory.Packages.props Co-authored-by: stephentoub <[email protected]>
a37f0fc to
c39949c
Compare
dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIChatCompletion/Program.cs
Show resolved
Hide resolved
|
This PR, as far as I understand, will close these two issues, correct? |
No, this does nothing about the compatibility of the packages. This just reduces this repo's reliance on Azure.AI.OpenAI, switching to the recommendation of using the base package directly, thereby reducing the impact that those issues have (they still impact the repo, however, due to samples that use SK) on this repo. For now, I would like to see us:
|
dotnet/samples/GettingStarted/Agents/Agent_Step05_StructuredOutput/Program.cs
Outdated
Show resolved
Hide resolved
|
@copilot resolve the conflicts |
…ckage versions Co-authored-by: SergeyMenshykh <[email protected]>
|
Replaced by #1402 |
Overview
This PR migrates all usage of
AzureOpenAIClientfrom the Azure.AI.OpenAI package to the baseOpenAIClientclass from the OpenAI SDK. Per the issue requirements, usingOpenAIClientwith the/openai/v1route is recommended over usingAzureOpenAIClient.Changes Made
Code Migration (39 files)
Updated all C# sample files across the repository to use
OpenAIClientinstead ofAzureOpenAIClient:Key Technical Changes
/openai/v1to the URIAzureCliCredential,DefaultAzureCredential) is now wrapped inBearerTokenPolicywith scopehttps://ai.azure.com/.defaultAzure.AI.OpenAInamespace withSystem.ClientModelandSystem.ClientModel.PrimitivesPackage Cleanup (30 files)
Azure.AI.OpenAIpackage reference from 29 .csproj filesAzure.AI.OpenAIversion declaration fromDirectory.Packages.propsBefore:
After:
Verification
AzureOpenAIClientusage in the codebaseNotes
System.ClientModelpackage is available transitively through the OpenAI SDK, so no explicit package reference is neededFixes #1165
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.