Description
Describe the bug
When the Semantic Kernel needs to call a method with a complex arguments, the argument is passed along as a Json representation string of that object when using the OpenAI client.
While using the Ollama client with a local mistral-small, it was a JsonElement object sometimes, but I don't have access to that for the moment.
To Reproduce
- Make a KernelFunction for the delegate
(TodoListItems values, string scope) => "success"
public record TodoListItems(string[] Items);
-
Ask an AzureOpenAI GPT4 model to call it.
-
Inspect the parameters passed to the KernelFunction (KernelFunction is internal, so i couldn't derive a class from it to troubleshoot. But via AIFunction i could see the arguments passed along.
Actual behavior
the values argument is
"{\"items\":[\"todo1\", \"todo2\"]}"
(or sometimes a JsonElement)
Expected behavior
I'm not sure if I expect it to pass the object (object[], Dictionary<string, object>, ..) or a json element/node. Since it won't always know the final object. (only the jsonschema is technically known at that point.)
But I do expect it to be consistent between KernelFunction and AIFunction: dotnet/extensions#6544
** Additional context**
This causes issues upstream as modelcontextprotocol/csharp-sdk#558, which passes the string along as a json string instead of raw json.
I suspect that a passed JsonElement would have the correct behaviour there, as a serialized JsonElement is the raw json again.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status