-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Change resources used in Live AI tests #53529
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
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 refactors the Azure AI Voice Live test infrastructure by removing placeholder Key Vault resources and enabling Voice Live testing in East US with dynamic audio generation. The changes streamline the test setup by eliminating unused infrastructure and replacing static audio files with runtime-synthesized speech.
Key Changes:
- Removed unused Key Vault resources from test infrastructure
- Changed Voice Live tests to use Azure Speech SDK for dynamic audio generation instead of static WAV files
- Added East US location support for test resources
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/ai/tests.yml | Added East US location parameter for test deployment |
| sdk/ai/test-resources.json | Removed Key Vault resources and outputs; renamed 'name' parameter to 'baseName' |
| sdk/ai/Azure.AI.VoiceLive/tests/VoiceLiveTestBase.cs | Replaced audio file loading with Speech SDK-based audio generation; removed Setup method |
| sdk/ai/Azure.AI.VoiceLive/tests/LiveTests/BasicConversationTests.cs | Updated test calls to use text-to-speech instead of WAV file names |
| sdk/ai/Azure.AI.VoiceLive/tests/ContentLoggingTests.cs | Removed base.Setup() call and override keyword |
| sdk/ai/Azure.AI.VoiceLive/tests/ContentLoggingPerformanceTests.cs | Removed unused imports and added Ignore attribute to flaky test |
| sdk/ai/Azure.AI.VoiceLive/tests/Azure.AI.VoiceLive.Tests.csproj | Added Microsoft.CognitiveServices.Speech package dependency |
| using System.Diagnostics; | ||
| using System.IO; | ||
| using System.Linq; | ||
| using System.Security.Authentication.ExtendedProtection; |
Copilot
AI
Oct 28, 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 using statement for 'System.Security.Authentication.ExtendedProtection' appears to be unused. It should be removed if there are no references to types from this namespace in the file.
| using System.Security.Authentication.ExtendedProtection; |
| using (var synthsizer = new SpeechSynthesizer(sc, ac)) | ||
| { | ||
| var result = await synthsizer.SpeakTextAsync(text).ConfigureAwait(false); |
Copilot
AI
Oct 28, 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.
Corrected spelling of 'synthsizer' to 'synthesizer'.
| using (var synthsizer = new SpeechSynthesizer(sc, ac)) | |
| { | |
| var result = await synthsizer.SpeakTextAsync(text).ConfigureAwait(false); | |
| using (var synthesizer = new SpeechSynthesizer(sc, ac)) | |
| { | |
| var result = await synthesizer.SpeakTextAsync(text).ConfigureAwait(false); |
| var of = SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm; | ||
| var sc = SpeechConfig.FromEndpoint(new Uri(TestEnvironment.Endpoint), new AzureKeyCredential(TestEnvironment.ApiKey)); | ||
| sc.SetSpeechSynthesisOutputFormat(of); | ||
| using (var ac = AudioConfig.FromWavFileOutput(path)) | ||
| using (var synthsizer = new SpeechSynthesizer(sc, ac)) | ||
| { | ||
| var result = await synthsizer.SpeakTextAsync(text).ConfigureAwait(false); | ||
| if (result.Reason != ResultReason.SynthesizingAudioCompleted) | ||
| { | ||
| throw new Exception($"Error {result.Reason} was not synthesis completed"); | ||
| } | ||
|
|
||
| return result.AudioData; | ||
| } |
Copilot
AI
Oct 28, 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.
The temporary file created on line 93 is never deleted, creating a resource leak. The file should be deleted after the audio synthesis is complete, preferably in a finally block or by wrapping the path creation in a try-finally pattern to ensure cleanup even if an exception occurs.
| var of = SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm; | |
| var sc = SpeechConfig.FromEndpoint(new Uri(TestEnvironment.Endpoint), new AzureKeyCredential(TestEnvironment.ApiKey)); | |
| sc.SetSpeechSynthesisOutputFormat(of); | |
| using (var ac = AudioConfig.FromWavFileOutput(path)) | |
| using (var synthsizer = new SpeechSynthesizer(sc, ac)) | |
| { | |
| var result = await synthsizer.SpeakTextAsync(text).ConfigureAwait(false); | |
| if (result.Reason != ResultReason.SynthesizingAudioCompleted) | |
| { | |
| throw new Exception($"Error {result.Reason} was not synthesis completed"); | |
| } | |
| return result.AudioData; | |
| } | |
| try | |
| { | |
| var of = SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm; | |
| var sc = SpeechConfig.FromEndpoint(new Uri(TestEnvironment.Endpoint), new AzureKeyCredential(TestEnvironment.ApiKey)); | |
| sc.SetSpeechSynthesisOutputFormat(of); | |
| using (var ac = AudioConfig.FromWavFileOutput(path)) | |
| using (var synthsizer = new SpeechSynthesizer(sc, ac)) | |
| { | |
| var result = await synthsizer.SpeakTextAsync(text).ConfigureAwait(false); | |
| if (result.Reason != ResultReason.SynthesizingAudioCompleted) | |
| { | |
| throw new Exception($"Error {result.Reason} was not synthesis completed"); | |
| } | |
| return result.AudioData; | |
| } | |
| } | |
| finally | |
| { | |
| try | |
| { | |
| if (File.Exists(path)) | |
| { | |
| File.Delete(path); | |
| } | |
| } | |
| catch | |
| { | |
| // Ignore exceptions during cleanup | |
| } | |
| } |
| throw new Exception($"Error {result.Reason} was not synthesis completed"); | ||
| } | ||
|
|
||
| return result.AudioData; |
Copilot
AI
Oct 28, 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.
The AudioConfig writes to a file on line 97, but line 106 returns result.AudioData from the synthesizer result. This makes the file output configuration and temporary file path on lines 93-97 unnecessary. Either remove the file-based AudioConfig and use a memory-based configuration, or read from the generated file instead of using result.AudioData.
| <PackageReference Include="Microsoft.NET.Test.Sdk" /> | ||
| <PackageReference Include="Moq" /> | ||
| <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" /> | ||
| <PackageReference Include="Microsoft.CognitiveServices.Speech" VersionOverride="1.46.0" /> |
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.
Would you please be so kind as to explain an override is being used here and the plan for removing it for the longer-term?
Drop the placeholder KV resource.
Create a Foundry Resource in East US (One region VL is enabled)
Change VL Live tests from using saved wav files to instead using the Azure Speech SDK to synthesize text.