2023-06-17 02:42:35 +00:00
|
|
|
using BotSharp.Abstraction.Plugins;
|
2024-01-15 19:15:18 +00:00
|
|
|
using BotSharp.Abstraction.Settings;
|
2024-06-27 17:49:51 +00:00
|
|
|
using BotSharp.Plugin.AzureOpenAI.Providers.Chat;
|
2024-07-01 02:14:02 +00:00
|
|
|
using BotSharp.Plugin.AzureOpenAI.Providers.Embedding;
|
2024-06-27 17:49:51 +00:00
|
|
|
using BotSharp.Plugin.AzureOpenAI.Providers.Image;
|
|
|
|
|
using BotSharp.Plugin.AzureOpenAI.Providers.Text;
|
2023-06-17 02:42:35 +00:00
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
|
|
|
|
|
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";
|
2024-07-10 02:17:36 +00:00
|
|
|
public string Name => "Azure OpenAI";
|
|
|
|
|
public string Description => "Azure OpenAI Service including text generation, text to image and other AI services.";
|
2023-12-26 03:16:41 +00:00
|
|
|
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)
|
|
|
|
|
{
|
2024-01-15 19:15:18 +00:00
|
|
|
services.AddScoped(provider =>
|
2023-07-28 03:12:12 +00:00
|
|
|
{
|
2024-01-15 19:15:18 +00:00
|
|
|
var settingService = provider.GetRequiredService<ISettingService>();
|
|
|
|
|
return settingService.Bind<AzureOpenAiSettings>("AzureOpenAi");
|
2023-07-28 03:12:12 +00:00
|
|
|
});
|
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>();
|
2024-07-01 02:14:02 +00:00
|
|
|
services.AddScoped<ITextEmbedding, TextEmbeddingProvider>();
|
2024-07-19 03:28:24 +00:00
|
|
|
services.AddScoped<IImageCompletion, ImageCompletionProvider>();
|
2023-06-17 02:42:35 +00:00
|
|
|
}
|
|
|
|
|
}
|