-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Azure.AI.OpenAI - Chat Completion - ChatCompletionsOptions.Messages is read only but shouldn't be #37195
Comments
OpenAIClient client = new OpenAIClient(new Uri(_chatGptOption.Value.Azure.EndPoint), new AzureKeyCredential(_chatGptOption.Value.Azure.ApiKey), new OpenAIClientOptions()); |
Thank you for your feedback. This has been routed to the support team for assistance. |
@ekoostikmartin As shown by @zhuxingke, while the list can't be replaced, it is not read only. Instead, you should add messages or merge list of messages into it. Hope that helps. |
Hi @ekoostikmartin. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation. |
It'd be friendlier to at least have a constructor that accepts a list of messages. As it is it's not very intuitive. Edit to expound: many people may get their starter code through the chat playground, which as of now gives sample code that looks like this: ...
Response<StreamingChatCompletions> response = await client.GetChatCompletionsStreamingAsync(
deploymentOrModelName: "MyModel",
new ChatCompletionsOptions()
{
Messages =
{
new ChatMessage(ChatRole.System, @"You are an AI assistant that helps people find information."),
new ChatMessage(ChatRole.User, @"Hello"),
new ChatMessage(ChatRole.Assistant, @"Hi there! How can I assist you today?"),
new ChatMessage(ChatRole.User, @"May I hear a joke?"),
new ChatMessage(ChatRole.Assistant, @"Sure! Here's a joke for you: What do you call a fake noodle? An impasta!"),
},
...
});
... Taking this code as a starting point, you expect to be able to do this: ...
Response<StreamingChatCompletions> response = await client.GetChatCompletionsStreamingAsync(
deploymentOrModelName: "MyModel",
new ChatCompletionsOptions()
{
Messages = BuildChatMessages(),
...
});
... If you don't want to give |
Hi @ekoostikmartin, since you haven’t asked that we |
I have an example of how to make it work here: Creating A Blazor Chat Application With Azure OpenAI
|
Library name and version
Azure.AI.OpenAI 1.0.0-beta.5
Describe the bug
When creating a new ChatCompletionsOptions() object, cannot set the Messages property except with an object initializer. This makes it impossible to create an ongoing dynamic conversation which is feeding in the system and user responses to the service dynamically.
The comment in the code even says "Gets or sets" (see below)
Expected behavior
The Messages property should not be read only, it should allow "set".
Actual behavior
The Messages property is read only
Reproduction Steps
List chatMessageList = new List();
//CS0200 Property or indexer 'ChatCompletionsOptions.Messages' cannot be assigned to -- it is read only
Environment
No response
The text was updated successfully, but these errors were encountered: