@Alex Mirzayanov I think the endpoint should only be https://<resource_name>.openai.azure.com
instead of the endpoint of completions. Please see this sample for an example.
string key = "YOUR_AZURE_OPENAI_KEY";
string endpoint = "https://myaccount.openai.azure.com/";
var client = new OpenAIClient(new Uri(endpoint), new AzureKeyCredential(key));
List<string> examplePrompts = new(){
"How are you today?",
"What is Azure OpenAI?",
"Why do children love dinosaurs?",
"Generate a proof of Euler's identity",
"Describe in single words only the good things that come into your mind about your mother.",
};
string deploymentName = "text-davinci-003";
foreach (string prompt in examplePrompts)
{
Console.Write($"Input: {prompt}");
CompletionsOptions completionsOptions = new CompletionsOptions();
completionsOptions.Prompts.Add(prompt);
Response<Completions> completionsResponse = client.GetCompletions(deploymentName, completionsOptions);
string completion = completionsResponse.Value.Choices[0].Text;
Console.WriteLine($"Chatbot: {completion}");
}
I hope this helps!!
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.