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.47k stars 4.8k forks source link

[BUG] Combining a ChatCompletionsFunctionToolDefinition with an AzureCognitiveSearchChatExtensionConfiguration breaks the API #42285

Open grankko opened 8 months ago

grankko commented 8 months ago

Library name and version

Azure..Ai.OpenAI 1.0.0-beta.13

Describe the bug

When requesting a chat completion from an Azure OpenAI service that uses both a ChatCompletionsFunctionToolDefinition and an AzureCognitiveSearchChatExtensionConfiguration the service responds with this error (which also has spelling issues):

Functions are not supported for this API version or this model version. To learn how to user use function calling with Azure OpenAI Service. Please refer to this wiki https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/function-calling?tabs=pytho

The referenced documentation says that Supported Models include gpt-4 (1106-preview) and API version 2023-12-01-preview which we are using.

The same code works if you just remove the AzureCognitiveSearchChatExtensionConfiguration from the request.

The error message from the service makes no sense.

Expected behavior

That the service responds with http 200 and a proper ChatCompletion that can utilize both a FunctionTool and the AzureSearch extension..

Actual behavior

The services responds with 400 Bad Request and this error message:

Functions are not supported for this API version or this model version. To learn how to user use function calling with Azure OpenAI Service. Please refer to this wiki https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/function-calling?tabs=pytho

Reproduction Steps

  1. Setup an Azure Search instance and a Azure OpenAI service with a GPT deployment supporting tools / function calling
  2. Configure the ChatCompletionOptions with both Azure Search config and a self-defined FunctionToolDefintion
  3. Call the Azure OpenAI API and get a 400 bad request response

Environment

Azure, Azure OpenAI, Azure Search Windows 11 dotnet 8

github-actions[bot] commented 8 months ago

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

grankko commented 8 months ago

the issue persists in the 2024-02-15-preview version of the API and the Azure.AI.OpenAI 1.0.0-beta.14 version of the SDK

grankko commented 7 months ago

the issue persist in Azure.AI.OpenAI 1.0.0-beta.15 and 2024-03-01-preview API version.

Endpoint template in use: https://{resourcename}.openai.azure.com/openai/deployments/{deployment}/chat/completions?api-version=2024-03-01-preview

redvivi commented 7 months ago

Same here using REST API.

Referencing also https://github.com/Azure/azure-sdk-for-js/issues/28611

amadas-debug commented 6 months ago

The same issue exists if using the legacy : FunctionDefinition to make a function call as well. SDK: 1.0.0-beta.16

ystvan commented 6 months ago

Same issue exist in Azure.AI.OpenAI Version="1.0.0-beta.17