using LLama; using Microsoft.SemanticKernel; using Microsoft.SemanticKernel.Embeddings; namespace LLamaSharp.SemanticKernel.TextEmbedding; public sealed class LLamaSharpEmbeddingGeneration : ITextEmbeddingGenerationService { private 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 embeddings = data.Select(text => new ReadOnlyMemory(_embedder.GetEmbeddings(text))).ToList(); return await Task.FromResult(embeddings); } }