2023-06-17 02:42:35 +00:00
|
|
|
using BotSharp.Abstraction.MLTasks;
|
|
|
|
|
using BotSharp.Abstraction.Plugins;
|
2023-06-17 13:32:39 +00:00
|
|
|
using BotSharp.Plugin.AzureOpenAI.Providers;
|
2023-06-19 18:32:49 +00:00
|
|
|
using BotSharp.Plugin.AzureOpenAI.Settings;
|
2023-06-17 02:42:35 +00:00
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2023-07-28 03:12:12 +00:00
|
|
|
using System;
|
2023-06-17 02:42:35 +00:00
|
|
|
|
|
|
|
|
namespace BotSharp.Platform.AzureAi;
|
|
|
|
|
|
2023-10-11 04:11:06 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Azure OpenAI Service
|
|
|
|
|
/// </summary>
|
2023-06-17 02:42:35 +00:00
|
|
|
public class AzureOpenAiPlugin : IBotSharpPlugin
|
|
|
|
|
{
|
2024-01-12 22:20:22 +00:00
|
|
|
public string Id => "65185362-392c-44fd-a023-95a198824436";
|
2023-10-12 11:36:36 +00:00
|
|
|
public string Name => "Azure OpenAI";
|
2023-12-26 03:16:41 +00:00
|
|
|
public string Description => "Azure OpenAI Service (ChatGPT 3.5 Turbo / 4.0)";
|
|
|
|
|
public string IconUrl => "https://nanfor.com/cdn/shop/files/cursos-propios-Azure-openAI.jpg?v=1692877741";
|
2023-10-12 11:36:36 +00:00
|
|
|
|
2023-06-17 02:42:35 +00:00
|
|
|
public void RegisterDI(IServiceCollection services, IConfiguration config)
|
|
|
|
|
{
|
|
|
|
|
var settings = new AzureOpenAiSettings();
|
|
|
|
|
config.Bind("AzureOpenAi", settings);
|
2023-07-28 03:12:12 +00:00
|
|
|
services.AddSingleton(x =>
|
|
|
|
|
{
|
2023-12-13 18:12:25 +00:00
|
|
|
Console.WriteLine($"Loaded AzureOpenAi settings");
|
2023-07-28 03:12:12 +00:00
|
|
|
return settings;
|
|
|
|
|
});
|
2023-06-17 02:42:35 +00:00
|
|
|
|
2023-07-21 01:55:40 +00:00
|
|
|
services.AddScoped<ITextCompletion, TextCompletionProvider>();
|
2023-06-19 18:32:49 +00:00
|
|
|
services.AddScoped<IChatCompletion, ChatCompletionProvider>();
|
2023-06-17 02:42:35 +00:00
|
|
|
}
|
|
|
|
|
}
|