using Microsoft.SemanticKernel; using Microsoft.SemanticKernel.ChatCompletion; using Microsoft.SemanticKernel.Services; using Microsoft.SemanticKernel.TextGeneration; namespace BotSharp.Plugin.SemanticKernel.UnitTests.Helpers { internal class SemanticKernelHelper : IChatCompletionService, ITextGenerationService, IAIService { private Dictionary _attributes = new(); private readonly string _excepted; public SemanticKernelHelper(string excepted) { this._excepted = excepted; } public IReadOnlyDictionary Attributes => _attributes; IReadOnlyDictionary IAIService.Attributes => throw new NotImplementedException(); public ChatHistory CreateNewChat(string? instructions = null) { return new ChatHistory(); } public Task> GetChatMessageContentsAsync(ChatHistory chatHistory, PromptExecutionSettings? executionSettings = null, Kernel? kernel = null, CancellationToken cancellationToken = default) { return Task.FromResult>(new List { new ChatMessageContent(AuthorRole.Assistant, _excepted) }); } public IAsyncEnumerable GetStreamingChatMessageContentsAsync(ChatHistory chatHistory, PromptExecutionSettings? executionSettings = null, Kernel? kernel = null, CancellationToken cancellationToken = default) { throw new NotImplementedException(); } public Task> GetTextContentsAsync(string prompt, PromptExecutionSettings? executionSettings = null, Kernel? kernel = null, CancellationToken cancellationToken = default) { return Task.FromResult>(new List { new TextContent(_excepted) }); } public IAsyncEnumerable GetStreamingTextContentsAsync(string prompt, PromptExecutionSettings? executionSettings = null, Kernel? kernel = null, CancellationToken cancellationToken = default) { throw new NotImplementedException(); } } }