Table of Contents

Method CreateJsonGrammarFromTextFields

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

CreateJsonGrammarFromTextFields(IEnumerable<string>)

Creates a new instance of the Grammar class based on a collection of JSON text field names.

public static Grammar CreateJsonGrammarFromTextFields(IEnumerable<string> fields)

Parameters

fields IEnumerable<string>

A collection of strings representing the names of the JSON text fields. Each string in the collection corresponds to a field name in the JSON structure that will be used to define the Grammar.

Returns

Grammar

A new instance of the Grammar class created from the provided JSON text fields.

Exceptions

ArgumentException

Thrown if the fields collection is null or empty. This exception indicates that the method requires at least one field name to create a valid Grammar instance.