@arsule, dattatray Welcome to Microsoft Q&A Forum, Thank you for posting your query here!
I understand that you are encountering an issue with creating a ChatCompletionsOptions object and initializing the Messages property. The problem seems to be with the way you’re trying to create the ChatMessage objects.
Could you please check and let me know if the below helps ?
Response<ChatCompletions> responseWithoutStream = await client1.GetChatCompletionsAsync(
"OpenAIService-demo",
new ChatCompletionsOptions
{
Messages = new List<ChatMessage>
{
new ChatMessage(ChatRole.System, "You are an AI assistant that helps people find information based on their queries."),
new ChatMessage(ChatRole.User, "What is the capital of India?"),
new ChatMessage(ChatRole.Assistant, "The capital of India is New Delhi.")
},
Temperature = 0.5f,
MaxTokens = 800,
NucleusSamplingFactor = 0.95f,
FrequencyPenalty = 0,
PresencePenalty = 0
}
);
Hope this helps. If you have any follow-up questions, please let me know. I would be happy to help.