semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

.Net: Adding to SerializerOptions property to Kernel

Open SergeyMenshykh opened this issue 1 year ago • 2 comments

Motivation and Context

Today, SK has several locations where serialization/deserialization takes place. In almost all of these places, it is not possible to control the serialization/deserialization process via JsonSerializerOptions, as there is no way to pass the options to these locations. This PR addresses the issue by adding a SerializerOptions property to the Kernel class, allowing it to be used to control serialization/deserialization wherever the kernel is available.

Description

  1. Adds the SerializerOptions property to the Kernel class.
  2. Obsoletes the ToolCallBehavior.ToolCallResultSerializerOptions that was originally introduced to serialize function results.

Contribution Checklist

SergeyMenshykh avatar Mar 25 '24 17:03 SergeyMenshykh

@stephentoub , we have the JsonOptionsCache cache, which is used by many SK components. I think it should be removed in favor of the Kernel.SerializerOptions property. The configuration of the cache can be moved to the kernel class and applied as the default one, and all components can be updated to use the Kernel.SerializerOptions instead. What do you think?

@eiriktsarpalis what would be your recommendations in case some SK components need a slight deviation from the default options represented by Kernel.SerializerOptions property?

SergeyMenshykh avatar Apr 02 '24 18:04 SergeyMenshykh

Is there any ETA about this PR?

MithrilMan avatar May 10 '24 12:05 MithrilMan

Closing this for now this issue will be handled via: .Net: Support of JsonSerializerSettings in SK · Issue #5867 · microsoft/semantic-kernel (github.com)

Please comment on the above issue if you need this to be prioritised.

markwallace-microsoft avatar Jun 19 '24 09:06 markwallace-microsoft