
    7Mg                     ~    d Z ddlmZ ddlZddlmZmZ ddlmZ ddl	m
Z
mZ ddlmZ dd	lmZmZmZ  G d
 de      Zy)zACode generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.   )BaseSDK    N)modelsutils)HookContext)OptionalNullableUNSET)get_security_from_env)ListOptionalUnionc                      e Zd ZdZdeddddeej                  ej                  f   de	ej                     deej                     de	e   de	e   d	e	ej                      fd
Zdeddddeej                  ej                  f   de	ej                     deej                     de	e   de	e   d	e	ej                      fdZddeeeeeddd	de	e   de	e   deeej(                        deeej*                        dee   deej                     deej                     de	e   de	e   d	e	ej,                     fdZddeeeeeddd	de	e   de	e   deeej(                        deeej*                        dee   deej                     deej                     de	e   de	e   d	e	ej,                     fdZeddddedeej                     de	e   de	e   d	e	ej2                     f
dZeddddedeej                     de	e   de	e   d	e	ej2                     f
dZeddddedeej                     de	e   de	e   d	e	ej8                     f
dZeddddedeej                     de	e   de	e   d	e	ej8                     f
dZeddddedeej                     de	e   de	e   d	e	ej@                     f
dZ!eddddedeej                     de	e   de	e   d	e	ej@                     f
dZ"y)Filesz	Files APIN)purposeretries
server_url
timeout_msfiler   r   r   r   returnc                v   d}d}|| j                   j                  }||}t        j                  t	        j
                  |t        j                        |      | j                  dd||ddddd| j                   j                  fd	|
      }|t        k(  r2| j                   j                  t        ur| j                   j                  }d}	t        |t        j                        r|g df}	| j                  t        dg t        | j                   j                  t        j                               |ddg|	      }
t	        j"                  |
dd      r5t	        j$                  |
j&                  t(        t        j*                           S t	        j"                  |
ddgd      r7t	        j,                  |
      }t        j.                  d|
j0                  ||
      |
j2                  j5                  d      }t	        j,                  |
      }t        j.                  d|
j0                   d| d|
j0                  ||
      )}  Upload File

        Upload a file that can be used across various endpoints.

        The size of individual files can be a maximum of 512 MB. The Fine-tuning API only supports .jsonl files.

        Please contact us if you need to increase these storage limits.

        :param file: The File object (not file name) to be uploaded.  To upload a file and specify a custom file name you should format your request as such:  ```bash  file=@path/to/your/file.jsonl;filename=custom_name.jsonl  ```  Otherwise, you can just keep the original file name:  ```bash  file=@path/to/your/file.jsonl  ```
        :param purpose:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        Nr   r   POST	/v1/filesTF
user-agentapplication/jsonc                  R    t        j                   dddt        j                        S NF	multipartr   serialize_request_bodyr   +FilesAPIRoutesUploadFileMultiPartBodyParamsrequests   ]E:\wamp.anq\www\apps\calme\nutritwin\resources\nutritwin\Lib\site-packages\mistralai/files.py<lambda>zFiles.upload.<locals>.<lambda>?   %    (D(DBB)    methodpathbase_urlurl_variablesr$   request_body_requiredrequest_has_path_paramsrequest_has_query_paramsuser_agent_headeraccept_header_valuesecurityget_serialized_bodyr   429500502503504files_api_routes_upload_fileoperation_idoauth2_scopessecurity_source4XX5XXhook_ctxr$   error_status_codesretry_config200*API error occurredContent-Type$Unexpected response received (code: , type: ))sdk_configurationr   r   r"   r   get_pydantic_modelFilebuild_requestr3   r	   rE   
isinstanceRetryConfig
do_requestr   r
   Securitymatch_responseunmarshal_jsontextr   UploadFileOutstream_to_textSDKErrorstatus_codeheadersgetselfr   r   r   r   r   r,   r-   reqrE   http_reshttp_res_textcontent_typer$   s                @r%   uploadzFiles.upload   s#   . //::J!!HDD))$<

   '"&$)%)* 2++44! "' ! 
