Skip to content

[BUG] 404 when using the latest Azure.OpenAI (2.2.0-beta5) + Latest OpenAI (2.3.0) #51731

@ericstj

Description

@ericstj

Library name and version

Azure.OpenAI 2.2.0-beta5, OpenAI 2.3.0

Describe the bug

I was trying to update to the latest OpenAI library and my application stopped working.

At first I thought it was a problem with OpenAI - I tracked it down to regressing with this change openai/openai-dotnet@dff9bb5

But then I realized that the latest OpenAI would work fine if I was using an older Azure.OpenAI library. It was only when using the latest Azure.OpenAI library together with latest OpenAI library that I hit this failure.

Expected behavior

Runs to completion with success.

Actual behavior

Exception:

System.ClientModel.ClientResultException: HTTP 404 (: 404)

Resource not found
   at OpenAI.ClientPipelineExtensions.ProcessMessage(ClientPipeline pipeline, PipelineMessage message, RequestOptions options)
   at OpenAI.Chat.ChatClient.CompleteChat(BinaryContent content, RequestOptions options)
   at OpenAI.Chat.ChatClient.CompleteChat(IEnumerable`1 messages, ChatCompletionOptions options, CancellationToken cancellationToken)
   at Azure.AI.OpenAI.Chat.AzureChatClient.CompleteChat(IEnumerable`1 messages, ChatCompletionOptions options, CancellationToken cancellationToken)
   at Program.<Main>$(String[] args) in C:\scratch\OpenAIRepro\Program.cs:line 28

Reproduction Steps

Repro's using the basic sample from Azure AI foundary

using Azure;
using Azure.AI.OpenAI;
using OpenAI.Chat;

var endpoint = new Uri(Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT"));
var deploymentName = "gpt-4o-mini";
var apiKey = Environment.GetEnvironmentVariable("AZURE_OPENAI_API_KEY");

AzureOpenAIClient azureClient = new(
    endpoint,
    new AzureKeyCredential(apiKey));
var chatClient = azureClient.GetChatClient(deploymentName);

List<ChatMessage> messages = new List<ChatMessage>()
{
    new SystemChatMessage("You are a helpful assistant."),
    new UserChatMessage("I am going to Paris, what should I see?"),
};

var requestOptions = new ChatCompletionOptions()
{
    MaxOutputTokenCount = 4096,
    Temperature = 1.0f,
    TopP = 1.0f,

};

var response = chatClient.CompleteChat(messages, requestOptions);
System.Console.WriteLine(response.Value.Content[0].Text);

Project

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net9.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Azure.AI.OpenAI" Version="2.2.0-beta.5" />
    <PackageReference Include="OpenAI" Version="2.3.0" />
  </ItemGroup>

</Project>

Environment

Windows, .NET 9.0, Visual Studio

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue is related to a non-management packageOpenAIService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions