Describe the bug
Kernel function with argument of type Enum[] throws on invocation.
I am writing a kernel function that finds toys with the following signature:
public string FindToy(Color[] colors) {...}
public enum Color { Blue, Red, Green }
Then I ask in the chat question to invoke my function.
- This is the parameters schema sent to openAI sdk:
{{"type":"object","required":["colors"],"properties":{"colors":{"type":"array","items":{"enum":["Blue","Red","Green"]}}}}}
- This is the arguments in the model responses' ToolCalls:
"{"colors":["Blue","Red"]}"
- When invoking in this function SK throws this exception:
Function failed. Error: Object of type 'System.String' cannot be converted to type 'SKCopilotToolkit.Sample.SampleMockScenario.Plugins.ToysPlugin+Color[]'.
To Reproduce
Steps to reproduce the behavior:
- Register the function with the following signature to the kernel:
[KernelFunction("FindToy")] public string FindToy(Color[] colors)
- Ask the chat completion service for toys in some colors
- examine the errors in the logs
Expected behavior
The function will be called with array of Enum values [Blue, Red]
Platform
- OS: Windows
- IDE: Visual Studio,
- Language: C#
- Source: SK NuGet package version 1.5.0
Describe the bug
Kernel function with argument of type Enum[] throws on invocation.
I am writing a kernel function that finds toys with the following signature:
public string FindToy(Color[] colors) {...}
public enum Color { Blue, Red, Green }
Then I ask in the chat question to invoke my function.
{{"type":"object","required":["colors"],"properties":{"colors":{"type":"array","items":{"enum":["Blue","Red","Green"]}}}}}
"{"colors":["Blue","Red"]}"
Function failed. Error: Object of type 'System.String' cannot be converted to type 'SKCopilotToolkit.Sample.SampleMockScenario.Plugins.ToysPlugin+Color[]'.
To Reproduce
Steps to reproduce the behavior:
[KernelFunction("FindToy")] public string FindToy(Color[] colors)
Expected behavior
The function will be called with array of Enum values [Blue, Red]
Platform