@@ -956,14 +956,22 @@ def llama_token_nl(ctx: llama_context_p) -> llama_token:
956
956
def llama_tokenize (
957
957
ctx : llama_context_p ,
958
958
text : bytes ,
959
+ text_len : Union [c_int , int ],
959
960
tokens , # type: Array[llama_token]
960
961
n_max_tokens : Union [c_int , int ],
961
962
add_bos : Union [c_bool , int ],
962
963
) -> int :
963
- return _lib .llama_tokenize (ctx , text , tokens , n_max_tokens , add_bos )
964
+ return _lib .llama_tokenize (ctx , text , text_len , tokens , n_max_tokens , add_bos )
964
965
965
966
966
- _lib .llama_tokenize .argtypes = [llama_context_p , c_char_p , llama_token_p , c_int , c_bool ]
967
+ _lib .llama_tokenize .argtypes = [
968
+ llama_context_p ,
969
+ c_char_p ,
970
+ c_int ,
971
+ llama_token_p ,
972
+ c_int ,
973
+ c_bool ,
974
+ ]
967
975
_lib .llama_tokenize .restype = c_int
968
976
969
977
@@ -976,16 +984,18 @@ def llama_tokenize(
976
984
def llama_tokenize_with_model (
977
985
model : llama_model_p ,
978
986
text : bytes ,
987
+ text_len : Union [c_int , int ],
979
988
tokens , # type: Array[llama_token]
980
989
n_max_tokens : Union [c_int , int ],
981
990
add_bos : Union [c_bool , bool ],
982
991
) -> int :
983
- return _lib .llama_tokenize_with_model (model , text , tokens , n_max_tokens , add_bos )
992
+ return _lib .llama_tokenize_with_model (model , text , text_len , tokens , n_max_tokens , add_bos )
984
993
985
994
986
995
_lib .llama_tokenize_with_model .argtypes = [
987
996
llama_model_p ,
988
997
c_char_p ,
998
+ c_int ,
989
999
llama_token_p ,
990
1000
c_int ,
991
1001
c_bool ,
0 commit comments