Table of Contents

Method CreateJsonGrammarFromJsonScheme

Namespace
LMKit.TextGeneration.Sampling
Assembly
LM-Kit.NET.dll

CreateJsonGrammarFromJsonScheme(string)

Creates a new instance of the Grammar class based on a given JSON schema.

public static Grammar CreateJsonGrammarFromJsonScheme(string json)

Parameters

json string

A string containing a JSON schema. The schema defines the structure of the JSON data, including field names and their associated types.

Returns

Grammar

A new instance of the Grammar class constructed from the provided JSON schema.

Exceptions

ArgumentException

Thrown if the json string is null, empty, or not a valid JSON schema. This exception indicates that a valid JSON schema is required to create a Grammar instance.