Skip to content

Conversation

@Mukhsin0508
Copy link

Purpose

  • Fix two critical issues with the RTClient when using Azure OpenAI:
    1. Parameter name mismatch: The sample code incorrectly uses deployment whereas the actual RTClient implementation expects azure_deployment
    2. Authentication issues: The sample code suggests using DefaultAzureCredential() directly with RTClient, but this fails due to type mismatches and authentication errors

Does this introduce a breaking change?

[ ] Yes
[x] No

Pull Request Type

What kind of change does this Pull Request introduce?
[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[x] Documentation content changes
[ ] Other... Please describe:

How to Test

Set up environment variables

export AZURE_OPENAI_ENDPOINT="your_endpoint"
export AZURE_OPENAI_API_KEY="your_api_key"
export AZURE_OPENAI_DEPLOYMENT="your_deployment_name"

Run the sample code that uses RTClient with Azure

The exact testing steps will depend on the samples in the repository

What to Check

Verify that the following are valid

  • The sample code now correctly uses azure_deployment instead of deployment
  • Authentication with Azure OpenAI works correctly using the API key method
  • Documentation correctly explains authentication options

Finding the Files to Change
To help you locate the files that need modification, try:

grep -r "token_credential=DefaultAzureCredential()" .
grep -r "deployment=" .

Other Information

After extensive testing, we found that using token-based authentication with DefaultAzureCredential was problematic:

  1. It requires implementation of an AsyncTokenCredentialAdapter because RTClient expects an async credential
  2. Even with the adapter, we continuously received 401 Unauthorized errors
  3. Using API key authentication with AzureKeyCredential resolves these issues and provides a simpler approach

We attempted various solutions:

  • Created adapters for DefaultAzureCredential
  • Tried running sync methods in async executors
  • Tested different token acquisition approaches

The simplest and most reliable solution is using API key authentication as shown in our changes.

@Mukhsin0508
Copy link
Author

@microsoft-github-policy-service agree company="WiderAI"

@Mukhsin0508
Copy link
Author

Please take a look @jpalvarezl @archerzz @digitarald @paulbatum @bterlson

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.

1 participant