using LLama; using Microsoft.SemanticKernel; using Microsoft.SemanticKernel.Embeddings; namespace LLamaSharp.SemanticKernel.TextEmbedding; public sealed class LLamaSharpEmbeddingGeneration : ITextEmbeddingGenerationService { private readonly LLamaEmbedder _embedder; private readonly Dictionary _attributes = new(); public IReadOnlyDictionary Attributes => this._attributes; public LLamaSharpEmbeddingGeneration(LLamaEmbedder embedder) { _embedder = embedder; } /// public async Task>> GenerateEmbeddingsAsync(IList data, Kernel? kernel = null, CancellationToken cancellationToken = default) { var result = new List>(); foreach (var item in data) result.Add(await _embedder.GetEmbeddings(item, cancellationToken)); return result; } }