Closed
Description
Describe the bug
Notebooks that reference the Microsoft.SemanticKernel.Core
and Microsoft.SemanticKernel.Connectors.Ollama
nuget packages output errors when they run.
To Reproduce
Create a Polyglot Notebook with these two code blocks:
#r "nuget: Microsoft.SemanticKernel.Core, 1.34.0"
#r "nuget: Microsoft.SemanticKernel.Connectors.Ollama, 1.34.0-alpha"
using Microsoft.SemanticKernel;
using Kernel = Microsoft.SemanticKernel.Kernel;
var builder = Kernel.CreateBuilder();
#pragma warning disable SKEXP0070 // Ollama support is experimental
builder.AddOllamaChatCompletion("llama3.1:8b-instruct-q2_K", new Uri("http://localhost:11434"));
#pragma warning restore SKEXP0070 // Ollama support is experimental
var kernel = builder.Build();
Console.WriteLine("It worked!");
Console.WriteLine(kernel);
Run the code blocks. It produces this output:
Error: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
at Microsoft.SemanticKernel.OllamaKernelBuilderExtensions.AddOllamaChatCompletion(IKernelBuilder builder, String modelId, Uri endpoint, String serviceId)
at Submission#1.<<Initialize>>d__0.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, StrongBox`1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
Expected behavior
I expected it to output:
It worked!
Microsoft.SemanticKernel.Kernel
... which is what happens if you create a .NET 8 Console App with the same two nuget packages and that C# code.
Platform
- Language: [C#]
- Source: [NuGet package version 1.34.0]
- AI model: [llama3.1:8b-instruct-q2_K]
- IDE: [VS Code with Polyglot Notebooks extension]
- OS: [Windows 11]
Additional context
I have cross posted this issue with the Polyglot Notebooks team. dotnet/interactive#3823