semantic-kernel
semantic-kernel copied to clipboard
Bug: OllamaSharp is not StrongName signed and won't work for (.Net Framework target SDKs)
Since the "OllamaSharp" dependency does not have a strong name, "Microsoft.SemanticKernel.Connectors.Ollama" won't load it when targetting .Net Framework SDKs.
Those strong name issues do not apply to .net core though.
Related issue:
- https://github.com/awaescher/OllamaSharp/issues/85
The following error occurs when trying to instantiate "OllamaTextEmbeddingGenerationService" in a .net 4.7.2 project.
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'OllamaSharp, Version=3.0.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
at Microsoft.SemanticKernel.Connectors.Ollama.Core.ServiceBase..ctor(String model, Uri endpoint, HttpClient httpClient, ILoggerFactory loggerFactory)
at Microsoft.SemanticKernel.Connectors.Ollama.OllamaTextEmbeddingGenerationService..ctor(String modelId, Uri endpoint, ILoggerFactory loggerFactory)
at OllamaStrongNameIssue.Program.Main(String[] args)
Steps to reproduce the behavior:
- Create a .net 4.7.2 console project
- Add the "Microsoft.SemanticKernel.Connectors.Ollama" nuget package (currently v1.20.0-alpha)
- Add the following code in the main function :
var service = new OllamaTextEmbeddingGenerationService("fake-model", new Uri("http://localhost:11434/", UriKind.Absolute));
- Run the program
Platform
- OS: Windows 11 Pro
- IDE: Visual Studio 2022 v17.11.4
- Language: C#