Fix two critical issues with the RTClient when using Azure OpenAI in Python sample #133
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
deploymentwhereas the actual RTClient implementation expectsazure_deploymentDefaultAzureCredential()directly with RTClient, but this fails due to type mismatches and authentication errorsDoes 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
Get the code
git clone https://github.com/Azure-Samples/aoai-realtime-audio-sdk.git
cd aoai-realtime-audio-sdk
git checkout fix-azure-authentication
pip install -e .
Test the code
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
azure_deploymentinstead ofdeploymentFinding the Files to Change
To help you locate the files that need modification, try:
Other Information
After extensive testing, we found that using token-based authentication with DefaultAzureCredential was problematic:
We attempted various solutions:
The simplest and most reliable solution is using API key authentication as shown in our changes.