Skip to content

Commit

Permalink
small Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ananze committed Jun 22, 2023
1 parent a4b0e51 commit a9c97c7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/code/OpenAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ public OpenAI()
}


if (endpoint.EndsWith(".azure-api.net", StringComparison.Ordinal))
if (endpoint.EndsWith(".azure-api.net", StringComparison.Ordinal) || endpoint.EndsWith(".azure-api.net/", StringComparison.Ordinal))
{
AzureKeyCredentialPolicy policy = new AzureKeyCredentialPolicy(new AzureKeyCredential(apiKey), "Ocp-Apim-Subscription-Key");
options.AddPolicy(policy, Azure.Core.HttpPipelinePosition.PerRetry);

client = new OpenAIClient(new Uri(endpoint), new AzureKeyCredential("placeholder"), options);
}
else if (endpoint.EndsWith(".openai.azure.com", StringComparison.Ordinal))
else if (endpoint.EndsWith(".openai.azure.com", StringComparison.Ordinal) || endpoint.EndsWith(".openai.azure.com/", StringComparison.Ordinal))
{
client = new OpenAIClient(new Uri(endpoint), new AzureKeyCredential(apiKey));
}
Expand Down Expand Up @@ -205,7 +205,7 @@ internal string GetCompletion(string prompt, bool debug, CancellationToken cance
return output;

}
catch (Azure.RequestFailedException e)
catch (RequestFailedException e)
{
return $"{PSStyle.Instance.Foreground.BrightRed}HTTP EXCEPTION: {e.Message}";
}
Expand Down

0 comments on commit a9c97c7

Please sign in to comment.