
    	hv                       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 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l-m.Z. ddl/m0Z0 ddl1mZ ddgZ2 G d de          Z3 G d de          Z4 G d d          Z5 G d d          Z6 G d d          Z7 G d d          Z8dS )    )annotationsN)Mappingcast)Literal   )_legacy_response)FilePurpose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)SyncCursorPageAsyncCursorPage)AsyncPaginatormake_request_options)
FileObject)FileDeleted)r	   Files
AsyncFilesc            	          e Zd Zed3d            Zed4d            Zedddedd5dZdddedd6dZeeeedddedd7d$Z	dddedd8d&Z
dddedd9d(Z ej        d)          dddedd:d*            Zd+d,d-d;d2ZdS )<r%   returnFilesWithRawResponsec                     t          |           S a  
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
        )r)   selfs    c/var/www/html/web-builder-api.evdpl.com/venv/lib/python3.11/site-packages/openai/resources/files.pywith_raw_responsezFiles.with_raw_response$   s     $D)))    FilesWithStreamingResponsec                     t          |           S z
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/openai/openai-python#with_streaming_response
        )r1   r,   s    r.   with_streaming_responsezFiles.with_streaming_response.   s     *$///r0   Nexpires_afterextra_headersextra_query
extra_bodytimeoutfiler   purposer	   r6   *file_create_params.ExpiresAfter | NotGivenr7   Headers | Noner8   Query | Noner9   Body | Noner:   'float | httpx.Timeout | None | NotGivenr#   c               8   t          |||d          }t          t          t          t          t
          f         |          dgg          }	ddi|pi }|                     dt          |t          j	                  |	t          ||||          t                    S )	  Upload a file that can be used across various endpoints.

        Individual files can be
        up to 512 MB, and the size of all files uploaded by one organization can be up
        to 1 TB.

        The Assistants API supports files up to 2 million tokens and of specific file
        types. See the
        [Assistants Tools guide](https://platform.openai.com/docs/assistants/tools) for
        details.

        The Fine-tuning API only supports `.jsonl` files. The input also has certain
        required formats for fine-tuning
        [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or
        [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input)
        models.

        The Batch API only supports `.jsonl` files up to 200 MB in size. The input also
        has a specific required
        [format](https://platform.openai.com/docs/api-reference/batch/request-input).

        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. One of: - `assistants`: Used in the
              Assistants API - `batch`: Used in the Batch API - `fine-tune`: Used for
              fine-tuning - `vision`: Images used for vision fine-tuning - `user_data`:
              Flexible file type for any purpose - `evals`: Used for eval data sets

          expires_after: The expiration policy for a file. By default, files with `purpose=batch` expire
              after 30 days and all other files are persisted until they are manually deleted.

          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
        r;   r<   r6   r;   pathsContent-Typemultipart/form-data/filesr7   r8   r9   r:   bodyfilesoptionscast_to)r   r   r   r   strobject_postr   r   FileCreateParamsr"   r#   
r-   r;   r<   r6   r7   r8   r9   r:   rL   rM   s
             r.   createzFiles.create7   s    p  "!. 
 
 d73;#7>>xjQQQ ()>X=CVTVXzz '9'JKK(+Q[el     
 
 	
r0   rJ   file_idrP   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/rJ   rN   rO   
ValueError_getr"   r#   r-   rV   r7   r8   r9   r:   s         r.   retrievezFiles.retrieve   sm    .  	caV]aabbbyyg(+Q[el     
 
 	
r0   afterlimitorderr<   r7   r8   r9   r:   rb   str | NotGivenrc   int | NotGivenrd   !Literal['asc', 'desc'] | NotGivenSyncCursorPage[FileObject]c                   |                      dt          t                   t          ||||t	          ||||dt
          j                            t                    S a  Returns a list of files.

        Args:
          after: A cursor for use in pagination.

        `after` is an object ID that defines your place
              in the list. For instance, if you make a list request and receive 100 objects,
              ending with obj_foo, your subsequent call can include after=obj_foo in order to
              fetch the next page of the list.

          limit: A limit on the number of objects to be returned. Limit can range between 1 and
              10,000, and the default is 10,000.

          order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending
              order and `desc` for descending order.

          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
        rI   )rb   rc   rd   r<   )r7   r8   r9   r:   query)pagerN   model)_get_api_listr   r#   r"   r   r
   FileListParams	r-   rb   rc   rd   r<   r7   r8   r9   r:   s	            r.   listz
