2023-08-28 03:50:10 +00:00
|
|
|
using Azure;
|
|
|
|
|
using Azure.AI.OpenAI;
|
|
|
|
|
using BotSharp.Plugin.AzureOpenAI.Settings;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace BotSharp.Plugin.AzureOpenAI.Providers;
|
|
|
|
|
|
2023-09-09 15:37:38 +00:00
|
|
|
public class GPT4CompletionProvider : ChatCompletionProvider
|
2023-08-28 03:50:10 +00:00
|
|
|
{
|
2023-09-18 08:35:02 +00:00
|
|
|
public override string Provider => "azure-gpt-4";
|
2023-09-09 15:37:38 +00:00
|
|
|
|
2023-08-28 03:50:10 +00:00
|
|
|
public GPT4CompletionProvider(AzureOpenAiSettings settings,
|
|
|
|
|
ILogger<GPT4CompletionProvider> logger,
|
2023-09-09 15:37:38 +00:00
|
|
|
IServiceProvider services) : base(settings, logger, services)
|
2023-08-28 03:50:10 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-09 15:37:38 +00:00
|
|
|
protected override (OpenAIClient, string) GetClient()
|
2023-08-28 03:50:10 +00:00
|
|
|
{
|
|
|
|
|
var client = new OpenAIClient(new Uri(_settings.GPT4.Endpoint), new AzureKeyCredential(_settings.GPT4.ApiKey));
|
2023-09-09 15:37:38 +00:00
|
|
|
return (client, _settings.GPT4.DeploymentModel);
|
2023-08-28 03:50:10 +00:00
|
|
|
}
|
|
|
|
|
}
|