semantic-kernel
semantic-kernel copied to clipboard
Bug: AddOllamaEmbeddingGenerator
Describe the bug AddOllamaEmbeddingGenerator method is not registering service properly.
Getting the following error.
Microsoft.SemanticKernel.KernelException: Service of type 'Microsoft.Extensions.AI.IEmbeddingGenerator2[System.String,Microsoft.Extensions.AI.Embedding1[System.Double]]' not registered.
To Reproduce Works:
let private ollamaEndpoint = Uri("http://127.0.0.1:11434")
let private kernel =
Kernel.CreateBuilder()
|> _.AddOllamaTextEmbeddingGeneration("nomic-embed-text", ollamaEndpoint)
|> _.Build()
let EmbeddingGenerator =
kernel.GetRequiredService<ITextEmbeddingGenerationService>().AsEmbeddingGenerator()
Errors:
let private ollamaEndpoint = Uri("http://127.0.0.1:11434")
let private kernel =
Kernel.CreateBuilder()
|> _.AddOllamaEmbeddingGenerator("nomic-embed-text", ollamaEndpoint)
|> _.Build()
let EmbeddingGenerator =
kernel.GetRequiredService<IEmbeddingGenerator<string, Embedding<float>>>()
Expected behavior I would expect it to be registered properly and work in the same way the "AddOllamaTextEmbeddingGeneration" registration method.
Platform
- Language: F#
- Source: Nuget Packages (microsoft.semantickernel.connectors.ollama\1.53.1-alpha, microsoft.extensions.vectordata.abstractions\9.5.0, microsoft.extensions.ai\9.5.0, microsoft.semantickernel\1.53.1)
- AI model: "nomic-embed-text" using Ollama
- IDE: JetBrains Rider
- OS: Windows