77 c_char_p ,
88 c_int ,
99 c_uint ,
10+ c_uint8 ,
1011 c_int32 ,
1112 c_uint32 ,
1213 c_float ,
1314 c_void_p ,
15+ c_size_t ,
1416 POINTER ,
1517 _Pointer , # type: ignore
1618 Structure ,
@@ -141,9 +143,9 @@ def mtmd_default_marker() -> c_char_p:
141143@ctypes_function_mtmd (
142144 "mtmd_context_params_default" ,
143145 [],
144- mtmd_context_params_p_ctypes ,
146+ mtmd_context_params ,
145147)
146- def mtmd_context_params_default () -> mtmd_context_params_p :
148+ def mtmd_context_params_default () -> mtmd_context_params :
147149 ...
148150
149151
@@ -156,14 +158,14 @@ def mtmd_context_params_default() -> mtmd_context_params_p:
156158 "mtmd_init_from_file" , [
157159 c_char_p ,
158160 llama_cpp .llama_model_p_ctypes ,
159- mtmd_context_params_p_ctypes ,
161+ mtmd_context_params ,
160162 ],
161163 mtmd_context_p_ctypes ,
162164)
163165def mtmd_init_from_file (
164166 mmproj_fname : c_char_p ,
165167 text_model : llama_cpp .llama_model_p ,
166- ctx_params : mtmd_context_params_p ,
168+ ctx_params : mtmd_context_params ,
167169 / ,
168170) -> mtmd_context_p :
169171 """
@@ -366,17 +368,15 @@ def mtmd_input_chunk_get_type(chunk: mtmd_input_chunk_p) -> c_int32:
366368 """
367369 ...
368370
369- # MTMD_API const llama_token * mtmd_input_chunk_get_tokens_text (const mtmd_input_chunk * chunk, size_t * n_tokens_output);
371+ # MTMD_API const llama_token * mtmd_input_chunk_get_tokens_text(const mtmd_input_chunk * chunk, size_t * n_tokens_output);
370372@ctypes_function_mtmd (
371- "mtmd_input_chunk_get_tokens_text" , [
372- mtmd_input_chunk_p_ctypes ,
373- POINTER (c_uint ),
374- ], c_int32 )
373+ "mtmd_input_chunk_get_tokens_text" ,
374+ [ mtmd_input_chunk_p_ctypes , POINTER ( c_size_t )] ,
375+ POINTER (llama_cpp . llama_token )
376+ )
375377def mtmd_input_chunk_get_tokens_text (
376- chunk : mtmd_input_chunk_p ,
377- n_tokens_output : c_uint ,
378- / ,
379- ) -> c_int32 :
378+ chunk : mtmd_input_chunk_p , n_tokens_output : "_Pointer[c_size_t]" , /
379+ ) -> Optional ["_Pointer[llama_cpp.llama_token]" ]:
380380 ...
381381
382382# MTMD_API const mtmd_image_tokens * mtmd_input_chunk_get_tokens_image(const mtmd_input_chunk * chunk);
@@ -609,11 +609,11 @@ def mtmd_helper_bitmap_init_from_file(ctx: mtmd_context_p, fname: c_char_p) -> m
609609# // this function is thread-safe
610610# MTMD_API mtmd_bitmap * mtmd_helper_bitmap_init_from_buf(mtmd_context * ctx, const unsigned char * buf, size_t len);
611611@ctypes_function_mtmd (
612- "mtmd_helper_bitmap_init_from_buf" , [mtmd_context_p_ctypes , c_char_p , c_uint ], mtmd_bitmap_p_ctypes )
612+ "mtmd_helper_bitmap_init_from_buf" , [mtmd_context_p_ctypes , POINTER ( c_uint8 ), c_size_t ], mtmd_bitmap_p_ctypes )
613613def mtmd_helper_bitmap_init_from_buf (
614614 ctx : mtmd_context_p ,
615- buf : c_char_p ,
616- len : c_uint ,
615+ buf : CtypesArray [ c_uint8 ] ,
616+ len : c_size_t ,
617617 / ,
618618) -> mtmd_bitmap_p :
619619 """
0 commit comments