This commit is contained in:
danijerez 2024-11-13 21:01:03 +01:00
parent e929a46bee
commit 5870bd434c
3 changed files with 23 additions and 27 deletions

View file

@ -14,11 +14,10 @@ using System.Threading.Tasks;
namespace BotSharp.Plugin.VertexAI.Providers
{
public class ChatCompletionProvider(
VertexAIConfiguration config,
ChatSettings settings,
ILogger<TextCompletionProvider> logger,
IServiceProvider services) : IChatCompletion
public class ChatCompletionProvider(VertexAIConfiguration config,
ChatSettings settings,
ILogger<TextCompletionProvider> logger,
IServiceProvider services) : IChatCompletion
{
public string Provider => "vertexai";
private readonly VertexAIConfiguration _config = config;

View file

@ -13,11 +13,10 @@ using System.Threading.Tasks;
namespace BotSharp.Plugin.VertexAI.Providers
{
public class TextCompletionProvider(
VertexAIConfiguration config,
ChatSettings settings,
ILogger<TextCompletionProvider> logger,
IServiceProvider services) : ITextCompletion
public class TextCompletionProvider(VertexAIConfiguration config,
ChatSettings settings,
ILogger<TextCompletionProvider> logger,
IServiceProvider services) : ITextCompletion
{
public string Provider => "vertexai";
private readonly VertexAIConfiguration _config = config;

View file

@ -5,26 +5,24 @@ using BotSharp.Plugin.VertexAI.Providers;
using LangChain.Providers.Google.VertexAI;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
namespace BotSharp.Plugin.VertexAI
namespace BotSharp.Plugin.VertexAI;
public class VertexAiPlugin : IBotSharpPlugin
{
public class VertexAiPlugin : IBotSharpPlugin
{
public string Id => "962ff441-2b40-4db4-b530-49efb1688a75";
public string Name => "VertexAI";
public string Description => "VertexAI Service including text generation, text to image and other AI services.";
public string IconUrl => "https://upload.wikimedia.org/wikipedia/commons/thumb/0/05/Vertex_AI_Logo.svg/480px-Vertex_AI_Logo.svg.png";
public string Id => "962ff441-2b40-4db4-b530-49efb1688a75";
public string Name => "VertexAI";
public string Description => "VertexAI Service including text generation, text to image and other AI services.";
public string IconUrl => "https://upload.wikimedia.org/wikipedia/commons/thumb/0/05/Vertex_AI_Logo.svg/480px-Vertex_AI_Logo.svg.png";
public void RegisterDI(IServiceCollection services, IConfiguration config)
public void RegisterDI(IServiceCollection services, IConfiguration config)
{
services.AddScoped(provider =>
{
services.AddScoped(provider =>
{
var settingService = provider.GetRequiredService<ISettingService>();
return settingService.Bind<VertexAIConfiguration>("VertexAI");
});
services.AddScoped<IChatCompletion, ChatCompletionProvider>();
services.AddScoped<ITextCompletion, TextCompletionProvider>();
}
var settingService = provider.GetRequiredService<ISettingService>();
return settingService.Bind<VertexAIConfiguration>("VertexAI");
});
services.AddScoped<IChatCompletion, ChatCompletionProvider>();
services.AddScoped<ITextCompletion, TextCompletionProvider>();
}
}