Method CreateGrammarFromStringList
- Namespace
- LMKit.TextGeneration.Sampling
- Assembly
- LM-Kit.NET.dll
CreateGrammarFromStringList(IEnumerable<string>)
Creates a Grammar instance based on a list of specified string values. This method generates a grammar definition that constrains text generation to produce one of the specified strings.
public static Grammar CreateGrammarFromStringList(IEnumerable<string> values)
Parameters
values
IEnumerable<string>An IEnumerable<T> of strings representing the possible values handled by the grammar.
Returns
- Grammar
A new Grammar instance that defines a grammar with the specified string values as possible outputs.
Exceptions
- ArgumentNullException
Thrown if the
values
collection is null or contains no elements.