BotSharp/src/Infrastructure/BotSharp.Core/Infrastructures/CompletionProvider.cs

17 lines
661 B
C#
Raw Normal View History

2023-09-09 15:37:38 +00:00
using BotSharp.Abstraction.MLTasks;
namespace BotSharp.Core.Infrastructures;
public class CompletionProvider
{
2023-09-14 01:41:51 +00:00
public static IChatCompletion GetChatCompletion(IServiceProvider services)
2023-09-09 15:37:38 +00:00
{
var completions = services.GetServices<IChatCompletion>();
2023-09-14 01:41:51 +00:00
// var settings = services.GetRequiredService<ConversationSetting>();
2023-09-09 15:37:38 +00:00
// completions.FirstOrDefault(x => x.GetType().FullName.EndsWith(settings.ChatCompletion));
2023-09-14 01:41:51 +00:00
var state = services.GetRequiredService<IConversationStateService>();
var model = state.GetState("model", "gpt-3.5-turbo");
return completions.FirstOrDefault(x => x.ModelName == model);
2023-09-09 15:37:38 +00:00
}
}