SafeLLamaGrammarHandle
Namespace: LLama.Native
A safe reference to a llama_grammar
1 |
|
Inheritance Object → CriticalFinalizerObject → SafeHandle → SafeLLamaHandleBase → SafeLLamaGrammarHandle
Implements IDisposable
Properties
IsInvalid
1 |
|
Property Value
IsClosed
1 |
|
Property Value
Methods
ReleaseHandle()
1 |
|
Returns
Create(IReadOnlyList<GrammarRule>, UInt64)
Create a new llama_grammar
1 |
|
Parameters
rules
IReadOnlyList<GrammarRule>
A list of list of elements, each inner list makes up one grammar rule
start_rule_index
UInt64
The index (in the outer list) of the start rule
Returns
Exceptions
Create(LLamaGrammarElement, UInt64, UInt64)**
Create a new llama_grammar
1 |
|
Parameters
rules
LLamaGrammarElement**
rules list, each rule is a list of rule elements (terminated by a LLamaGrammarElementType.END element)
nrules
UInt64
total number of rules
start_rule_index
UInt64
index of the start rule of the grammar
Returns
Exceptions
Clone()
Create a copy of this grammar instance
1 |
|
Returns
AcceptToken(SafeLLamaContextHandle, LLamaToken)
Accepts the sampled token into the grammar
1 |
|
Parameters
token
LLamaToken