microsoft / semantic-kernel

Integrate cutting-edge LLM technology quickly and easily into your apps
https://aka.ms/semantic-kernel
MIT License
21.86k stars 3.26k forks source link

.Net: Marshaling arguments of JsonElement type #5873

Open SergeyMenshykh opened 6 months ago

SergeyMenshykh commented 6 months ago

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);
 }
github-actions[bot] commented 3 months ago

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