Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.26k stars 4.61k forks source link

[BUG] Azure.AI.OpenAI (2.0.0-beta.3) not compatible with OpenAI (2.0.0-beta.10), AudioClient fails with 404 #45706

Closed grankko closed 3 weeks ago

grankko commented 3 weeks ago

Library name and version

Azure.AI.OpenAI (2.0.0-beta.3) and OpenAI (2.0.0-beta.10)

Describe the bug

OpenAI 2.0.0 beta 10 package breaks the latest version of the Azure.AI.OpenAI package. When setting up a AudioClient to do text to speech the network call fails with 404. Probably related to changes in the OpenAI how endpoint URLs are generated internally.

The following code fails with 404:

            var client = new AzureOpenAIClient(new Uri("<azure endpoint>"), new System.ClientModel.ApiKeyCredential("<key>"));
            var ttsClient = client.GetAudioClient("<model deployment name>");
            var response = await ttsClient.GenerateSpeechAsync("Say hi!", OpenAI.Audio.GeneratedSpeechVoice.Nova);

Expected behavior

I expect the service call to succeed.

Actual behavior

The request is sent to a bad URL and results in a 404.

Reproduction Steps

Setup a TTS model in Azure OpenAI, use the latest version of the packages and run something like this:

            var client = new AzureOpenAIClient(new Uri("<azure endpoint>"), new System.ClientModel.ApiKeyCredential("<key>"));
            var ttsClient = client.GetAudioClient("<model deployment name>");
            var response = await ttsClient.GenerateSpeechAsync("Say hi!", OpenAI.Audio.GeneratedSpeechVoice.Nova);

Environment

VS 17.10.6 dotnet 8

github-actions[bot] commented 3 weeks ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jpalvarezl @ralph-msft @trrwilson.

RogerBarret0 commented 3 weeks ago

That's correct, I'm having the same issue as well.

Seems that the AudioClient is not appending the Azure endpoint correctly, defaulting to the OpenAI V1 endpoint approach.

image

Adding more context:

Those overrides when using against the latest OpenAI beta.10 aren't overriding, as the methods in .10 were renamed from GenerateSpeechFromText to GenerateSpeech.

https://github.com/Azure/azure-sdk-for-net/blob/06d99c9bbfcc8eca7ad64174bb48d0668838a6b6/sdk/openai/Azure.AI.OpenAI/src/Custom/Audio/AzureAudioClient.Protocol.cs#L44