, e%%22%?00==gu001#%HIL?? ;  5**33V__!  %u~% # 
 %1CD''x@T@T7UVV5%.#>!00:M//$h&:&:M8   ''++N;,,X6oo283G3G2HQ]P^^_`  	
 	
r(   c                  K   d}d}|| j                   j                  }||}t        j                  t	        j
                  |t        j                        |      | j                  dd||ddddd| j                   j                  fd	|
      }|t        k(  r2| j                   j                  t        ur| j                   j                  }d}	t        |t        j                        r|g df}	| j                  t        dg t        | j                   j                  t        j                               |ddg|	       d{   }
t	        j"                  |
dd      r5t	        j$                  |
j&                  t(        t        j*                           S t	        j"                  |
ddgd      r?t	        j,                  |
       d{   }t        j.                  d|
j0                  ||
      |
j2                  j5                  d      }t	        j,                  |
       d{   }t        j.                  d|
j0                   d| d|
j0                  ||
      7 7 7 <w)r   Nr   r   r   TFr   r   c                  R    t        j                   dddt        j                        S r   r    r#   s   r%   r&   z$Files.upload_async.<locals>.<lambda>   r'   r(   r)   r5   r;   r<   r@   rA   rB   rF   rG   rH   rI   rJ   rK   rL   )rM   r   r   r"   r   rN   rO   build_request_asyncr3   r	   rE   rQ   rR   do_request_asyncr   r
   rT   rU   rV   rW   r   rX   stream_to_text_asyncrZ   r[   r\   r]   r^   s                @r%   upload_asynczFiles.upload_asynco   sG    . //::J!!HDD))$<

 &&'"&$)%)* 2++44! "' ' 
, e%%22%?00==gu001#%HIL.. ;  5**33V__!  %u~% / 
 
 %1CD''x@T@T7UVV5%.#>"'"<"<X"FFM//$h&:&:M8   ''++N;#88BBoo283G3G2HQ]P^^_`  	
 	
/
  G Cs8   D>IIBIIAII8IIIr   d   )	page	page_sizesample_typesourcesearchr   r   r   r   rl   rm   rn   ro   rp   c       	         0   d}
d}|	| j                   j                  }	||}
t        j                  ||||||      }| j	                  dd|
||ddddd| j                   j
                  |		      }|t        k(  r2| j                   j                  t        ur| j                   j                  }d}t        |t        j                        r|g d
f}| j                  t        dg t        | j                   j
                  t        j                              |ddg|      }t        j                  |dd      r5t        j                   |j"                  t$        t        j&                           S t        j                  |ddgd      r7t        j(                  |      }t        j*                  d|j,                  ||      |j.                  j1                  d      }t        j(                  |      }t        j*                  d|j,                   d| d|j,                  ||      a  List Files

        Returns a list of files that belong to the user's organization.

        :param page:
        :param page_size:
        :param sample_type:
        :param source:
        :param search:
        :param purpose:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        N)rl   rm   rn   ro   rp   r   GETr   FTr   r   r*   r+   r,   r-   r$   r.   r/   r0   r1   r2   r3   r   r5   files_api_routes_list_filesr<   r@   rA   rB   rF   rG   rH   rI   rJ   rK   rL   )rM   r   r   FilesAPIRoutesListFilesRequestrP   r3   r	   rE   rQ   r   rR   rS   r   r
   rT   rU   rV   rW   r   ListFilesOutrY   rZ   r[   r\   r]   r_   rl   rm   rn   ro   rp   r   r   r   r   r,   r-   r$   r`   rE   ra   rb   rc   s                     r%   listz
Files.list   s   6 //::J!!H77#
   '"'$)%)* 2++44! ! 
 e%%22%?00==gu001#%HIL?? :  5**33V__!  %u~% # 
 %1CD''x@S@S7TUU5%.#>!00:M//$h&:&:M8   ''++N;,,X6oo283G3G2HQ]P^^_`  	
 	
