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

[BUG] Azure.AI.OpenAI: Incorrect permission to CompletionsOptions.Stop

Open pckennethma opened this issue 2 years ago • 1 comments

Library name and version

1.0.0-beta.2

Describe the bug

The Stop variable in CompletionsOptions is read only and cannot be changed. As a parameter to the Completetion API, it should have been specified by users.

Expected behavior

In \CompletionsOptions.cs, public IList<string> Stop { get; } should be public IList<string> Stop { get; set;}

Actual behavior

Currently, the parameter cannot be specified.

Reproduction Steps

CompletionsOptions requestOptions = new CompletionsOptions()
            {
                Prompt = { "Hello"},
                Stop = { "<STOP>"}
            };

Environment

Windows 11 and .Net 4.8 Visual Studio 2022

pckennethma avatar Feb 14 '23 09:02 pckennethma

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

jsquire avatar Feb 14 '23 14:02 jsquire

image

pckennethma avatar Feb 15 '23 03:02 pckennethma

@pckennethma It's by design. See here:

DO NOT provide settable collection properties.

Users can replace the contents of the collection by clearing the collection first and then adding the new contents. If replacing the whole collection is a common scenario, consider providing the AddRange method on the collection.

You can set the Stop property like below:

requestOptions.Stop.Add("stop");

archerzz avatar Feb 15 '23 06:02 archerzz

Thanks!

pckennethma avatar Feb 16 '23 09:02 pckennethma