#pragma once
#include "llama.cpp/include/llama.h"
#include <stdbool.h>
#include <stddef.h>
struct llama_model;
struct llama_sampler;
struct llama_vocab;
#include "wrapper_utils.h"
#ifdef __cplusplus
extern "C" {
#endif
llama_rs_status llama_rs_json_schema_to_grammar(
const char * schema_json,
bool force_gbnf,
char ** out_grammar);
struct llama_sampler * llama_rs_sampler_init_grammar(
const struct llama_vocab * vocab,
const char * grammar_str,
const char * grammar_root);
struct llama_sampler * llama_rs_sampler_init_grammar_lazy(
const struct llama_vocab * vocab,
const char * grammar_str,
const char * grammar_root,
const char ** trigger_words,
size_t num_trigger_words,
const llama_token * trigger_tokens,
size_t num_trigger_tokens);
struct llama_sampler * llama_rs_sampler_init_grammar_lazy_patterns(
const struct llama_vocab * vocab,
const char * grammar_str,
const char * grammar_root,
const char ** trigger_patterns,
size_t num_trigger_patterns,
const llama_token * trigger_tokens,
size_t num_trigger_tokens);
llama_rs_status llama_rs_sampler_accept(struct llama_sampler * sampler, llama_token token);
int llama_rs_fit_params(
const char * path_model,
struct llama_model_params * mparams,
struct llama_context_params * cparams,
float * tensor_split,
struct llama_model_tensor_buft_override * tensor_buft_overrides,
size_t * margins,
uint32_t n_ctx_min,
enum ggml_log_level log_level);
void llama_rs_memory_breakdown_print(const struct llama_context * ctx);
void llama_rs_string_free(char * ptr);
#ifdef __cplusplus
}
#endif