
    ~iR                       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 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" ddl#m$Z$m%Z% ddl&m'Z'm(Z( ddl)m*Z* ddl+m,Z, ddgZ- G d de          Z. G d de          Z/ G d d          Z0 G d d          Z1 G d d          Z2 G d d          Z3dS )    )annotationsN)Mappingcast)Literal   )_legacy_response)FilePurposePreprocessConfigsfile_list_paramsfile_create_params)BodyQueryHeaders	FileTypes)extract_filesmaybe_transformdeepcopy_minimalasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)SyncCursorPageAsyncCursorPage)AsyncPaginatormake_request_options)
FileObject)FileDeletedFiles
AsyncFilesc            	          e Zd Zed2d            Zed3d            Zdddddddd4dZdddddd5dZdddddddddd6d'Zdddddd7d)Z	d*d+d,d8d1Z
dS )9r    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    p/root/.openclaw/workspace/.venvs/ark-sdk/lib/python3.11/site-packages/volcenginesdkarkruntime/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
        )r+   r&   s    r(   with_streaming_responsezFiles.with_streaming_response6   s     *$///r*   N	expire_atpreprocess_configsextra_headersextra_query
extra_bodytimeoutfiler   purposer	   r/   datetime.datetime | int | Noner0   PreprocessConfigs | Noner1   Headers | Noner2   Query | Noner3   Body | Noner4   float | httpx.Timeout | Noner   c               :   t          ||||d          }	t          t          t          t          t
          f         |	          dgg          }
ddi|pi }|                     dt          |	t          j	                  |
t          ||||          t                    S )	a  Upload a file that can be used across various endpoints.

        Individual files can be up to 512 MB.

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

          purpose: The intended purpose of the uploaded file. Only `user_data` is supported.

          expire_at: The expiration time for a file in Unix timestamp format. By default, files expires after 7 days.

          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
        r5   r6   r/   r0   r5   pathsContent-Typemultipart/form-data/filesr1   r2   r3   r4   bodyfilesoptionscast_to)r   r   r   r   strobject_postr   r   FileCreateParamsr   r   r'   r5   r6   r/   r0   r1   r2   r3   r4   rF   rG   s              r(   createzFiles.create?   s    B  "&&8	 
 
 d73;#7>>xjQQQ ()>X=CVTVXzz '9'JKK(+'%	     
 
 	
r*   rD   file_idrJ   c          	         |st          d|          |                     d| t          ||||          t                    S )a  
        Returns information about a specific file.

        Args:
          file_id: The ID of the file to use for this request.

          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/rD   rH   rI   
ValueError_getr   r   r'   rP   r1   r2   r3   r4   s         r(   retrievezFiles.retrievez   st    2  	TTT   yyg(+'%	     	
 	
 		
r*   afterlimitorderr6   r1   r2   r3   r4   r[   
str | Noner\   
int | Noner]   Literal['asc', 'desc'] | NoneFilePurpose | None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
              1000, and the default is 100

          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
        rC   r[   r\   r]   r6   r1   r2   r3   r4   querypagerH   model)_get_api_listr   r   r   r   r   FileListParams	r'   r[   r\   r]   r6   r1   r2   r3   r4   s	            r(   listz
Files.list   s{    P !!
+(+'%%!&!&!&#*	  %3    % " 
 
 	
r*   r   c          	         |st          d|          |                     d| t          ||||          t                    S )a  
        Delete a file and remove it from all vector stores.

        Args:
          file_id: The ID of the file to use for this request.

          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
        rR   rS   rD   rT   rV   _deleter   r   rX   s         r(   deletezFiles.delete   st    2  	TTT   ||g(+'%	      	
 	
 		
r*         @X  poll_intervalmax_wait_secondsidru   floatrv   c               6   ddh}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 10 mins.activefailedGiving up on waiting for file  to finish processing after 	 seconds.timerY   status_sleepRuntimeErrorr'   rw   ru   rv   TERMINAL_STATESstartr5   s          r(   wait_for_processingzFiles.wait_for_processing  s     $X.	}}R  k00KK&&&==$$Dy{{U"%555"pRppUeppp   k00 r*   )r#   r$   )r#   r+   )r5   r   r6   r	   r/   r7   r0   r8   r1   r9   r2   r:   r3   r;   r4   r<   r#   r   rP   rJ   r1   r9   r2   r:   r3   r;   r4   r<   r#   r   )r[   r^   r\   r_   r]   r`   r6   ra   r1   r9   r2   r:   r3   r;   r4   r<   r#   rb   rP   rJ   r1   r9   r2   r:   r3   r;   r4   r<   r#   r   rw   rJ   ru   rx   rv   rx   r#   r   __name__
__module____qualname__r   r)   r-   rO   rY   rm   rq   r    r*   r(   r    r    +   sB       * * * _* 0 0 0 _0 597; )-$("&049
 9
 9
 9
 9
 9
B )-$("&04&
 &
 &
 &
 &
 &
V ! /3&* )-$("&04;
 ;
 ;
 ;
 ;
 ;
F )-$("&04&
 &
 &
 &
 &
 &
X  #")       r*   c            	          e Zd Zed1d            Zed2d            Zdddddddd3dZdddddd4dZdddddddddd5d&Zdddddd6d(Z	d)d*d+d7d0Z
dS )8r!   r#   AsyncFilesWithRawResponsec                     t          |           S )z
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.
        )r   r&   s    r(   r)   zAsyncFiles.with_raw_response   s     )...r*   AsyncFilesWithStreamingResponsec                     t          |           S )ze
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.
        )r   r&   s    r(   r-   z"AsyncFiles.with_streaming_response(  s    
 /t444r*   Nr.   r5   r   r6   r	   r/   r_   r0   r8   r1   r9   r2   r:   r3   r;   r4   r<   r   c               V  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 )
