
    f je                       d dl mZ d dlZd dlZd dlmZmZ d dlmZ d dlZddl	m
Z
 ddlmZmZmZmZ ddlmZmZmZmZmZmZ dd	lmZmZmZmZ dd
lmZ ddlmZm Z  ddl!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z' ddl(m)Z)m*Z* ddl+m,Z,m-Z- ddgZ. G d de          Z/ G d de           Z0 G d d          Z1 G d d          Z2 G d d          Z3 G d d          Z4dS )    )annotationsN)Mappingcast)Literal   )_legacy_response)
FileObjectFileDeletedfile_list_paramsfile_create_params)	NOT_GIVENBodyQueryHeadersNotGiven	FileTypes)extract_filesmaybe_transformdeepcopy_minimalasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)StreamedBinaryAPIResponseAsyncStreamedBinaryAPIResponseto_streamed_response_wrapper"async_to_streamed_response_wrapper#to_custom_streamed_response_wrapper)async_to_custom_streamed_response_wrapper)SyncPage	AsyncPage)AsyncPaginatormake_request_optionsFiles
AsyncFilesc                      e Zd Zed+d            Zed,d            Zdddedd-dZdddedd.dZedddedd/dZ	dddedd0dZ
dddedd1d Z ej        d!          dddedd2d"            Zd#d$d%d3d*ZdS )4r$   returnFilesWithRawResponsec                     t          |           S N)r(   selfs    jC:\Users\Terasoftware\OneDrive\Desktop\faahhh\fyndo\fyndo\venv\Lib\site-packages\openai/resources/files.pywith_raw_responsezFiles.with_raw_response)   s    #D)))    FilesWithStreamingResponsec                     t          |           S r*   )r0   r+   s    r-   with_streaming_responsezFiles.with_streaming_response-   s    )$///r/   Nextra_headersextra_query
extra_bodytimeoutfiler   purpose"Literal['fine-tune', 'assistants']r4   Headers | Noner5   Query | Noner6   Body | Noner7   'float | httpx.Timeout | None | NotGivenr	   c               :   t          ||d          }t          t          t          t          t
          f         |          dgg          }|rddi|pi }|                     dt          |t          j	                  |t          ||||          t                    S )	  Upload a file that can be used across various endpoints.

        The size of all the
        files uploaded by one organization can be up to 100 GB.

        The size of individual files can be a maximum of 512 MB or 2 million tokens for
        Assistants. See the
        [Assistants Tools guide](https://platform.openai.com/docs/assistants/tools) to
        learn more about the types of files supported. The Fine-tuning API only supports
        `.jsonl` files.

        Please [contact us](https://help.openai.com/) if you need to increase these
        storage limits.

        Args:
          file: The File object (not file name) to be uploaded.

          purpose: The intended purpose of the uploaded file.

              Use "fine-tune" for
              [Fine-tuning](https://platform.openai.com/docs/api-reference/fine-tuning) and
              "assistants" for
              [Assistants](https://platform.openai.com/docs/api-reference/assistants) and
              [Messages](https://platform.openai.com/docs/api-reference/messages). This allows
              us to validate the format of the uploaded file is correct for fine-tuning.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        r8   r9   r8   pathsContent-Typemultipart/form-data/filesr3   bodyfilesoptionscast_to)r   r   r   r   strobject_postr   r   FileCreateParamsr#   r	   	r,   r8   r9   r4   r5   r6   r7   rH   rI   s	            r-   createzFiles.create1   s    \  " 
 
 d73;#7>>xjQQQ 	] ,-B\}GZXZ\Mzz '9'JKK(+Q[el     
 
 	
r/   file_idrL   c          	         |st          d|          |                     d| t          ||||          t                    S )^  
        Returns information about a specific file.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        6Expected a non-empty value for `file_id` but received /files/r3   rJ   rK   
ValueError_getr#   r	   r,   rR   r4   r5   r6   r7   s         r-   retrievezFiles.retrieveu   sm    .  	caV]aabbbyyg(+Q[el     
 
 	
r/   r9   r4   r5   r6   r7   str | NotGivenSyncPage[FileObject]c                   |                      dt          t                   t          ||||t	          d|it
          j                            t                    S a  
        Returns a list of files that belong to the user's organization.

        Args:
          purpose: Only return files with the given purpose.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        rF   r9   )r4   r5   r6   r7   query)pagerJ   model)_get_api_listr    r	   r#   r   r   FileListParamsr,   r9   r4   r5   r6   r7   s         r-   listz
