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.13k stars 4.53k forks source link

While requesting Azure OpenAI I get Validation error "Extra inputs are not permitted" #43669

Open bzashev opened 2 months ago

bzashev commented 2 months ago

Library name and version

Azure.AI.OpenAI-1.0.0-beta.16

Query/Question

I am using the library to create the request. It goes through but I get the validation error. My request is configured in the following way

 var client = new OpenAIClient(new Uri(ENDPOINT_URL), new AzureKeyCredential(KEY));
 var chatCompletionsOptions = new ChatCompletionsOptions()
{
    DeploymentName = DEPLOYMENT_NAME, 
    Temperature = (float)0.3,
    MaxTokens = 1024,
    NucleusSamplingFactor = 1,
    User = ACCOUNT_ID,
    ToolChoice = ChatCompletionsToolChoice.None,
    ChoiceCount = 1,
    Messages =
    {
        new ChatRequestSystemMessage(INSTRUCTIONS),
    }
};
  chatCompletionsOptions.Messages.Add(new ChatRequestUserMessage(question) { Name = ACCOUNT_ID });
  await foreach (StreamingChatCompletionsUpdate chatUpdate in client.GetChatCompletionsStreaming(chatCompletionsOptions))
{
    //PROCESS RESPONSE
}

This used to work without a hitch and I have not reports of model being changed

Any idea why this is happening?

github-actions[bot] commented 2 months ago

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

ericrrichards commented 2 months ago

Chiming in that I have also had problems starting yesterday (April 25 2024 ~12:00 EST) in making requests to the chat completions API through the SDK when including the optional Name parameter on ChatRequestUserMessage objects (and all the other variants)

Exception details:

Azure.RequestFailedException: Service request failed.
Status: 400 (Bad Request)

Content:
{"error": {"requestid": "1d1feecd-e686-44bb-9419-ec95212c0bad", "code": 400, "message": "Validation error at #/messages/1/name: Extra inputs are not permitted"}}

No changes to the SDK package we are using or the models that we have deployed. This is occurring across all Azure OpenAI resources that we have deployed, and a couple of different model versions (gpt-35-turbo 0301, gpt-35-turbo-16k 0613)

Had to push a rush fix to remove usage of this Name parameter in our code to construct the chat history context for our requests to the chat completions API.

bzashev commented 2 months ago

I can confirm that this was my problem as well. Thanks @ericrrichards you saved a bacon today :)