
    Pi"                       d dl mZ d dlZd dlmZmZmZmZmZm	Z	m
Z
mZmZmZmZmZ d dlZd dlmZmZmZmZ d dlmZ d dlmZmZ erd dlmZ dZej                            d          ZeC ej         ej!        "                    ej!        #                    e$                              d	z  n ej                     Z% eee%          Z& ee&          Z' ed
e(          Z)e
Z* ede(          Z+e
Z, ede(          Z-e
Z. ede(          Z/e
Z0 ede(          Z1e
Z2d Z3dZ4dZ5 G d de          Z6 G d de          Z7 e'dg e          dgd            Z8 e'dg e6          dhd            Z9 e'deej:        e6ge*          did!            Z; e'd"e*gd          djd$            Z< e'd%e*ge          dkd'            Z= e'd(ee ee          ge,          dld/            Z> e'd0e,gd          dmd2            Z? e'd3g e2          dnd5            Z@ e'd6e2gd          dod8            ZA e'd9e2ge          dpd;            ZB e'd<e2ege0          dqd@            ZC e'dAe*e2 ee7           ee,          ege          drdH            ZD e'dIe0ge          dsdK            ZE e'dLe0ge          dsdM            ZF e'dNe0 ee          g eejG                            dtdR            ZH e'dSe* ee          ege,          dudV            ZI e'dWe2ge          dpdX            ZJ e'dYe*ejK        e0ejL        ejM        ee eejL                  ge          dvdf            ZNdS )w    )annotationsN)c_boolc_char_pc_intc_uint8c_uint32c_floatc_void_pc_size_tPOINTER_Pointer	Structurebyref)UnionNewTypeOptionalTYPE_CHECKING)load_shared_library"ctypes_function_for_shared_library)CtypesArraymtmdMTMD_CPP_LIBlibmtmd_context_pmtmd_bitmap_pmtmd_image_tokens_pmtmd_input_chunk_pmtmd_input_chunks_p      c                  6    e Zd ZdefdefdefdefdefdefgZdS )mtmd_context_paramsuse_gpuprint_timings	n_threads	verbosityimage_markermedia_markerN)__name__
__module____qualname__r   r   r   _fields_     f/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/llama_cpp/mtmd_cpp.pyr"   r"   K   sE        	F	&!	e	e	"	"HHHr.   r"   c                  $    e Zd ZdefdefdefgZdS )mtmd_input_texttextadd_specialparse_specialN)r)   r*   r+   r   r   r,   r-   r.   r/   r1   r1   U   s-        			&!HHHr.   r1   mtmd_default_markerreturnbytesc                     d S Nr-   r-   r.   r/   r5   r5   a       Cr.   mtmd_context_params_defaultc                     d S r9   r-   r-   r.   r/   r;   r;   f   r:   r.   mtmd_init_from_filemmproj_fname
text_modelllama_cpp.llama_model_p
ctx_paramsOptional[mtmd_context_p]c                   d S r9   r-   )r>   r?   rA   s      r/   r=   r=   m   	     Cr.   	mtmd_freectxc                   d S r9   r-   rF   s    r/   rE   rE   {   r:   r.   mtmd_support_visionboolc                   d S r9   r-   rH   s    r/   rI   rI      r:   r.   mtmd_bitmap_initnxUnion[c_uint32, int]nydataCtypesArray[c_uint8]Optional[mtmd_bitmap_p]c                   d S r9   r-   )rM   rO   rP   s      r/   rL   rL      rD   r.   mtmd_bitmap_freebitmapc                   d S r9   r-   )rU   s    r/   rT   rT      r:   r.   mtmd_input_chunks_initOptional[mtmd_input_chunks_p]c                     d S r9   r-   r-   r.   r/   rW   rW      r:   r.   mtmd_input_chunks_freechunksc                   d S r9   r-   r[   s    r/   rZ   rZ      r:   r.   mtmd_input_chunks_sizeintc                   d S r9   r-   r]   s    r/   r^   r^      r:   r.   mtmd_input_chunks_getidxUnion[c_size_t, int]Optional[mtmd_input_chunk_p]c                   d S r9   r-   )r[   rb   s     r/   ra   ra      	     Cr.   mtmd_tokenizeoutputr2   '_Pointer[mtmd_input_text]'bitmaps!CtypesArray[mtmd_bitmap_p_ctypes]	n_bitmapsc                   d S r9   r-   )rF   rh   r2   rj   rl   s        r/   rg   rg      s	    & Cr.   mtmd_input_chunk_get_n_tokenschunkc                   d S r9   r-   ro   s    r/   rn   rn      r:   r.   mtmd_input_chunk_get_typec                   d S r9   r-   rq   s    r/   rr   rr      r:   r.    mtmd_input_chunk_get_tokens_textn_tokens_output'_Pointer[c_size_t]'+Optional['_Pointer[llama_cpp.llama_token]']c                   d S r9   r-   )ro   ru   s     r/   rt   rt      rf   r.    mtmd_helper_bitmap_init_from_bufbuflengthc                   d S r9   r-   )rF   rz   r{   s      r/   ry   ry      rD   r.   mtmd_helper_get_n_tokensc                   d S r9   r-   r]   s    r/   r}   r}      r:   r.   mtmd_helper_eval_chunk_singlelctxllama_cpp.llama_context_pn_pastllama_cpp.llama_posseq_idllama_cpp.llama_seq_idn_batchUnion[c_int, int]logits_lastUnion[c_bool, bool]
new_n_past'_Pointer[llama_cpp.llama_pos]'c                   d S r9   r-   )rF   r   ro   r   r   r   r   r   s           r/   r   r      s	    2 Cr.   )r6   r7   )r6   r"   )r>   r7   r?   r@   rA   r"   r6   rB   )rF   r   )rF   r   r6   rJ   )rM   rN   rO   rN   rP   rQ   r6   rR   )rU   r   )r6   rX   )r[   r   )r[   r   r6   r_   )r[   r   rb   rc   r6   rd   )rF   r   rh   r   r2   ri   rj   rk   rl   rc   r6   r_   )ro   r   r6   r_   )ro   r   ru   rv   r6   rw   )rF   r   rz   rQ   r{   rc   r6   rR   )rF   r   r   r   ro   r   r   r   r   r   r   r   r   r   r   r   r6   r_   )O
__future__r   osctypesr   r   r   r   r   r	   r
   r   r   r   r   r   pathlibtypingr   r   r   r   llama_cpp.llama_cpp	llama_cppllama_cpp._ctypes_extensionsr   r   r   _libmtmd_base_nameenvironget_libmtmd_override_pathPathpathabspathdirname__file___libmtmd_base_path_libmtmdctypes_functionr_   r   mtmd_context_p_ctypesr   mtmd_bitmap_p_ctypesr   mtmd_image_tokens_p_ctypesr   mtmd_input_chunk_p_ctypesr   mtmd_input_chunks_p_ctypesMTMD_INPUT_CHUNK_TYPE_TEXTMTMD_INPUT_CHUNK_TYPE_IMAGEMTMD_INPUT_CHUNK_TYPE_AUDIOr"   r1   r5   r;   llama_model_p_ctypesr=   rE   rI   rL   rT   rW   rZ   r^   ra   rg   rn   rr   llama_tokenrt   ry   r}   llama_context_p_ctypes	llama_posllama_seq_idr   r-   r.   r/   <module>r      sP   " " " " " " 				                                        ( ' ' ' ' '       
         77 YoYw\W\"'//"'//(2K2K"L"LMMPUUU  ~J  ~E  ~J  ~L  ~L  13EFF44X>> )3//  -- g3S99 % W1377 $ g3S99 %         )       i    &H55   65 .4GHH   IH y-/BC 
   
 45t<<   =< &)>(?HH   IH x))* 
   
 #&:%;TBB   CB )2/IJJ   KJ ),F+GNN   ON ),F+GRR   SR * 
   
 "  $%% 

 
  
 
 03L2MxXX   YX ,/H.I5QQ   RQ & 1 12GI!"" 
   
 &GGG,,h7 
   
 +.H-I8TT   UT #(!	#$$	 
      r.   