Rename to TextGeneratives.
This commit is contained in:
parent
229fcfe6ea
commit
aaa9261ac5
|
|
@ -1,8 +1,8 @@
|
|||
using BotSharp.Abstraction.Models;
|
||||
|
||||
namespace BotSharp.Abstraction.TextCompletions;
|
||||
namespace BotSharp.Abstraction.TextGeneratives;
|
||||
|
||||
public interface ITextCompletionProvider
|
||||
public interface IChatCompletionProvider
|
||||
{
|
||||
string GetInstruction();
|
||||
List<RoleDialogModel> GetChatSamples();
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using BotSharp.Abstraction.Conversations;
|
||||
using BotSharp.Abstraction.TextCompletions;
|
||||
using BotSharp.Abstraction.TextGeneratives;
|
||||
using BotSharp.Core.Conversations;
|
||||
using BotSharp.Core.Plugins.TextCompletions.LLamaSharp;
|
||||
using BotSharp.Core.Plugins.TextGeneratives.LLamaSharp;
|
||||
using BotSharp.Core.Repository;
|
||||
using BotSharp.Core.Services;
|
||||
using EntityFrameworkCore.BootKit;
|
||||
|
|
@ -64,6 +64,6 @@ public static class BotSharpServiceCollectionExtensions
|
|||
config.Bind("LlamaSharp", settings);
|
||||
return settings;
|
||||
});
|
||||
services.AddSingleton<ITextCompletionProvider, LlamaSharpCompletionProvider>();
|
||||
services.AddSingleton<IChatCompletionProvider, ChatCompletionProvider>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using BotSharp.Abstraction.Conversations;
|
||||
using BotSharp.Abstraction.Models;
|
||||
using BotSharp.Abstraction.TextCompletions;
|
||||
using BotSharp.Abstraction.TextGeneratives;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace BotSharp.Core.Services;
|
||||
|
|
@ -21,7 +21,7 @@ public class PlatformMidware : IPlatformMidware
|
|||
public async Task GetChatCompletionsAsync(List<RoleDialogModel> conversations,
|
||||
Func<string, Task> onChunkReceived)
|
||||
{
|
||||
var handlers = _services.GetServices<ITextCompletionProvider>().ToList();
|
||||
var handlers = _services.GetServices<IChatCompletionProvider>().ToList();
|
||||
for (int i = 0; i < handlers.Count(); i++)
|
||||
{
|
||||
var handler = handlers[i];
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
using BotSharp.Abstraction.Models;
|
||||
using BotSharp.Abstraction.Plugins;
|
||||
using BotSharp.Abstraction.TextCompletions;
|
||||
using BotSharp.Abstraction.TextGeneratives;
|
||||
using LLama;
|
||||
using System.IO;
|
||||
|
||||
namespace BotSharp.Core.Plugins.TextCompletions.LLamaSharp;
|
||||
namespace BotSharp.Core.Plugins.TextGeneratives.LLamaSharp;
|
||||
|
||||
public class LlamaSharpCompletionProvider : ITextCompletionProvider, IBotSharpPlugin
|
||||
public class ChatCompletionProvider : IChatCompletionProvider, IBotSharpPlugin
|
||||
{
|
||||
private readonly IChatModel _model;
|
||||
private readonly LlamaSharpSettings _settings;
|
||||
|
||||
public LlamaSharpCompletionProvider(LlamaSharpSettings settings)
|
||||
public ChatCompletionProvider(LlamaSharpSettings settings)
|
||||
{
|
||||
_settings = settings;
|
||||
_model = new LLamaModel(new LLamaParams(model: _settings.ModelPath,
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace BotSharp.Core.Plugins.TextCompletions.LLamaSharp;
|
||||
namespace BotSharp.Core.Plugins.TextGeneratives.LLamaSharp;
|
||||
|
||||
public class LlamaSharpSettings
|
||||
{
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
using BotSharp.Abstraction.TextCompletions;
|
||||
using BotSharp.Abstraction.TextGeneratives;
|
||||
using BotSharp.Platform.AzureAi;
|
||||
using BotSharp.Plugin.AzureOpenAI.TextGeneratives;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
|
|
@ -15,7 +16,7 @@ public static class AzureAiServiceCollectionExtensions
|
|||
config.Bind("AzureAi", settings);
|
||||
return settings;
|
||||
});
|
||||
services.AddScoped<ITextCompletionProvider, ChatCompletionHandler>();
|
||||
services.AddScoped<IChatCompletionProvider, ChatCompletionProvider>();
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +1,20 @@
|
|||
using Azure;
|
||||
using Azure.AI.OpenAI;
|
||||
using BotSharp.Abstraction.Models;
|
||||
using BotSharp.Abstraction.TextCompletions;
|
||||
using BotSharp.Abstraction.TextGeneratives;
|
||||
using BotSharp.Platform.AzureAi;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BotSharp.Platform.AzureAi;
|
||||
namespace BotSharp.Plugin.AzureOpenAI.TextGeneratives;
|
||||
|
||||
public class ChatCompletionHandler : ITextCompletionProvider
|
||||
public class ChatCompletionProvider : IChatCompletionProvider
|
||||
{
|
||||
private readonly AzureAiSettings _settings;
|
||||
|
||||
public ChatCompletionHandler(AzureAiSettings settings)
|
||||
public ChatCompletionProvider(AzureAiSettings settings)
|
||||
{
|
||||
_settings = settings;
|
||||
}
|
||||
Loading…
Reference in a new issue