Skip to content

Conversation

@BennyDanielT
Copy link

@BennyDanielT BennyDanielT commented Nov 24, 2025

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

  • Added impacted package name to the issue description
  • Does this PR needs any fixes in the SDK Generator?** (If so, create an Issue in the Autorest/typescript repository and link it here)
  • Added a changelog (if necessary)

Copilot AI review requested due to automatic review settings November 24, 2025 00:42
@github-actions github-actions bot added Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Nov 24, 2025
@github-actions
Copy link

Thank you for your contribution @BennyDanielT! We will review the pull request and get back to you soon.

Copy link
Contributor

Copilot AI left a 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() to project.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();
Copy link

Copilot AI Nov 24, 2025

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.

Suggested change
const openAIClient = await project.getAzureOpenAIClient();
const openAIClient = await project.getOpenAIClient();

Copilot uses AI. Check for mistakes.
@deyaaeldeen
Copy link
Member

Hi @BennyDanielT, Thanks for opening this PR. Just to clarify, what're you trying to achieve here? Are you using @azure/[email protected]?

@deyaaeldeen deyaaeldeen marked this pull request as draft November 24, 2025 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants