-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Change client retrieval to use Azure OpenAI client #36722
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
|
Thank you for your contribution @BennyDanielT! We will review the pull request and get back to you soon. |
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 attempts to change the method used to retrieve an OpenAI client from getOpenAIClient() to getAzureOpenAIClient(). However, this change introduces a critical bug. The AIProjectClient class does not have a getAzureOpenAIClient() method - it only has getOpenAIClient(), which is the correct method that was being used before this change.
Key Changes
- Changes the method call from
project.getOpenAIClient()toproject.getAzureOpenAIClient()in the agentBasic sample - This change is incorrect and will result in a runtime error
| // Create AI Project client | ||
| const project = new AIProjectClient(projectEndpoint, new DefaultAzureCredential()); | ||
| const openAIClient = await project.getOpenAIClient(); | ||
| const openAIClient = await project.getAzureOpenAIClient(); |
Copilot
AI
Nov 24, 2025
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.
This change introduces a bug. The AIProjectClient class does not have a getAzureOpenAIClient() method. The correct method is getOpenAIClient(), which is defined in sdk/ai/ai-projects/src/aiProjectClient.ts at line 127.
Other samples in the same directory (e.g., agentCodeInterpreter.ts, agentFunctionTool.ts) correctly use getOpenAIClient(). This change should be reverted to use await project.getOpenAIClient() instead.
| const openAIClient = await project.getAzureOpenAIClient(); | |
| const openAIClient = await project.getOpenAIClient(); |
|
Hi @BennyDanielT, Thanks for opening this PR. Just to clarify, what're you trying to achieve here? Are you using @azure/[email protected]? |
Packages impacted by this PR
None.
Issues associated with this PR
I didn;t create one. I'm pretty sure this PR is gonna get requested because I might be making mistakes, but I'd like to know how to do this the right way. Cheers!
Describe the problem that is addressed by this PR
Property 'getOpenAIClient' does not exist on type 'AIProjectClient therefore we have to use
getAzureOpenAIClient.What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?
Not Applicable.
Are there test cases added in this PR? (If not, why?)
No. I am a noob
Provide a list of related PRs (if any)
None.
Command used to generate this PR:**(Applicable only to SDK release request PRs)
Checklists