From 90b19bd6eee943832584f9cac0b6f9ea29cc42a4 Mon Sep 17 00:00:00 2001 From: Alex Klinkhamer Date: Mon, 1 May 2023 00:24:20 -0700 Subject: llama : let context be const when accessing const data (#1261) --- llama.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'llama.h') diff --git a/llama.h b/llama.h index 34a8f5b..9fbba76 100644 --- a/llama.h +++ b/llama.h @@ -120,13 +120,13 @@ extern "C" { int n_threads); // Returns the number of tokens in the KV cache - LLAMA_API int llama_get_kv_cache_token_count(struct llama_context * ctx); + LLAMA_API int llama_get_kv_cache_token_count(const struct llama_context * ctx); // Sets the current rng seed. LLAMA_API void llama_set_rng_seed(struct llama_context * ctx, int seed); // Returns the size in bytes of the state (rng, logits, embedding and kv_cache) - LLAMA_API size_t llama_get_state_size(struct llama_context * ctx); + LLAMA_API size_t llama_get_state_size(const struct llama_context * ctx); // Copies the state to the specified destination address. // Destination needs to have allocated enough memory. @@ -164,9 +164,9 @@ extern "C" { int n_max_tokens, bool add_bos); - LLAMA_API int llama_n_vocab(struct llama_context * ctx); - LLAMA_API int llama_n_ctx (struct llama_context * ctx); - LLAMA_API int llama_n_embd (struct llama_context * ctx); + LLAMA_API int llama_n_vocab(const struct llama_context * ctx); + LLAMA_API int llama_n_ctx (const struct llama_context * ctx); + LLAMA_API int llama_n_embd (const struct llama_context * ctx); // Token logits obtained from the last call to llama_eval() // The logits for the last token are stored in the last row @@ -180,7 +180,7 @@ extern "C" { LLAMA_API float * llama_get_embeddings(struct llama_context * ctx); // Token Id -> String. Uses the vocabulary in the provided context - LLAMA_API const char * llama_token_to_str(struct llama_context * ctx, llama_token token); + LLAMA_API const char * llama_token_to_str(const struct llama_context * ctx, llama_token token); // Special tokens LLAMA_API llama_token llama_token_bos(); -- cgit v1.2.3