using System;
using System.Runtime.InteropServices;
namespace LLama.Native
{
public static partial class NativeApi
{
///
/// Create a new grammar from the given set of grammar rules
///
///
///
///
///
[DllImport(libraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe SafeLLamaGrammarHandle llama_grammar_init(LLamaGrammarElement** rules, ulong n_rules, ulong start_rule_index);
///
/// Free all memory from the given SafeLLamaGrammarHandle
///
///
[DllImport(libraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void llama_grammar_free(IntPtr grammar);
///
/// Create a copy of an existing grammar instance
///
///
///
[DllImport(libraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern SafeLLamaGrammarHandle llama_grammar_copy(SafeLLamaGrammarHandle grammar);
///
/// Apply constraints from grammar
///
///
///
///
[DllImport(libraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void llama_sample_grammar(SafeLLamaContextHandle ctx, ref LLamaTokenDataArrayNative candidates, SafeLLamaGrammarHandle grammar);
///
/// Accepts the sampled token into the grammar
///
///
///
///
[DllImport(libraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void llama_grammar_accept_token(SafeLLamaContextHandle ctx, SafeLLamaGrammarHandle grammar, LLamaToken token);
}
}