azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

[BUG] Azure.AI.OpenAI: Requesting 'Echo' and 'LogProbs' at the same time breaks results

Open trrwilson opened this issue 2 years ago • 3 comments

Library name and version

Azure.AI.OpenAI 1.0.0-beta.1

Describe the bug

Configuring a Completions request such that it asks for Echo (include the prompt in the response) and LogProbs at the same time induces a result payload that fails to deserialize in the generated code.

Expected behavior

Getting a Completions result with Echo == true and LogProbability != 0 should not throw an exception and the null item should either be omitted or represented as a default/empty mapping in the object model.

Actual behavior

Setting Echo = true and LogProbability = <something other than 0> on a CompletionsOptions causes an exception to be thrown when creating the Completions result.

Reproduction Steps

Run code like the following:

OpenAIClient client = GetClient();
CompletionsOptions requestOptions = new CompletionsOptions()
{
    Prompt = { "Hello world" },
    Echo = true,
    LogProbability = 1,
};
Response<Completions> response = await client.GetCompletionsAsync(
    CompletionsDeploymentId,
    requestOptions);

Environment

Windows, .NET 7 from the .NET CLI or VS2022; issue is platform-independent

trrwilson avatar Feb 07 '23 01:02 trrwilson

@jpalvarezl FYI

trrwilson avatar Feb 07 '23 01:02 trrwilson

Thank you for your feedback. Tagging and routing to the team member best able to assist.

jsquire avatar Feb 07 '23 13:02 jsquire

I believe this is related to https://github.com/Azure/autorest.csharp/issues/3084 and might be a duplicate

m-nash avatar Feb 10 '23 21:02 m-nash

You are correct! Addressing that feature request will enable us to write the spec in a way that allows to correct this bug.

For the sake of clarity: this bug stems from token_logprobs containing a null JSON value as a result of setting up the request like @trrwilson described.

jpalvarezl avatar Feb 16 '23 22:02 jpalvarezl