o
    ig
                     @   s   d dl mZmZmZmZmZmZmZmZ eee	 e	e
f Zeeeee
 ef eee
 eee
 f eee
 eee
 ee
e
f f f Zdee
eeee f f deee
ef  fddZdede
defdd	Zd
S )    )IODictListMappingOptionalTupleUnioncastdreturnc                 C   sL   g }|   D ]\}}t|tr|D ]	}|||f qq|||f q|S )aE  
    The format we use is a list of tuples, where the first element is the
    name of the file and the second is the file object. Typically HTTPX wants
    a dict, but to be able to send lists of files, you have to use the list
    approach (which also works for non-lists)
    https://github.com/encode/httpx/pull/1032
    )items
isinstancelistappend)r
   httpx_tupleskey	file_likefile_like_item r   V/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/cohere/core/file.py!convert_file_dict_to_httpx_tuples   s   
r   filedefault_content_typec                 C   s   t | trmt| dkrtttt tf | \}}|||fS t| dkr=tttt ttt f | \}}}|p7|}|||fS t| dkrdtttt ttt tttf f | \}}}}|p]|}||||fS t	dt|  d| |fS )z
    This function resolves to the file's content type, if provided, and defaults
    to the default_content_type value if not.
             zUnexpected tuple length: N)
r   tuplelenr	   r   r   strFileContentr   
ValueError)r   r   filenamecontentfile_content_typeout_content_typeheadersr   r   r   with_content_type.   s    

"
 
r&   N)typingr   r   r   r   r   r   r   r	   bytesr   r   Filer   r&   r   r   r   r   <module>   s*   (

