[MS] Semantic Kernel Planners: ActionPlanner - devamazonaws.blogspot.com
// Initialize a new instance of the ActionPlanner class
ActionPlanner planner = new ActionPlanner(kernelInstance);
// Use ActionPlanner to select the most appropriate function for a specific goal
Plan result = await planner.CreatePlanAsync(goal);
After running CreatePlanAsync, you can inspect the plan and then run your plan with the InvokeAsync function.
// Execute the selected function with the provided instructions and rationale
await plan.InvokeAsync();
Below is an example of a constructed Action Plan using the Klarna plugin.
{
"proposedPlan": {
"state": [
{
"Key": "INPUT",
"Value": ""
}
],
"steps": [
{
"state": [
{
"Key": "INPUT",
"Value": ""
}
],
"steps": [],
"parameters": [
{
"Key": "INPUT",
"Value": ""
}
],
"outputs": [],
"next_step_index": 0,
"name": "productsUsingGET",
"skill_name": "KlarnaShoppingSkill",
"description": ""
}
],
"parameters": [
{
"Key": "q",
"Value": "Canon Digital Camera"
},
{
"Key": "countryCode",
"Value": "US"
},
{
"Key": "INPUT",
"Value": ""
},
{
"Key": "size",
"Value": "1"
},
{
"Key": "server_url",
"Value": "https://www.klarna.com/us/shopping"
}
],
"outputs": [],
"next_step_index": 0,
"name": "",
"skill_name": "Microsoft.SemanticKernel.Planning.Plan",
"description": "Given the following context, accomplish the user intent.\nINPUT: How much is a Canon Digital Camera?\nUser Intent:User intent: How much does a Canon Digital Camera cost?"
},
"type": 0,
"state": 0
}
In conclusion, Action Planner is an essential planning object within Semantic Kernel .Net that leverages an Intent Detection pattern to efficiently select and execute a suitable function based on a specific goal. Its ability to adapt and prioritize actions intelligently makes it a powerful tool in achieving desired outcomes.
Next Steps:
Learn more about planner concept here and view an example. Join the community and let us know what you think: https://aka.ms/sk/discord
Post Updated on July 24, 2023 at 07:10PM
Thanks for reading
from devamazonaws.blogspot.com


Comments
Post a Comment