InvalidOperationException("No service for type 'System.Collections.Generic.IEnumerable1[Microsoft.SemanticKernel.KernelPlugin] has been registered.
#13223
Replies: 1 comment
-
|
You are combining Semantic Kernel functions with the
https://learn.microsoft.com/en-us/dotnet/api/microsoft.semantickernel.kernelplugin.asaifunctions Pass the existing kernel while converting the plugins: IChatClient client = kernel
.GetRequiredService<IChatCompletionService>()
.AsChatClient()
.AsBuilder()
.UseFunctionInvocation()
.Build();
var tools = kernel.Plugins
.SelectMany(plugin => plugin.AsAIFunctions(kernel))
.Cast<AITool>()
.ToList();
var settings = new ChatOptions
{
Tools = tools,
ToolMode = ChatToolMode.Auto,
};
var result = await client.GetResponseAsync(chatHistory, settings);The Semantic Kernel implementation clones each Also use only one automatic invocation layer:
Do not enable both automatic loops for the same request. Registering |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm partially transitioning a project from only Semantic Kernel to using some Micorosoft.Extensions.AI (so that I can use the evals library). In doing so, I'm running into an blocking issue.
When I run this code:
Although the correct tool call is being "queued up" in the result's Role=Assistant message, the Role=tool message that follows it has a "Contents" property with this exception message:
What am I doing wrong? Although I have no idea why it's searching for a KernelPlugin collection, I tried registering one using dependency injection but it didn't work.
Beta Was this translation helpful? Give feedback.
All reactions