a  Upload a file that can be used across various endpoints.

        Individual files can be up to 512 MB.

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

          purpose: The intended purpose of the uploaded file.

          expire_at: The Unix timestamp in seconds after which the file will be deleted. Defaults to 7 days.

          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>   r5   r?   rA   rB   rC   NrD   rE   )r   r   r   r   rJ   rK   rL   r   r   rM   r   r   rN   s              r(   rO   zAsyncFiles.create/  s      B  "&&8	 
 
 d73;#7>>xjQQQ ()>X=CVTVXZZ,T3E3VWWWWWWWW(+'%	      
 
 
 
 
 
 
 
 	
r*   rD   rP   rJ   c          	        K   |st          d|          |                     d| t          ||||          t                     d{V S )a^  
        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
        rR   rS   rD   rT   NrU   rX   s         r(   rY   zAsyncFiles.retrievej  s      .  	TTT   YYg(+'%	     	
 	
 	
 	
 	
 	
 	
 	
 		
r*   rZ   r[   r^   r\   r]   r`   ra   7AsyncPaginator[FileObject, AsyncCursorPage[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
        rC   rd   re   rg   )rj   r   r   r   r   r   rk   rl   s	            r(   rm   zAsyncFiles.list  s{    P !! ,(+'%%!&!&!&#*	  %3    % " 
 
 	
r*   r   c          	        K   |st          d|          |                     d| t          ||||          t                     d{V S )ag  
        Delete a file and remove it from all vector stores.

        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
        rR   rS   rD   rT   Nro   rX   s         r(   rq   zAsyncFiles.delete  s      .  	TTT   \\g(+'%	     " 	
 	
 	
 	
 	
 	
 	
 	
 		
r*   rr   rs   rt   rw   ru   rx   rv   c               ^  K   ddh}t          j                     }|                     |           d{V }|j        |vro|                     |           d{V  |                     |           d{V }t          j                     |z
  |k    rt	          d| d| d          |j        |vo|S )rz   r{   r|   Nr}   r~   r   r   r   s          r(   r   zAsyncFiles.wait_for_processing  s       $X.	]]2&&&&&&&&k00++m,,,,,,,,,r********Dy{{U"%555"pRppUeppp   k00 r*   )r#   r   )r#   r   )r5   r   r6   r	   r/   r_   r0   r8   r1   r9   r2   r:   r3   r;   r4   r<   r#   r   r   )r[   r^   r\   r_   r]   r`   r6   ra   r1   r9   r2   r:   r3   r;   r4   r<   r#   r   r   r   r   r   r*   r(   r!   r!     sB       / / / _/ 5 5 5 _5 !%7; )-$("&049
 9
 9
 9
 9
 9
B )-$("&04$
 $
 $
 $
 $
 $
R ! /3&* )-$("&04;
 ;
 ;
 ;
 ;
 ;
F )-$("&04$
 $
 $
 $
 $
 $
T  #")       r*   c                      e Zd ZddZdS )r$   rG   r    r#   Nonec                   || _         t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        d S N)_filesr   to_raw_response_wrapperrO   rY   rm   rq   r'   rG   s     r(   __init__zFilesWithRawResponse.__init__  sw    &>L
 
 )@N
 
 %<J
 
	 '>L
 
r*   NrG   r    r#   r   r   r   r   r   r   r*   r(   r$   r$     (        
 
 
 
 
 
r*   r$   c                      e Zd ZddZdS )r   rG   r!   r#   r   c                   || _         t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        d S r   )r   r   async_to_raw_response_wrapperrO   rY   rm   rq   r   s     r(   r   z"AsyncFilesWithRawResponse.__init__  sw    &DL
 
 )FN
 
 %BJ
 
	 'DL
 
r*   NrG   r!   r#   r   r   r   r*   r(   r   r     r   r*   r   c                      e Zd ZddZdS )r+   rG   r    r#   r   c                    || _         t          |j                  | _        t          |j                  | _        t          |j                  | _        t          |j                  | _        d S r   )r   r   rO   rY   rm   rq   r   s     r(   r   z#FilesWithStreamingResponse.__init__0  sk    2L
 
 5N
 
 1J
 
	 3L
 
r*   Nr   r   r   r*   r(   r+   r+   /  r   r*   r+   c                      e Zd ZddZdS )r   rG   r!   r#   r   c                    || _         t          |j                  | _        t          |j                  | _        t          |j                  | _        t          |j                  | _        d S r   )r   r   rO   rY   rm   rq   r   s     r(   r   z(AsyncFilesWithStreamingResponse.__init__B  sk    8L
 
 ;N
 
 7J
 
	 9L
 
r*   Nr   r   r   r*   r(   r   r   A  r   r*   r   )4
__future__r   datetimer   typingr   r   typing_extensionsr   httpx r   typesr	   r
   r   r   _typesr   r   r   r   _utilsr   r   r   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   _base_clientr   r   types.file_objectr   types.file_deletedr   __all__r    r!   r$   r   r+   r   r   r*   r(   <module>r      s   # " " " " "                   % % % % % %        X X X X X X X X X X X X 4 4 4 4 4 4 4 4 4 4 4 4            & % % % % % 9 9 9 9 9 9 9 9        9 8 8 8 8 8 8 8 ? ? ? ? ? ? ? ? * * * * * * , , , , , ,L
!q q q q qO q q qhi i i i i! i i iX
 
 
 
 
 
 
 
$
 
 
 
 
 
 
 
$
 
 
 
 
 
 
 
$
 
 
 
 
 
 
 
 
 
r*   