Język

AIJsonUtilities.CreateJsonSchema Metoda

Definicja

Tworzy schemat JSON dla określonego typu.

public static System.Text.Json.JsonElement CreateJsonSchema(Type? type, string? description = default, bool hasDefaultValue = false, object? defaultValue = default, System.Text.Json.JsonSerializerOptions? serializerOptions = default, Microsoft.Extensions.AI.AIJsonSchemaCreateOptions? inferenceOptions = default);
static member CreateJsonSchema : Type * string * bool * obj * System.Text.Json.JsonSerializerOptions * Microsoft.Extensions.AI.AIJsonSchemaCreateOptions -> System.Text.Json.JsonElement
Public Function CreateJsonSchema (type As Type, 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

Parametry

type
Type

Typ, dla którego ma być generowany schemat.

description
String

Opis parametru.

hasDefaultValue
Boolean

true jeśli parametr jest opcjonalny; w przeciwnym razie, false.

defaultValue
Object

Wartość domyślna opcjonalnego parametru, jeśli ma to zastosowanie.

serializerOptions
JsonSerializerOptions

Opcje używane do wyodrębniania schematu z określonego typu.

inferenceOptions
AIJsonSchemaCreateOptions

Opcje kontrolujące tworzenie schematu.

Zwraca

Reprezentująca JsonElement schemat.

Uwagi

Używa pamięci podręcznej zapisanej na karcie serializerOptions , aby przechowywać wynik schematu, chyba że określono delegata TransformSchemaNode .

Dotyczy