Files.list   se    2 !!*%(+'%%y'&:<L<[\\    " 
 
 	
r/   r
   c          	         |st          d|          |                     d| t          ||||          t                    S )B  
        Delete a file.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        rU   rV   r3   rW   rY   _deleter#   r
   r[   s         r-   deletezFiles.delete   sm    .  	caV]aabbb||g(+Q[el      
 
 	
r/   +_legacy_response.HttpxBinaryResponseContentc          	         |st          d|          ddi|pi }|                     d| dt          ||||          t          j                  S )_  
        Returns the contents of the specified file.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        rU   Acceptapplication/binaryrV   /contentr3   rW   rY   rZ   r#   r   HttpxBinaryResponseContentr[   s         r-   contentzFiles.content   s    .  	caV]aabbb!#7QM<ORQyy'g'''(+Q[el   %?  
 
 	
r/   .The `.content()` method should be used insteadc          	         |st          d|          |                     d| dt          ||||          t                    S )rp   rU   rV   rs   r3   rW   rY   rZ   r#   rL   r[   s         r-   retrieve_contentzFiles.retrieve_content   sp    0  	caV]aabbbyy'g'''(+Q[el     
 
 	
r/         @  poll_intervalmax_wait_secondsidr~   floatr   c               6   h d}t          j                     }|                     |          }|j        |vrc|                     |           |                     |          }t          j                     |z
  |k    rt	          d| d| d          |j        |vc|S )EWaits for the given file to be processed, default timeout is 30 mins.>   errordeleted	processedGiving up on waiting for file  to finish processing after 	 seconds.timer\   status_sleepRuntimeErrorr,   r   r~   r   TERMINAL_STATESstartr8   s          r-   wait_for_processingzFiles.wait_for_processing!  s     <;;	}}R  k0 	KK&&&==$$Dy{{U"%55 "pRppUeppp   k0 	 r/   )r'   r(   )r'   r0   r8   r   r9   r:   r4   r;   r5   r<   r6   r=   r7   r>   r'   r	   rR   rL   r4   r;   r5   r<   r6   r=   r7   r>   r'   r	   )r9   r^   r4   r;   r5   r<   r6   r=   r7   r>   r'   r_   rR   rL   r4   r;   r5   r<   r6   r=   r7   r>   r'   r
   rR   rL   r4   r;   r5   r<   r6   r=   r7   r>   r'   rn   rR   rL   r4   r;   r5   r<   r6   r=   r7   r>   r'   rL   r   rL   r~   r   r   r   r'   r	   __name__
__module____qualname__r   r.   r2   r   rQ   r\   rh   rm   rv   typing_extensions
deprecatedrz   r    r/   r-   r$   r$   (   s       * * * _* 0 0 0 _0 )-$("&;DB
 B
 B
 B
 B
 B
T )-$("&;D
 
 
 
 
 
H #, )-$("&;D$
 $
 $
 $
 $
 $
X )-$("&;D
 
 
 
 
 
N )-$("&;D 
  
  
  
  
  
D "!"RSS )-$("&;D
 
 
 
 
 TS
J  #")       r/   c                      e Zd Zed+d            Zed,d            Zdddedd-dZdddedd.dZedddedd/dZ	dddedd0dZ
dddedd1d Z ej        d!          dddedd2d"            Zd#d$d%d3d*ZdS )4r%   r'   AsyncFilesWithRawResponsec                     t          |           S r*   )r   r+   s    r-   r.   zAsyncFiles.with_raw_response:  s    (...r/   AsyncFilesWithStreamingResponsec                     t          |           S r*   )r   r+   s    r-   r2   z"AsyncFiles.with_streaming_response>  s    .t444r/   Nr3   r8   r   r9   r:   r4   r;   r5   r<   r6   r=   r7   r>   r	   c               V  K   t          ||d          }t          t          t          t          t
          f         |          dgg          }|rddi|pi }|                     dt          |t          j	                   d{V |t          ||||          t          	           d{V S )
r@   rA   r8   rB   rD   rE   rF   Nr3   rG   )r   r   r   r   rL   rM   rN   r   r   rO   r#   r	   rP   s	            r-   rQ   zAsyncFiles.createB  s      \  " 
 
 d73;#7>>xjQQQ 	] ,-B\}GZXZ\MZZ,T3E3VWWWWWWWW(+Q[el      
 
 
 
 
 
 
 
 	
r/   rR   rL   c          	        K   |st          d|          |                     d| t          ||||          t                     d{V S )rT   rU   rV   r3   rW   NrX   r[   s         r-   r\   zAsyncFiles.retrieve  s      .  	caV]aabbbYYg(+Q[el     
 
 
 
 
 
 
 
 	
r/   r]   r^   1AsyncPaginator[FileObject, AsyncPage[FileObject]]c                   |                      dt          t                   t          ||||t	          d|it
          j                            t                    S ra   )re   r!   r	   r#   r   r   rf   rg   s         r-   rh   zAsyncFiles.list  se    2 !!:&(+'%%y'&:<L<[\\    " 
 
 	
