using Azure;
using Azure.AI.OpenAI;
OpenAIClient client = new OpenAIClient(
new Uri("AZURE_OPENAI_ENDPOINT"),
new AzureKeyCredential("AZURE_OPENAI_API_KEY"));
Response<ChatCompletions> responseWithoutStream = await client.GetChatCompletionsAsync(
"AZURE_OPENAI_ENGINE",
new ChatCompletionsOptions()
{
Messages =
{
new ChatMessage(ChatRole.System, @""),
},
Temperature = (float)0.7,
MaxTokens = 800,
NucleusSamplingFactor = (float)0.95,
FrequencyPenalty = 0,
PresencePenalty = 0,
});
ChatCompletions completions = responseWithoutStream.Value;
Console.WriteLine(completions.Choices?.FirstOrDefault()?.Message.Content);
标签:AZURE,client,OPENAI,OpenAI,Azure,new,NET
From: https://www.cnblogs.com/Mirre/p/17584738.html