r(   c       	         v  K   d}
d}|	| j                   j                  }	||}
t        j                  ||||||      }| j	                  dd|
||ddddd| j                   j
                  |		      }|t        k(  r2| j                   j                  t        ur| j                   j                  }d}t        |t        j                        r|g d
f}| j                  t        dg t        | j                   j
                  t        j                              |ddg|       d{   }t        j                  |dd      r5t        j                   |j"                  t$        t        j&                           S t        j                  |ddgd      r?t        j(                  |       d{   }t        j*                  d|j,                  ||      |j.                  j1                  d      }t        j(                  |       d{   }t        j*                  d|j,                   d| d|j,                  ||      7 7 7 <wrr   )rM   r   r   rv   rg   r3   r	   rE   rQ   r   rR   rh   r   r
   rT   rU   rV   rW   r   rw   ri   rZ   r[   r\   r]   rx   s                     r%   
list_asynczFiles.list_async0  s:    6 //::J!!H77#
 &&'"'$)%)* 2++44! ' 
 e%%22%?00==gu001#%HIL.. :  5**33V__!  %u~% / 
 
 %1CD''x@S@S7TUU5%.#>"'"<"<X"FFM//$h&:&:M8   ''++N;#88BBoo283G3G2HQ]P^^_`  	
 	
/
  G Cs8   DH9H2BH9 H5!AH9:H7;8H95H97H9)r   r   r   file_idc                &   d}d}|| j                   j                  }||}t        j                  |      }| j	                  dd|||ddddd| j                   j
                  |	      }|t        k(  r2| j                   j                  t        ur| j                   j                  }d}	t        |t        j                        r|g d
f}	| j                  t        dg t        | j                   j
                  t        j                              |ddg|	      }
t        j                  |
dd      r5t        j                   |
j"                  t$        t        j&                           S t        j                  |
ddgd      r7t        j(                  |
      }t        j*                  d|
j,                  ||
      |
j.                  j1                  d      }t        j(                  |
      }t        j*                  d|
j,                   d| d|
j,                  ||
      am  Retrieve File

        Returns information about a specific file.

        :param file_id:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        Nr|   rs   /v1/files/{file_id}FTr   r   rt   r5   files_api_routes_retrieve_filer<   r@   rA   rB   rF   rG   rH   rI   rJ   rK   rL   )rM   r   r   !FilesAPIRoutesRetrieveFileRequestrP   r3   r	   rE   rQ   r   rR   rS   r   r
   rT   rU   rV   rW   r   RetrieveFileOutrY   rZ   r[   r\   r]   r_   r|   r   r   r   r,   r-   r$   r`   rE   ra   rb   rc   s                r%   retrievezFiles.retrieve  s   " //::J!!H::
   &'"'$(%)* 2++44! ! 
 e%%22%?00==gu001#%HIL?? =  5**33V__!  %u~% # 
 %1CD''x@V@V7WXX5%.#>!00:M//$h&:&:M8   ''++N;,,X6oo283G3G2HQ]P^^_`  	
 	
r(   c                l  K   d}d}|| j                   j                  }||}t        j                  |      }| j	                  dd|||ddddd| j                   j
                  |	      }|t        k(  r2| j                   j                  t        ur| j                   j                  }d}	t        |t        j                        r|g d
f}	| j                  t        dg t        | j                   j
                  t        j                              |ddg|	       d{   }
t        j                  |
dd      r5t        j                   |
j"                  t$        t        j&                           S t        j                  |
ddgd      r?t        j(                  |
       d{   }t        j*                  d|
j,                  ||
      |
j.                  j1                  d      }t        j(                  |
       d{   }t        j*                  d|
j,                   d| d|
j,                  ||
      7 7 7 <wr~   )rM   r   r   r   rg   r3   r	   rE   rQ   r   rR   rh   r   r
   rT   rU   rV   rW   r   r   ri   rZ   r[   r\   r]   r   s                r%   retrieve_asynczFiles.retrieve_async  s+    " //::J!!H::
 &&&'"'$(%)* 2++44! ' 
 e%%22%?00==gu001#%HIL.. =  5**33V__!  %u~% / 
 
 %1CD''x@V@V7WXX5%.#>"'"<"<X"FFM//$h&:&:M8   ''++N;#88BBoo283G3G2HQ]P^^_`  	
 	
