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.36k stars 4.79k forks source link

[BUG] CompleteChatAsync throws 'response_format value as json_schema is enabled only for api versions 2024-08-01-preview and later', but the version used is 2024-08-06 #46579

Open andersgranaker opened 2 hours ago

andersgranaker commented 2 hours ago

Library name and version

Azure.AI.OpenAI 2.0.0

Describe the bug

When calling the chat completion endpoint with ChatResponseFormat JsonSchemaFormat a 400 BadRequest error is thrown with the message: response_format value as json_schema is enabled only for api versions 2024-08-01-preview and later'

The model deployment I'm using is GPT4o 2024-08-06. The same code and endpoint works with version Azure.AI.OpenAI Beta-12 making it easy to conclude that this is a bug in the 2.0.0 version.

Expected behavior

Call the ChatCompletion endpoint with JsonSchemaFormat as ChatResponseFormat. Use a GPT4o model deployment of the latest version. Expect a 200 response formatted as the json schema specifies.

Actual behavior

Call the ChatCompletion endpoint with JsonSchemaFormat as ChatResponseFormat. Use a GPT4o model deployment of the latest version. A HTTP 400 error is thrown. The error message says to use a later version of the GPT4o deployment, but we are using the latest one available.

Reproduction Steps

Call the ChatCompletion endpoint with JsonSchemaFormat as ChatResponseFormat. Use a GPT4o model deployment of the latest version. This fails with the 2.0.0 version of your package.

Try again with version 2.0.0 beta-12 and see that it works.

Environment

dotnet 8

github-actions[bot] commented 2 hours ago

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