I’m encountering an issue while using `Codeblaze.SemanticKernel.Connectors.Ollama version 1.3.1. My code is throwing a System.InvalidOperationException, indicating that the ITextEmbeddingGenerationService has not been registered.
Here is a snippet of the code that leads to the error:
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.ChatCompletion;
using Microsoft.SemanticKernel.Embeddings;
using Microsoft.SemanticKernel.Memory;
using Microsoft.SemanticKernel.Plugins.Memory;
using TransactionChecker;
using Codeblaze.SemanticKernel.Connectors.Ollama;
var config = new ConfigurationBuilder()
.AddUserSecrets<Config>()
.Build();
var builder = Kernel.CreateBuilder();
builder.Services.AddTransient<HttpClient>();
builder.Services.AddSingleton<IConfiguration>(config);
#pragma warning disable SKEXP0070
builder.AddOllamaTextEmbeddingGeneration(
modelId: "mistral",
baseUrl: "http://localhost:11434"
);
builder.AddOllamaChatCompletion(
modelId: "mistral",
baseUrl: "http://localhost:11434"
);
var kernel = builder.Build();
var embeddingGenerator = kernel.Services.GetRequiredService<ITextEmbeddingGenerationService>();
Error:
System.InvalidOperationException: 'No service for type 'Microsoft.SemanticKernel.Embeddings.ITextEmbeddingGenerationService' has been registered.'
It appears that the ITextEmbeddingGenerationService is not being properly registered within the DI container.
Hello
I’m encountering an issue while using `Codeblaze.SemanticKernel.Connectors.Ollama version 1.3.1. My code is throwing a System.InvalidOperationException, indicating that the ITextEmbeddingGenerationService has not been registered.
Here is a snippet of the code that leads to the error:
Error:
System.InvalidOperationException: 'No service for type 'Microsoft.SemanticKernel.Embeddings.ITextEmbeddingGenerationService' has been registered.'
It appears that the ITextEmbeddingGenerationService is not being properly registered within the DI container.
Here’s the list of package references included in my project:
Is there something I’m missing in the registration process, or is there a known issue with this version? Any guidance would be appreciated.