/
  G C8   DH4H-BH4H0AH45H268H40H42H4c                &   d}d}|| j                   j                  }||}t        j                  |      }| j	                  dd|||ddddd| j                   j
                  |	      }|t        k(  r2| j                   j                  t        ur| j                   j                  }d}	t        |t        j                        r|g d
f}	| j                  t        dg t        | j                   j
                  t        j                              |ddg|	      }
t        j                  |
dd      r5t        j                   |
j"                  t$        t        j&                           S t        j                  |
ddgd      r7t        j(                  |
      }t        j*                  d|
j,                  ||
      |
j.                  j1                  d      }t        j(                  |
      }t        j*                  d|
j,                   d| d|
j,                  ||
      aO  Delete File

        Delete a file.

        :param file_id:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        Nr   DELETEr   FTr   r   rt   r5   files_api_routes_delete_filer<   r@   rA   rB   rF   rG   rH   rI   rJ   rK   rL   )rM   r   r   FilesAPIRoutesDeleteFileRequestrP   r3   r	   rE   rQ   r   rR   rS   r   r
   rT   rU   rV   rW   r   DeleteFileOutrY   rZ   r[   r\   r]   r   s                r%   deletezFiles.delete5  s   " //::J!!H88
   &'"'$(%)* 2++44! ! 
 e%%22%?00==gu001#%HIL?? ;  5**33V__!  %u~% # 
 %1CD''x@T@T7UVV5%.#>!00:M//$h&:&:M8   ''++N;,,X6oo283G3G2HQ]P^^_`  	
 	
r(   c                l  K   d}d}|| j                   j                  }||}t        j                  |      }| j	                  dd|||ddddd| j                   j
                  |	      }|t        k(  r2| j                   j                  t        ur| j                   j                  }d}	t        |t        j                        r|g d
f}	| j                  t        dg t        | j                   j
                  t        j                              |ddg|	       d{   }
t        j                  |
dd      r5t        j                   |
j"                  t$        t        j&                           S t        j                  |
ddgd      r?t        j(                  |
       d{   }t        j*                  d|
j,                  ||
      |
j.                  j1                  d      }t        j(                  |
       d{   }t        j*                  d|
j,                   d| d|
j,                  ||
      7 7 7 <wr   )rM   r   r   r   rg   r3   r	   rE   rQ   r   rR   rh   r   r
   rT   rU   rV   rW   r   r   ri   rZ   r[   r\   r]   r   s                r%   delete_asynczFiles.delete_async  s+    " //::J!!H88
 &&&'"'$(%)* 2++44! ' 
 e%%22%?00==gu001#%HIL.. ;  5**33V__!  %u~% / 
 
 %1CD''x@T@T7UVV5%.#>"'"<"<X"FFM//$h&:&:M8   ''++N;#88BBoo283G3G2HQ]P^^_`  	
 	
/
  G Cr   c                   d}d}|| j                   j                  }||}t        j                  |      }| j	                  dd|||ddddd| j                   j
                  |	      }|t        k(  r2| j                   j                  t        ur| j                   j                  }d}	t        |t        j                        r|g d
f}	| j                  t        dg t        | j                   j
                  t        j                              |ddgd|	      }
t        j                  |
dd      r|
S t        j                  |
ddgd      r7t        j                   |
      }t        j"                  d|
j$                  ||
      |
j&                  j)                  d      }t        j                   |
      }t        j"                  d|