Files.list   s{    P !!
+(+'%%!&!&!&#*	  %3    % " 
 
 	
r0   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
        rY   rZ   rJ   r[   r]   _deleter"   r$   r_   s         r.   deletezFiles.delete   sm    .  	caV]aabbb||g(+Q[el      
 
 	
r0   +_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
        rY   Acceptapplication/binaryrZ   /contentrJ   r[   r]   r^   r"   r   HttpxBinaryResponseContentr_   s         r.   contentzFiles.content  s    .  	caV]aabbb!#7QM<ORQyy'g'''(+Q[el   %?  
 
 	
r0   .The `.content()` method should be used insteadc          	         |st          d|          |                     d| dt          ||||          t                    S )ry   rY   rZ   r|   rJ   r[   r]   r^   r"   rP   r_   s         r.   retrieve_contentzFiles.retrieve_content&  sp    0  	caV]aabbbyy'g'''(+Q[el     
 
 	
r0         @  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startr;   s          r.   wait_for_processingzFiles.wait_for_processingH  s     <;;	}}R  k00KK&&&==$$Dy{{U"%555"pRppUeppp   k00 r0   )r(   r)   )r(   r1   r;   r   r<   r	   r6   r=   r7   r>   r8   r?   r9   r@   r:   rA   r(   r#   rV   rP   r7   r>   r8   r?   r9   r@   r:   rA   r(   r#   )rb   re   rc   rf   rd   rg   r<   re   r7   r>   r8   r?   r9   r@   r:   rA   r(   rh   rV   rP   r7   r>   r8   r?   r9   r@   r:   rA   r(   r$   rV   rP   r7   r>   r8   r?   r9   r@   r:   rA   r(   rw   rV   rP   r7   r>   r8   r?   r9   r@   r:   rA   r(   rP   r   rP   r   r   r   r   r(   r#   __name__
__module____qualname__r   r/   r4   r   rU   r`   rq   rv   r   typing_extensions
deprecatedr   r    r0   r.   r%   r%   #   s       * * * _* 0 0 0 _0 EN )-$("&;DL
 L
 L
 L
 L
 L
h )-$("&;D
 
 
 
 
 
H !* )3<"+ )-$("&;D;
 ;
 ;
 ;
 ;
 ;
F )-$("&;D
 
 
 
 
 
N )-$("&;D 
  
  
  
  
  
D "!"RSS )-$("&;D
 
 
 
 
 TS
J  #")       r0   c            	          e Zd Zed3d            Zed4d            Zedddedd5dZdddedd6dZeeeedddedd7d$Z	dddedd8d&Z
dddedd9d(Z ej        d)          dddedd:d*            Zd+d,d-d;d2ZdS )<r&   r(   AsyncFilesWithRawResponsec                     t          |           S r+   )r   r,   s    r.   r/   zAsyncFiles.with_raw_responsea  s     )...r0   AsyncFilesWithStreamingResponsec                     t          |           S r3   )r   r,   s    r.   r4   z"AsyncFiles.with_streaming_responsek  s     /t444r0   Nr5   r;   r   r<   r	   r6   r=   r7   r>   r8   r?   r9   r@   r:   rA   r#   c               T  K   t          |||d          }t          t          t          t          t
          f         |          dgg          }	ddi|pi }|                     dt          |t          j	                   d{V |	t          ||||          t          	           d{V S )
rC   rD   r;   rE   rG   rH   rI   NrJ   rK   )r   r   r   r   rP   rQ   rR   r   r   rS   r"   r#   rT   s
             r.   rU   zAsyncFiles.createt  s      p  "!. 
 
 d73;#7>>xjQQQ ()>X=CVTVXZZ,T3E3VWWWWWWWW(+Q[el      
 
 
 
 
 
 
 
 	
r0   rJ   rV   rP   c          	        K   |st          d|          |                     d| t          ||||          t                     d{V S )rX   rY   rZ   rJ   r[   Nr\   r_   s         r.   r`   zAsyncFiles.retrieve  s      .  	caV]aabbbYYg(+Q[el     
 
 
 
 
 
 
 
 	
r0   ra   rb   re   rc   rf   rd   rg   7AsyncPaginator[FileObject, AsyncCursorPage[FileObject]]c                   |                      dt          t                   t          ||||t	          ||||dt
          j                            t                    S rj   )rn   r    r#   r"   r   r
   ro   rp   s	            r.   rq   zAsyncFiles.list  s{    P !! ,(+'%%!&!&!&#*	  %3    % " 
 
 	
r0   r$   c          	        K   |st          d|          |                     d| t          ||||          t                     d{V S )rs   rY   rZ   rJ   r[   Nrt   r_   s         r.   rv   zAsyncFiles.delete   s      .  	caV]aabbb\\g(+Q[el     " 
 
 
 
 
 
 
 
 	
r0   rw   c          	        K   |st          d|          ddi|pi }|                     d| dt          ||||          t          j                   d{V S )	ry   rY   rz   r{   rZ   r|   rJ   r[   Nr}   r_   s         r.   r   zAsyncFiles.contentA  s      .  	caV]aabbb!#7QM<ORQYY'g'''(+Q[el   %?  
 
 
 
 
 
 
 
 	
r0   r   c          	        K   |st          d|          |                     d| dt          ||||          t                     d{V S )ry   rY   rZ   r|   rJ   r[   Nr   r_   s         r.   r   zAsyncFiles.retrieve_contentc  s      0  	caV]aabbbYY'g'''(+Q[el     
 
 
 
 
 
 
 
 	
r0   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_processing  s       <;;	]]2&&&&&&&&k00++m,,,,,,,,,r********Dy{{U"%555"pRppUeppp   k00 r0   )r(   r   )r(   r   r   r   )rb   re   rc   rf   rd   rg   r<   re   r7   r>   r8   r?   r9   r@   r:   rA   r(   r   r   r   r   r   r   r   r0   r.   r&   r&   `  s       / / / _/ 5 5 5 _5 EN )-$("&;DL
 L
 L
 L
 L
 L
h )-$("&;D
 
 
 
 
 
H !* )3<"+ )-$("&;D;
 ;
 ;
 ;
 ;
 ;
F )-$("&;D
 
 
 
 
 
N )-$("&;D 
  
  
  
  
  
D "!"RSS )-$("&;D
 
 
 
 
 TS
J  #")       r0   c                      e Zd ZddZdS )r)   rM   r%   r(   Nonec                |   || _         t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        d S N)	_filesr   to_raw_response_wrapperrU   r`   rq   rv   r   r   r-   rM   s     r.   __init__zFilesWithRawResponse.__init__  s    &>L
 
 )@N
 
 %<J
 
	 '>L
 
 (?M
 
 4&  	r0   NrM   r%   r(   r   r   r   r   r   r   r0   r.   r)   r)     (        
 
 
 
 
 
r0   r)   c                      e Zd ZddZdS )r   rM   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_wrapperrU   r`   rq   rv   r   r   r   s     r.   r   z"AsyncFilesWithRawResponse.__init__  s    &DL
 
 )FN
 
 %BJ
 
	 'DL
 
 (EM
 
 :&  	r0   NrM   r&   r(   r   r   r   r0   r.   r   r     r   r0   r   c                      e Zd ZddZdS )r1   rM   r%   r(   r   c                L   || _         t          |j                  | _        t          |j                  | _        t          |j                  | _        t          |j                  | _        t          |j        t                    | _        t          |j	                  | _	        d S r   )
r   r   rU   r`   rq   rv   r   r   r   r   r   s     r.   r   z#FilesWithStreamingResponse.__init__  s    2L
 
 5N
 
 1J
 
	 3L
 
 ;M%
 

 )&  	r0   Nr   r   r   r0   r.   r1   r1     (        
 
 
 
 
 
r0   r1   c                      e Zd ZddZdS )r   rM   r&   r(   r   c                L   || _         t          |j                  | _        t          |j                  | _        t          |j                  | _        t          |j                  | _        t          |j        t                    | _        t          |j	                  | _	        d S r   )
r   r   rU   r`   rq   rv   r   r   r   r   r   s     r.   r   z(AsyncFilesWithStreamingResponse.__init__  s    8L
 
 ;N
 
 7J
 
	 9L
 
 AM*
 

 /&  	r0   Nr   r   r   r0   r.   r   r     r   r0   r   )9
__future__r   r   r   typingr   r   r   httpx r   typesr	   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"   types.file_objectr#   types.file_deletedr$   types.file_purpose__all__r%   r&   r)   r   r1   r   r   r0   r.   <module>r      s   # " " " " "                      % % % % % %        E E E E E E E E E E I I I I I I I I I I I I I I I I \ \ \ \ \ \ \ \ \ \ \ \ % % % % % % 9 9 9 9 9 9 9 9                9 8 8 8 8 8 8 8 ? ? ? ? ? ? ? ? * * * * * * , , , , , , , , , , , ,L
!z z z z zO z z zz	z z z z z! z z zz	
 
 
 
 
 
 
 
4
 
 
 
 
 
 
 
4
 
 
 
 
 
 
 
6
 
 
 
 
 
 
 
 
 
r0   