-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: Support Complex C# objects for SKFunction input parameters and output return types #2081
Comments
Idea for the auto-serialization of return values: let the user override the way the return values get Converted. e.g. allow some form of customization in SKFunction::GetParameterMarshalerDelegate Not sure how to auto-deserialize input values yet |
@shawncal - can you add the plans for this. |
Hi @efficienthacks , in this PR (#2864) we have added FunctionResult/KernelResult models which will allow to return not only strings but complex types as well. Here is usage example: semantic-kernel/dotnet/src/SemanticKernel.UnitTests/Functions/SKFunctionTests2.cs Lines 985 to 1004 in 07e792d
Could you please confirm if this implementation covers your case? |
@efficienthacks I will close this issue, since it looks like your scenario is already covered, as mentioned in previous comment, and currently exists in |
I've asked this on the public community office hours and it looks like there isn't anything in development yet for this. This issue is similar to #1195 by @stephentoub , however instead of having multiple input parameters with primitive type, I'd like to define methods that have complex objects (that are easily serialized/deserialized) as input params and return values.
Here is an example:
It would be nice to just have:
and then have the library automatically deserialize the input and serialize the output with JsonSerializer
A full working example is in a Polyglot notebook in case there is another suggestion to go about this: https://gist.github.com/efficienthacks/775bb94d727abbb7aec4b699f981dfac
My actually scenario consists of multiple of these 'native' methods, so without this feature, I'd have to create new methods, change the input/output parameters, then manually deserialize input at the start the method and serialize the output at the end of the method.
The text was updated successfully, but these errors were encountered: