BotSharp/src/Plugins/BotSharp.Plugin.GoogleAI/GoogleAiPlugin.cs

23 lines
743 B
C#
Raw Normal View History

2023-10-08 20:46:42 +00:00
using BotSharp.Abstraction.Plugins;
using BotSharp.Plugin.GoogleAI.Providers;
using BotSharp.Plugin.GoogleAI.Settings;
namespace BotSharp.Plugin.GoogleAI;
public class GoogleAiPlugin : IBotSharpPlugin
{
public void RegisterDI(IServiceCollection services, IConfiguration config)
{
var settings = new GoogleAiSettings();
config.Bind("GoogleAi", settings);
services.AddSingleton(x =>
{
Console.WriteLine($"Loaded Google AI settings: {settings.PaLM.Endpoint} {settings.PaLM.ApiKey.SubstringMax(4)}");
return settings;
});
services.AddScoped<IChatCompletion, ChatCompletionProvider>();
services.AddScoped<ITextCompletion, TextCompletionProvider>();
}
}