Skip to content

CreatePlan fails with InsufficientFunctionsForGoal #3

Description

@mrochon

I am using your C# code for planner sample and getting the following exception. What am I missing?

System.AggregateException
HResult=0x80131500
Message=One or more errors occurred. ([InsufficientFunctionsForGoal] Unable to create plan for goal with available functions.
Goal: Check the weather in Guangzhou, use spanish to write emails abount dressing tips based on the results
Available Functions: CompanySearchPlugin-EmployeeSearch, CompanySearchPlugin-WeatherSearch
Planner output:
To achieve the goal of checking the weather in Guangzhou and using Spanish to write emails about dressing tips, follow these steps using the available helpers:

  1. Set the location to "Guangzhou" using the {{set}} helper:
{{set "location" "Guangzhou"}}
  1. Use the CompanySearchPlugin-WeatherSearch helper to search for the weather in the specified location:
{{set "weatherResult" (CompanySearchPlugin-WeatherSearch text=location)}}
  1. Determine the dressing tips based on the weather result using an {{#if}} statement:
{{#if (equals weatherResult "sunny")}}
  {{set "dressingTips" "Use sunscreen and wear a hat."}}
{{else if (equals weatherResult "rainy")}}
  {{set "dressingTips" "Carry an umbrella and wear waterproof shoes."}}
{{else if (equals weatherResult "cloudy")}}
  {{set "dressingTips" "Bring a light jacket, just in case."}}
{{else}}
  {{set "dressingTips" "Additional helpers may be required"}}
{{/if}}
  1. Use the {{json}} helper to output the dressing tips in Spanish:
{{json (concat "Consejos de vestuario: " dressingTips)}}

Putting it all together, the complete Handlebars template would look like this:

{{!-- Step 1: Set the location --}}
{{set "location" "Guangzhou"}}

{{!-- Step 2: Search for weather --}}
{{set "weatherResult" (CompanySearchPlugin-WeatherSearch text=location)}}

{{!-- Step 3: Determine dressing tips based on weather --}}
{{#if (equals weatherResult "sunny")}}
  {{set "dressingTips" "Use sunscreen and wear a hat."}}
{{else if (equals weatherResult "rainy")}}
  {{set "dressingTips" "Carry an umbrella and wear waterproof shoes."}}
{{else if (equals weatherResult "cloudy")}}
  {{set "dressingTips" "Bring a light jacket, just in case."}}
{{else}}
  {{set "dressingTips" "Additional helpers may be required"}}
{{/if}}

{{!-- Step 4: Output dressing tips in Spanish --}}
{{json (concat "Consejos de vestuario: " dressingTips)}}
```)
  Source=System.Private.CoreLib
  StackTrace:
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Program.<<Main>$>d__0.MoveNext() in C:\Users\mrochon\source\repos\ai-samples\SemKernel\SK1\Program.cs:line 61

  This exception was originally thrown at this call stack:
    [External Code]
    SK1.KernelExtensions.ShowPlanAsync(Microsoft.SemanticKernel.Kernel, string) in KernelExtensions.cs

Inner Exception 1:
KernelException: [InsufficientFunctionsForGoal] Unable to create plan for goal with available functions.
Goal: Check the weather in Guangzhou, use spanish to write emails abount dressing tips based on the results
Available Functions: CompanySearchPlugin-EmployeeSearch, CompanySearchPlugin-WeatherSearch
Planner output:
To achieve the goal of checking the weather in Guangzhou and using Spanish to write emails about dressing tips, follow these steps using the available helpers:

1. Set the location to "Guangzhou" using the `{{set}}` helper:
```handlebars
{{set "location" "Guangzhou"}}
  1. Use the CompanySearchPlugin-WeatherSearch helper to search for the weather in the specified location:
{{set "weatherResult" (CompanySearchPlugin-WeatherSearch text=location)}}
  1. Determine the dressing tips based on the weather result using an {{#if}} statement:
{{#if (equals weatherResult "sunny")}}
  {{set "dressingTips" "Use sunscreen and wear a hat."}}
{{else if (equals weatherResult "rainy")}}
  {{set "dressingTips" "Carry an umbrella and wear waterproof shoes."}}
{{else if (equals weatherResult "cloudy")}}
  {{set "dressingTips" "Bring a light jacket, just in case."}}
{{else}}
  {{set "dressingTips" "Additional helpers may be required"}}
{{/if}}
  1. Use the {{json}} helper to output the dressing tips in Spanish:
{{json (concat "Consejos de vestuario: " dressingTips)}}

Putting it all together, the complete Handlebars template would look like this:

{{!-- Step 1: Set the location --}}
{{set "location" "Guangzhou"}}

{{!-- Step 2: Search for weather --}}
{{set "weatherResult" (CompanySearchPlugin-WeatherSearch text=location)}}

{{!-- Step 3: Determine dressing tips based on weather --}}
{{#if (equals weatherResult "sunny")}}
  {{set "dressingTips" "Use sunscreen and wear a hat."}}
{{else if (equals weatherResult "rainy")}}
  {{set "dressingTips" "Carry an umbrella and wear waterproof shoes."}}
{{else if (equals weatherResult "cloudy")}}
  {{set "dressingTips" "Bring a light jacket, just in case."}}
{{else}}
  {{set "dressingTips" "Additional helpers may be required"}}
{{/if}}

{{!-- Step 4: Output dressing tips in Spanish --}}
{{json (concat "Consejos de vestuario: " dressingTips)}}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions