Share via


AIJsonUtilities.CreateParameterJsonSchema Method

Definition

Creates a JSON schema for the provided parameter metadata.

public static System.Text.Json.JsonElement CreateParameterJsonSchema (Type? type, string parameterName, string? description = default, bool hasDefaultValue = false, object? defaultValue = default, System.Text.Json.JsonSerializerOptions? serializerOptions = default, Microsoft.Extensions.AI.AIJsonSchemaCreateOptions? inferenceOptions = default);
static member CreateParameterJsonSchema : Type * string * string * bool * obj * System.Text.Json.JsonSerializerOptions * Microsoft.Extensions.AI.AIJsonSchemaCreateOptions -> System.Text.Json.JsonElement
Public Function CreateParameterJsonSchema (type As Type, parameterName As String, Optional description As String = Nothing, Optional hasDefaultValue As Boolean = false, Optional defaultValue As Object = Nothing, Optional serializerOptions As JsonSerializerOptions = Nothing, Optional inferenceOptions As AIJsonSchemaCreateOptions = Nothing) As JsonElement

Parameters

type
Type

The type of the parameter.

parameterName
String

The name of the parameter.

description
String

The description of the parameter.

hasDefaultValue
Boolean

Whether the parameter is optional.

defaultValue
Object

The default value of the optional parameter, if applicable.

serializerOptions
JsonSerializerOptions

The options used to extract the schema from the specified type.

inferenceOptions
AIJsonSchemaCreateOptions

The options controlling schema inference.

Returns

A JSON schema document encoded as a JsonElement.

Applies to