I am trying to use azure open AI service in dotnet core 6.0 application. getting proxy error when I call GetCompletions()
var key = "somekey";
var httpClient = GetProxyHttpclient(_configuration);
//OpenAIClient client = new OpenAIClient(new Uri("https://azopenaikk.openai.azure.com/"),new AzureKeyCredential(key));
string endpoint = "https://azopenaikait.openai.azure.com/";
var client = new OpenAIClient(new Uri(endpoint), new DefaultAzureCredential());
string deploymentName = "text-davinci-003";
string prompt = "What is Azure OpenAI?";
Console.Write($"Input: {prompt}");
Response<Completions> completionsResponse = client.GetCompletions(deploymentName, prompt);
string completion = completionsResponse.Value.Choices[0].Text;
Console.WriteLine($"Chatbot: {completion}");
I have reproduced this issue with few modifications and it worked for me
I have referred ms docs and used the below modified code which gave me result.
Code
Output