r/   r
   c          	        K   |st          d|          |                     d| t          ||||          t                     d{V S )rj   rU   rV   r3   rW   Nrk   r[   s         r-   rm   zAsyncFiles.delete  s      .  	caV]aabbb\\g(+Q[el     " 
 
 
 
 
 
 
 
 	
r/   rn   c          	        K   |st          d|          ddi|pi }|                     d| dt          ||||          t          j                   d{V S )	rp   rU   rq   rr   rV   rs   r3   rW   Nrt   r[   s         r-   rv   zAsyncFiles.content  s      .  	caV]aabbb!#7QM<ORQYY'g'''(+Q[el   %?  
 
 
 
 
 
 
 
 	
r/   rw   c          	        K   |st          d|          |                     d| dt          ||||          t                     d{V S )rp   rU   rV   rs   r3   rW   Nry   r[   s         r-   rz   zAsyncFiles.retrieve_content  s      0  	caV]aabbbYY'g'''(+Q[el     
 
 
 
 
 
 
 
 	
r/   r{   r|   r}   r   r~   r   r   c               ^  K   h d}t          j                     }|                     |           d{V }|j        |vro|                     |           d{V  |                     |           d{V }t          j                     |z
  |k    rt	          d| d| d          |j        |vo|S )r   >   r   r   r   Nr   r   r   r   r   s          r-   r   zAsyncFiles.wait_for_processing2  s       <;;	]]2&&&&&&&&k0 	++m,,,,,,,,,r********Dy{{U"%55 "pRppUeppp   k0 	 r/   )r'   r   )r'   r   r   r   )r9   r^   r4   r;   r5   r<   r6   r=   r7   r>   r'   r   r   r   r   r   r   r   r/   r-   r%   r%   9  s       / / / _/ 5 5 5 _5 )-$("&;DB
 B
 B
 B
 B
 B
T )-$("&;D
 
 
 
 
 
H #, )-$("&;D$
 $
 $
 $
 $
 $
X )-$("&;D
 
 
 
 
 
N )-$("&;D 
  
  
  
  
  
D "!"RSS )-$("&;D
 
 
 
 
 TS
J  #")       r/   c                      e Zd ZddZdS )r(   rI   r$   r'   Nonec                |   || _         t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        d S r*   )	_filesr   to_raw_response_wrapperrQ   r\   rh   rm   rv   rz   r,   rI   s     r-   __init__zFilesWithRawResponse.__init__K  s    &>L
 
 )@N
 
 %<J
 
	 '>L
 
 (?M
 
 4&  	r/   NrI   r$   r'   r   r   r   r   r   r   r/   r-   r(   r(   J  (        
 
 
 
 
 
r/   r(   c                      e Zd ZddZdS )r   rI   r%   r'   r   c                |   || _         t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        d S r*   )	r   r   async_to_raw_response_wrapperrQ   r\   rh   rm   rv   rz   r   s     r-   r   z"AsyncFilesWithRawResponse.__init__e  s    &DL
 
 )FN
 
 %BJ
 
	 'DL
 
 (EM
 
 :&  	r/   NrI   r%   r'   r   r   r   r/   r-   r   r   d  r   r/   r   c                      e Zd ZddZdS )r0   rI   r$   r'   r   c                L   || _         t          |j                  | _        t          |j                  | _        t          |j                  | _        t          |j                  | _        t          |j        t                    | _        t          |j	                  | _	        d S r*   )
r   r   rQ   r\   rh   rm   r   rv   r   rz   r   s     r-   r   z#FilesWithStreamingResponse.__init__  s    2L
 
 5N
 
 1J
 
	 3L
 
 ;M%
 

 )&  	r/   Nr   r   r   r/   r-   r0   r0   ~  (        
 
 
 
 
 
r/   r0   c                      e Zd ZddZdS )r   rI   r%   r'   r   c                L   || _         t          |j                  | _        t          |j                  | _        t          |j                  | _        t          |j                  | _        t          |j        t                    | _        t          |j	                  | _	        d S r*   )
r   r   rQ   r\   rh   rm   r   rv   r   rz   r   s     r-   r   z(AsyncFilesWithStreamingResponse.__init__  s    8L
 
 ;N
 
 7J
 
	 9L
 
 AM*
 

 /&  	r/   Nr   r   r   r/   r-   r   r     r   r/   r   )5
__future__r   r   r   typingr   r   r   httpx r   typesr	   r
   r   r   _typesr   r   r   r   r   r   _utilsr   r   r   r   _compatr   	_resourcer   r   	_responser   r   r   r   r   r   
paginationr    r!   _base_clientr"   r#   __all__r$   r%   r(   r   r0   r   r   r/   r-   <module>r      s   # " " " " "                      % % % % % %        Q Q Q Q Q Q Q Q Q Q Q Q I I I I I I I I I I I I I I I I            & % % % % % 9 9 9 9 9 9 9 9                - , , , , , , ,       
 L
!N N N N NO N N NbN N N N N! N N Nb
 
 
 
 
 
 
 
4
 
 
 
 
 
 
 
4
 
 
 
 
 
 
 
6
 
 
 
 
 
 
 
 
 
r/   