[Bug] Version 0.71.240820.1 is incompatible with the latest version of SemanticKernel, causing a type loading error.
slimktari-cegid opened this issue · 6 comments
Context / Scenario
I am developing an application where I use both the Microsoft.KernelMemory.Core and Microsoft.SemanticKernel.Connectors.AzureOpenAI libraries. Specifically, I am trying to initialize the KernelMemory using Azure OpenAI for text embedding generation via the following code snippet:
new KernelMemoryBuilder().WithAzureOpenAITextEmbeddingGeneration(new AzureOpenAIConfig());
What happened?
When I run this code, I encounter a type loading error. This seems to be caused by the fact that Microsoft.KernelMemory.Core references version 1.17.1.0 of the Microsoft.SemanticKernel.Abstractions library, while Microsoft.SemanticKernel.Connectors.AzureOpenAI references version 1.18.2.0. Due to this version mismatch, the system cannot load the type AzureOpenAITextEmbeddingGenerationService.
Importance
a fix would make my life easier
Platform, Language, Versions
-
Platform: .NET 8
-
Language: C#
-
Microsoft.KernelMemory.Core version: 0.71.240820.1
-
Microsoft.SemanticKernel.Connectors.AzureOpenAI version: 1.18.2
Relevant log output
Source: "Microsoft.KernelMemory.AI.AzureOpenAI"
TypeName: Microsoft.SemanticKernel.Connectors.OpenAI.AzureOpenAITextEmbeddingGenerationService
Message: Could not load type 'Microsoft.SemanticKernel.Connectors.OpenAI.AzureOpenAITextEmbeddingGenerationService' from assembly 'Microsoft.SemanticKernel.Connectors.OpenAI, Version=1.18.2.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3'.
System.TypeLoadException: Could not load type 'Microsoft.SemanticKernel.Connectors.OpenAI.AzureOpenAITextEmbeddingGenerationService' from assembly 'Microsoft.SemanticKernel.Connectors.OpenAI, Version=1.18.2.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3'.
at Microsoft.KernelMemory.AI.AzureOpenAI.AzureOpenAITextEmbeddingGenerator..ctor(AzureOpenAIConfig config, ITextTokenizer textTokenizer, ILoggerFactory loggerFactory, HttpClient httpClient)
at Microsoft.KernelMemory.KernelMemoryBuilderExtensions.WithAzureOpenAITextEmbeddingGeneration(IKernelMemoryBuilder builder, AzureOpenAIConfig config, ITextTokenizer textTokenizer, ILoggerFactory loggerFactory, Boolean onlyForRetrieval, HttpClient httpClient)
at TeleworkingAssistant.Infra.Agents.Memories.MemoryFactory.GetKernelMemoryBuilder()
hi @slimktari-cegid SK 1.18.2.0. should be backward compatible with 1.17.1.0. Maybe there was a breaking change?
Hi @dluc,
When I downgrade Kernel Memory, the issue does not go away.
I suspect the problem comes from the fact that the constructor of AzureOpenAITextEmbeddingGenerationService depends on AzureOpenAIClient in version 1.18.*, whereas it depends on OpenAIClient in version 1.17.*.
As a result, Kernel Memory, which references version 1.17, cannot inject AzureOpenAITextEmbeddingGenerationService.
Hi @slimktari-cegid and @dluc 😊
I've got the same issue here. I've upgraded to using Azure.AI.OpenAI version 2.0.0-beta.5, which only works with Microsoft.SemanticKernel version 1.18.0-rc or greater. This causes the Kernel Memory issue that @slimktari-cegid posted.