2023-06-27 18:31:13 +00:00
|
|
|
using BotSharp.Abstraction.MLTasks;
|
2023-06-17 02:42:35 +00:00
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
|
2023-06-26 23:08:24 +00:00
|
|
|
namespace BotSharp.Core.Plugins.LLamaSharp;
|
2023-06-11 23:46:02 +00:00
|
|
|
|
|
|
|
|
public class LLamaSharpPlugin : IBotSharpPlugin
|
|
|
|
|
{
|
2023-06-17 02:42:35 +00:00
|
|
|
public void RegisterDI(IServiceCollection services, IConfiguration config)
|
|
|
|
|
{
|
|
|
|
|
var llamaSharpSettings = new LlamaSharpSettings();
|
|
|
|
|
config.Bind("LlamaSharp", llamaSharpSettings);
|
|
|
|
|
services.AddSingleton(x => llamaSharpSettings);
|
2023-06-11 23:46:02 +00:00
|
|
|
|
2023-06-27 19:17:53 +00:00
|
|
|
services.AddSingleton<LlamaAiModel>();
|
|
|
|
|
services.AddScoped<ITextEmbedding, TextEmbeddingProvider>();
|
2023-06-27 23:36:50 +00:00
|
|
|
services.AddScoped<ITextCompletion, TextCompletionProvider>();
|
2023-06-27 18:31:13 +00:00
|
|
|
services.AddScoped<IChatCompletion, ChatCompletionProvider>();
|
2023-06-17 02:42:35 +00:00
|
|
|
}
|
2023-06-11 23:46:02 +00:00
|
|
|
}
|