j$                   d| d|
j$                  ||
      aR  Download File

        Download a file

        :param file_id:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        Nr   rs   z/v1/files/{file_id}/contentFTr   zapplication/octet-streamrt   r5   files_api_routes_download_filer<   r@   rA   )rC   r$   rD   streamrE   rF   rG   rH   rI   rJ   rK   rL   )rM   r   r   !FilesAPIRoutesDownloadFileRequestrP   r3   r	   rE   rQ   r   rR   rS   r   r
   rT   rU   rY   rZ   r[   r\   r]   r   s                r%   downloadzFiles.download  s   " //::J!!H::
   .'"'$(%)* :++44! ! 
 e%%22%?00==gu001#%HIL?? =  5**33V__!  %u~% # 
 %1KLO5%.#>!00:M//$h&:&:M8   ''++N;,,X6oo283G3G2HQ]P^^_`  	
 	
r(   c                  K   d}d}|| j                   j                  }||}t        j                  |      }| j	                  dd|||ddddd| j                   j
                  |	      }|t        k(  r2| j                   j                  t        ur| j                   j                  }d}	t        |t        j                        r|g d
f}	| j                  t        dg t        | j                   j
                  t        j                              |ddgd|	       d{   }
t        j                  |
dd      r|
S t        j                  |
ddgd      r?t        j                   |
       d{   }t        j"                  d|
j$                  ||
      |
j&                  j)                  d      }t        j                   |
       d{   }t        j"                  d|
j$                   d| d|
j$                  ||
      7 7 7 ;wr   )rM   r   r   r   rg   r3   r	   rE   rQ   r   rR   rh   r   r
   rT   rU   ri   rZ   r[   r\   r]   r   s                r%   download_asynczFiles.download_async,  s    " //::J!!H::
 &&.'"'$(%)* :++44! ' 
 e%%22%?00==gu001#%HIL.. =  5**33V__!  %u~% / 
 
 %1KLO5%.#>"'"<"<X"FFM//$h&:&:M8   ''++N;#88BBoo283G3G2HQ]P^^_`  	
 	
1
" G Cs8   DHG;AH)G=*AHG?8H=H?H)#__name__
__module____qualname____doc__r	   r   r   rO   FileTypedDictr   FilePurposer   r   rR   strintrX   rd   rj   r   
SampleTypeSourcerw   ry   r{   r   r   r   r   r   r   httpxResponser   r    r(   r%   r   r      s^    157<$($(^
 FKK!5!556^
 &,,-	^

 "%"3"34^
 SM^
 SM^
 
&&&	'^
H 157<$($(^
 FKK!5!556^
 &,,-	^

 "%"3"34^
 SM^
 SM^
 
&&&	'^
F  #&AF8=(-8=7<$($(_
 sm_
 C=	_

 &d6+<+<&=>_
 !fmm!45_
 !%_
 "&"4"45_
 "%"3"34_
 SM_
 SM_
 
&%%	&_
H  #&AF8=(-8=7<$($(_
 sm_
 C=	_

 &d6+<+<&=>_
 !fmm!45_
 !%_
 "&"4"45_
 "%"3"34_
 SM_
 SM_
 
&%%	&_
J 8=$($(P
 P
 "%"3"34	P

 SMP
 SMP
 
&((	)P
l 8=$($(P
 P
 "%"3"34	P

 SMP
 SMP
 
&((	)P
l 8=$($(P
 P
 "%"3"34	P

 SMP
 SMP
 
&&&	'P
l 8=$($(P
 P
 "%"3"34	P

 SMP
 SMP
 
&&&	'P
l 8=$($(Q
 Q
 "%"3"34	Q

 SMQ
 SMQ
 
%..	!Q
n 8=$($(Q
 Q
 "%"3"34	Q

 SMQ
 SMQ
 
%..	!Q
r(   r   )r   basesdkr   r   	mistralair   r   mistralai._hooksr   mistralai.typesr   r	   mistralai.utilsr
   typingr   r   r   r   r   r(   r%   <module>r      s.    G   # ( 3 1 ( (q
G q
r(   