@@ -656,6 +656,7 @@ class llama_token_data_array(ctypes.Structure):
656656# // - if not: only the last token is output
657657# // )
658658# //
659+ # // [DEPRECATED] use llama_batch_ext instead
659660# typedef struct llama_batch {
660661# int32_t n_tokens;
661662
@@ -1925,6 +1926,32 @@ def llama_model_meta_val_str_by_index(
19251926 ...
19261927
19271928
1929+ # // GGUF metadata arrays of strings
1930+ # // currently, only these keys are support:
1931+ # // - tokenizer.tts_dicts
1932+ # // - tokenizer.tts_dict.*
1933+
1934+
1935+ # // Get the number of elements, or -1 if there is no such array
1936+ # LLAMA_API int32_t llama_model_meta_arr_n(const struct llama_model * model, const char * key);
1937+ @ctypes_function (
1938+ "llama_model_meta_arr_n" , [llama_model_p_ctypes , ctypes .c_char_p ], ctypes .c_int32
1939+ )
1940+ def llama_model_meta_arr_n (model : llama_model_p , key : bytes , / ) -> int : ...
1941+
1942+
1943+ # // Get element i, owned by the model; None if not found
1944+ # LLAMA_API const char * llama_model_meta_arr_str(const struct llama_model * model, const char * key, int32_t i);
1945+ @ctypes_function (
1946+ "llama_model_meta_arr_str" ,
1947+ [llama_model_p_ctypes , ctypes .c_char_p , ctypes .c_int32 ],
1948+ ctypes .c_char_p ,
1949+ )
1950+ def llama_model_meta_arr_str (
1951+ model : llama_model_p , key : bytes , i : int , /
1952+ ) -> Optional [bytes ]: ...
1953+
1954+
19281955# // Get a string describing the model type
19291956# LLAMA_API int32_t llama_model_desc(const struct llama_model * model, char * buf, size_t buf_size);
19301957@ctypes_function (
@@ -2985,9 +3012,10 @@ def llama_state_seq_set_data_ext(
29853012# //
29863013# // NOTE: this is a helper function to facilitate transition to the new batch API - avoid using it
29873014# //
2988- # LLAMA_API struct llama_batch llama_batch_get_one(
3015+ # DEPRECATED( LLAMA_API struct llama_batch llama_batch_get_one(
29893016# llama_token * tokens,
2990- # int32_t n_tokens);
3017+ # int32_t n_tokens),
3018+ # "use llama_batch_ext_init and llama_batch_ext_add_token instead");
29913019@ctypes_function (
29923020 "llama_batch_get_one" ,
29933021 [
@@ -3015,10 +3043,11 @@ def llama_batch_get_one(
30153043# // Otherwise, llama_batch.token will be allocated to store n_tokens llama_token
30163044# // The rest of the llama_batch members are allocated with size n_tokens
30173045# // All members are left uninitialized
3018- # LLAMA_API struct llama_batch llama_batch_init(
3046+ # DEPRECATED( LLAMA_API struct llama_batch llama_batch_init(
30193047# int32_t n_tokens,
30203048# int32_t embd,
3021- # int32_t n_seq_max);
3049+ # int32_t n_seq_max),
3050+ # "use llama_batch_ext_init instead");
30223051@ctypes_function (
30233052 "llama_batch_init" , [ctypes .c_int32 , ctypes .c_int32 , ctypes .c_int32 ], llama_batch
30243053)
@@ -3039,7 +3068,8 @@ def llama_batch_init(
30393068
30403069
30413070# // Frees a batch of tokens allocated with llama_batch_init()
3042- # LLAMA_API void llama_batch_free(struct llama_batch batch);
3071+ # DEPRECATED(LLAMA_API void llama_batch_free(struct llama_batch batch),
3072+ # "use llama_batch_ext_free instead");
30433073@ctypes_function ("llama_batch_free" , [llama_batch ], None )
30443074def llama_batch_free (batch : llama_batch , / ):
30453075 """Frees a batch of tokens allocated with llama_batch_init()"""
@@ -3052,9 +3082,10 @@ def llama_batch_free(batch: llama_batch, /):
30523082# // Can store the encoder output internally for later use by the decoder's cross-attention layers.
30533083# // 0 - success
30543084# // < 0 - error. the memory state is restored to the state before this call
3055- # LLAMA_API int32_t llama_encode(
3085+ # DEPRECATED( LLAMA_API int32_t llama_encode(
30563086# struct llama_context * ctx,
3057- # struct llama_batch batch);
3087+ # struct llama_batch batch),
3088+ # "use llama_process with LLAMA_PROCESS_TYPE_ENCODE instead");
30583089@ctypes_function ("llama_encode" , [llama_context_p_ctypes , llama_batch ], ctypes .c_int32 )
30593090def llama_encode (ctx : llama_context_p , batch : llama_batch , / ) -> int :
30603091 """Process a batch of tokens.
@@ -3078,9 +3109,10 @@ def llama_encode(ctx: llama_context_p, batch: llama_batch, /) -> int:
30783109# // 2 - aborted (processed ubatches will remain in the context's memory)
30793110# // -1 - invalid input batch
30803111# // < -1 - fatal error (processed ubatches will remain in the context's memory)
3081- # LLAMA_API int32_t llama_decode(
3112+ # DEPRECATED( LLAMA_API int32_t llama_decode(
30823113# struct llama_context * ctx,
3083- # struct llama_batch batch);
3114+ # struct llama_batch batch),
3115+ # "use llama_process with LLAMA_PROCESS_TYPE_DECODE instead");
30843116@ctypes_function ("llama_decode" , [llama_context_p_ctypes , llama_batch ], ctypes .c_int32 )
30853117def llama_decode (ctx : llama_context_p , batch : llama_batch , / ) -> int :
30863118 """Process a batch of tokens.
0 commit comments