Planner does not call expected skills to achieve goal
See original GitHub issueHey all,
Love Semantic Kernel, it does a great job of organizing the codebase for LLM apps, and distinction/chaining of Semantic and Native skills is a charm
I’ve tried messing around with the planner to create a small lil star wars themed demo, but the planner itself does not chain or use the correct skills at all. Here is my code
My code:
using Microsoft.SemanticKernel.CoreSkills;
using Microsoft.SemanticKernel.KernelExtensions;
using Microsoft.SemanticKernel.Orchestration;
var kernel = Kernel.Builder.Build();
// For Azure Open AI service endpoint and keys please see
// https://learn.microsoft.com/azure/cognitive-services/openai/quickstart?pivots=rest-api
kernel.Config.AddAzureTextCompletionService(stuff goes here);
// import any other skills or functions ....
var planner = kernel.ImportSkill(new PlannerSkill(kernel));
var chatSkills = kernel.ImportSemanticSkillFromDirectory("Skills", "Chat");
int step = 1;
int maxSteps = 10;
var input = "";
while(true) {
Console.Write("User: ");
input = Console.ReadLine();
step = 1;
maxSteps = 4;
if (input.ToLower() == "exit")
{
break;
}
var result = await kernel.RunAsync(input, planner["CreatePlan"]);
// Pulled from: https://github.com/microsoft/semantic-kernel/blob/32e35d7c28a40d67bd27d81ddbfe028697c872a7/samples/notebooks/dotnet/5-using-the-planner.ipynb
var executionResults = result;
// Execute the plan until it is complete or we reach the maximum number of steps
while (!executionResults.Variables.ToPlan().IsComplete && step < maxSteps) {
var results = await kernel.RunAsync(executionResults.Variables, planner["ExecutePlan"]);
if (results.Variables.ToPlan().IsSuccessful)
{
Console.WriteLine($"Step {step} \n");
Console.WriteLine(results.Variables.ToPlan().PlanString);
if (results.Variables.ToPlan().IsComplete)
{
Console.WriteLine($"Step {step} - COMPLETE!");
Console.WriteLine("C-3PO: " + results.Variables.ToPlan().Result);
break;
}
}
else
{
Console.WriteLine($"Step {step} - Execution failed!");
Console.WriteLine(results.Variables.ToPlan().Result);
break;
}
executionResults = results;
step++;
}
}
Console.WriteLine("Program ended.");
I have two skills I am trying this out with:
- FindStarTrip
- YodaSpeak
From my understanding the planner leverages the function description to decide which skills to use
FindStarTrip description: “Help the user find a star trips between locations”
YodaSpeak description: “Translate a sentence from the user to Yoda-speak”
No matter what the user input is, the Planner only ever calls YodaSpeak
Whats going on here? And if I should be called a different built-in Planner skill or using the Planner in a different way could the docs be updated to reflect that?
Thanks!
Issue Analytics
- State:
- Created 5 months ago
- Comments:11 (4 by maintainers)
Top GitHub Comments
After installing the missing dependency, try running the Semantic Kernel again and see if the issues been resolved
Seems like the error is caused by a missing dependency libffi-dev.try to install libffi-dev like so
On Ubuntu/Debian/Linux Mint:
sudo apt-get install libffi-dev
On Fedora:
sudo dnf install libffi-devel
On CentOS/RHEL:
sudo yum install libffi-devel