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

.Net: Marshaling arguments of JsonElement type

Open SergeyMenshykh opened this issue 1 year ago • 1 comments

Consider marshaling arguments of JsonElement type to target function parameter types.

Example:

 [Fact]
 public async void MarshalArgumentsOfJsonElementTypeAsync()
 {
     // Arrange
     var element = JsonDocument.Parse("28").RootElement;

     object? actualValue = null;

     var function1 = KernelFunctionFactory.CreateFromMethod((int number) => { actualValue = number; });

     await function1.InvokeAsync(this._kernel, new() { ["number"] = element });

     Assert.NotNull(actualValue);
     Assert.Equal(28, actualValue);
 }

SergeyMenshykh avatar Apr 15 '24 17:04 SergeyMenshykh

This issue is stale because it has been open for 90 days with no activity.

github-actions[bot] avatar Jul 18 '24 01:07 github-actions[bot]

Closing as stale

markwallace-microsoft avatar Nov 25 '24 14:11 markwallace-microsoft