Description
Describe the bug
The KernelParameterMetadata class uses init-only properties, but some of these do not have a constructor that allows setting them. When trying to create an instance of this class in .NET Framework 4.7.2 the compiler gives an error because init-only properties are not supported on C# 7.3.
The properties affected by this are:
- Description
- DefaultValue
- ParameterType
- Schema
As noted here NET Standard 2.0 and all versions of .NET Framework only support C# 7.3.
To Reproduce
Create a .NET Framework console with a reference to the Microsoft.SemanticKernal.Abstractions package and then paste in this code:
var parameter = new KernelParameterMetadata( "promptAsJson" )
{
Description = "A JSON object with the information to register for the event.",
IsRequired = true,
Schema = ParseSchema( function.InputSchema )
};
Expected behavior
A constructor should be provided to allow initializing all init-only properties.
Workaround
It seems like I can use reflection to set those properties, but that isn't an ideal long-term solution.
Platform
- Language: C#
- Source: Microsoft.SemanticKernel.Abstractions 1.54.0
- AI model: n/a
- IDE: Visual Studio 17.13.7
- OS: Windows
Additional context
n/a
Metadata
Metadata
Assignees
Type
Projects
Status