
    h-t                       S SK Jr  S SKrS SKrS SKJrJr  S SKJr  S SKrSSK	J
r
  SSKJrJrJr  SSKJrJrJrJrJrJr  SS	KJrJrJrJr  SS
KJr  SSKJrJr  SSK J!r!J"r"J#r#J$r$J%r%J&r&  SSK'J(r(J)r)  SSK*J+r+J,r,  SSK-J.r.  SSK/J0r0  SSK1Jr  SS/r2 " S S\5      r3 " S S\5      r4 " S S5      r5 " S S5      r6 " S S5      r7 " S S5      r8g)    )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            	         \ rS rSr\SS j5       r\SS j5       rSSS\S.             SS jjrSSS\S.           SS jjr	\\\\SSS\S.                 SS	 jjr
SSS\S.           SS
 jjrSSS\S.           SS jjr\R                  " S5      SSS\S.           SS jj5       rSSS.       SS jjrSrg)r%   (   c                    [        U 5      $ 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.

For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
)FilesWithRawResponseselfs    H/var/www/html/env/lib/python3.13/site-packages/openai/resources/files.pywith_raw_responseFiles.with_raw_response)   s     $D))    c                    [        U 5      $ 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
)FilesWithStreamingResponser,   s    r.   with_streaming_responseFiles.with_streaming_response3   s     *$//r1   Nextra_headersextra_query
extra_bodytimeoutc                   [        UUS.5      n[        [        [        [        [
        4   U5      S//S9nSS0U=(       d    0 EnU R                  S[        U[        R                  5      U[        X4XVS9[        S9$ )	  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 100 GB.

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

  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
filepurposer?   pathsContent-Typemultipart/form-data/filesr7   bodyfilesoptionscast_to)r   r   r   r   strobject_postr   r   FileCreateParamsr"   r#   	r-   r?   r@   r8   r9   r:   r;   rG   rH   s	            r.   createFiles.create<   s    h  "
 d73;#7>xjQ ()>X=CVTVXzz '9'J'JK(+Q[   
 	
r1   c          
     n    U(       d  [        SU< 35      eU R                  SU 3[        X#XES9[        S9$ )&  
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/r7   rI   rJ   
ValueError_getr"   r#   r-   file_idr8   r9   r:   r;   s         r.   retrieveFiles.retrieve   sO    . UV]U`abbyygY(+Q[   
 	
r1   afterlimitorderr@   r8   r9   r:   r;   c                   U R                  S[        [           [        UUUU[	        UUUUS.[
        R                  5      S9[        S9$ 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
rE   )r_   r`   ra   r@   )r8   r9   r:   r;   query)pagerI   model)_get_api_listr   r#   r"   r   r
   FileListParams	r-   r_   r`   ra   r@   r8   r9   r:   r;   s	            r.   list
Files.list   se    P !!
+(+'%%!&!&!&#*	 %33 % " 
 	
r1   c          
     n    U(       d  [        SU< 35      eU R                  SU 3[        X#XES9[        S9$ )
  
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
rT   rU   r7   rV   rX   _deleter"   r$   rZ   s         r.   deleteFiles.delete   sO    . UV]U`abb||gY(+Q[    
 	
r1   c          
         U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        X#XES9[        R                  S9$ )'  
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
rT   Acceptapplication/binaryrU   /contentr7   rV   rX   rY   r"   r   HttpxBinaryResponseContentrZ   s         r.   contentFiles.content  sl    . UV]U`abb!#7QM<ORQyygYh'(+Q[ %??  
 	
r1   .The `.content()` method should be used insteadc          
     p    U(       d  [        SU< 35      eU R                  SU S3[        X#XES9[        S9$ )rs   rT   rU   rv   r7   rV   rX   rY   r"   rK   rZ   s         r.   retrieve_contentFiles.retrieve_content&  sQ    0 UV]U`abbyygYh'(+Q[   
 	
r1         @  poll_intervalmax_wait_secondsc               >   1 Skn[         R                   " 5       nU R                  U5      nUR                  U;  ab  U R                  U5        U R                  U5      n[         R                   " 5       U-
  U:  a  [	        SU SU S35      eUR                  U;  a  Mb  U$ )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-   idr   r   TERMINAL_STATESstartr?   s          r.   wait_for_processingFiles.wait_for_processingH  s     <		}}R kk0KK&==$Dyy{U"%55"4RD8TUeTffop  kk0 r1    )returnr+   )r   r4   r?   r   r@   r	   r8   Headers | Noner9   Query | Noner:   Body | Noner;   'float | httpx.Timeout | None | NotGivenr   r#   r[   rK   r8   r   r9   r   r:   r   r;   r   r   r#   )r_   str | NotGivenr`   int | NotGivenra   !Literal['asc', 'desc'] | NotGivenr@   r   r8   r   r9   r   r:   r   r;   r   r   zSyncCursorPage[FileObject]r[   rK   r8   r   r9   r   r:   r   r;   r   r   r$   r[   rK   r8   r   r9   r   r:   r   r;   r   r   z+_legacy_response.HttpxBinaryResponseContentr[   rK   r8   r   r9   r   r:   r   r;   r   r   rK   r   rK   r   floatr   r   r   r#   __name__
__module____qualname____firstlineno__r   r/   r5   r   rP   r\   rj   rp   ry   typing_extensions
deprecatedr~   r   __static_attributes__r   r1   r.   r%   r%   (   s   * * 0 0 )-$("&;DG
 G
 	G
 &G
 "G
  G
 9G
 
G
^ )-$("&;D

 &
 "
  
 9
 

H !* )3<"+ )-$("&;D;
 ;
 	;

 1;
  ;
 &;
 ";
  ;
 9;
 
$;
F )-$("&;D

 &
 "
  
 9
 

N )-$("&;D 
 
 & 
 " 
   
 9 
 
5 
D !!"RS )-$("&;D

 &
 "
  
 9
 

 T
J  #") 	
   
 r1   c            	         \ rS rSr\SS j5       r\SS j5       rSSS\S.             SS jjrSSS\S.           SS jjr	\\\\SSS\S.                 SS	 jjr
SSS\S.           SS
 jjrSSS\S.           SS jjr\R                  " S5      SSS\S.           SS jj5       rSSS.       SS jjrSrg)r&   i`  c                    [        U 5      $ r*   )AsyncFilesWithRawResponser,   s    r.   r/   AsyncFiles.with_raw_responsea  s     )..r1   c                    [        U 5      $ r3   )AsyncFilesWithStreamingResponser,   s    r.   r5   "AsyncFiles.with_streaming_responsek  s     /t44r1   Nr7   c               (  #    [        UUS.5      n[        [        [        [        [
        4   U5      S//S9nSS0U=(       d    0 EnU R                  S[        U[        R                  5      I Sh  vN U[        X4XVS9[        S	9I Sh  vN $  N N7f)
r=   r>   r?   rA   rC   rD   rE   Nr7   rF   )r   r   r   r   rK   rL   rM   r   r   rN   r"   r#   rO   s	            r.   rP   AsyncFiles.createt  s     h  "
 d73;#7>xjQ ()>X=CVTVXZZ,T3E3V3VWW(+Q[    
 
 	
W
s$   A.B0B
1B	B
BBc          
        #    U(       d  [        SU< 35      eU R                  SU 3[        X#XES9[        S9I Sh  vN $  N7f)rS   rT   rU   r7   rV   NrW   rZ   s         r.   r\   AsyncFiles.retrieve  s\     . UV]U`abbYYgY(+Q[   
 
 	
 
   :AAAr^   c                   U R                  S[        [           [        UUUU[	        UUUUS.[
        R                  5      S9[        S9$ rc   )rg   r    r#   r"   r   r
   rh   ri   s	            r.   rj   AsyncFiles.list  se    P !! ,(+'%%!&!&!&#*	 %33 % " 
 	
r1   c          
        #    U(       d  [        SU< 35      eU R                  SU 3[        X#XES9[        S9I Sh  vN $  N7f)rm   rT   rU   r7   rV   Nrn   rZ   s         r.   rp   AsyncFiles.delete  s\     . UV]U`abb\\gY(+Q[   " 
 
 	
 
r   c          
        #    U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        X#XES9[        R                  S9I Sh  vN $  N7f)	rs   rT   rt   ru   rU   rv   r7   rV   Nrw   rZ   s         r.   ry   AsyncFiles.content<  sy     . UV]U`abb!#7QM<ORQYYgYh'(+Q[ %??  
 
 	
 
s   AAAAr{   c          
        #    U(       d  [        SU< 35      eU R                  SU S3[        X#XES9[        S9I Sh  vN $  N7f)rs   rT   rU   rv   r7   rV   Nr}   rZ   s         r.   r~   AsyncFiles.retrieve_content^  s^     0 UV]U`abbYYgYh'(+Q[   
 
 	
 
s   ;AAAr   r   r   c                 #    1 Skn[         R                   " 5       nU R                  U5      I Sh  vN nUR                  U;  ar  U R                  U5      I Sh  vN   U R                  U5      I Sh  vN n[         R                   " 5       U-
  U:  a  [	        SU SU S35      eUR                  U;  a  Mr  U$  N Na NJ7f)r   >   r   r   r   Nr   r   r   r   r   s          r.   r   AsyncFiles.wait_for_processing  s      <		]]2&&kk0++m,,,r**Dyy{U"%55"4RD8TUeTffop  kk0  ',*s:   .B?B9(B?B;B?2B=3AB?7B?;B?=B?r   )r   r   )r   r   r   r   )r_   r   r`   r   ra   r   r@   r   r8   r   r9   r   r:   r   r;   r   r   z7AsyncPaginator[FileObject, AsyncCursorPage[FileObject]]r   r   r   r   r   r   r1   r.   r&   r&   `  s   / / 5 5 )-$("&;DG
 G
 	G
 &G
 "G
  G
 9G
 
G
^ )-$("&;D

 &
 "
  
 9
 

H !* )3<"+ )-$("&;D;
 ;
 	;

 1;
  ;
 &;
 ";
  ;
 9;
 
A;
F )-$("&;D

 &
 "
  
 9
 

N )-$("&;D 
 
 & 
 " 
   
 9 
 
5 
D !!"RS )-$("&;D

 &
 "
  
 9
 

 T
J  #") 	
   
 r1   c                      \ rS rSrSS jrSrg)r+   i  c                   Xl         [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR
                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        g N)	_filesr   to_raw_response_wrapperrP   r\   rj   rp   ry   r~   r-   rH   s     r.   __init__FilesWithRawResponse.__init__  s    &>>LL
 )@@NN
 %<<JJ
	 '>>LL
 (??MM
 44&& 	r1   r   ry   rP   rp   rj   r\   r~   NrH   r%   r   Noner   r   r   r   r   r   r   r1   r.   r+   r+         
r1   r+   c                      \ rS rSrSS jrSrg)r   i  c                   Xl         [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR
                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        g r   )	r   r   async_to_raw_response_wrapperrP   r\   rj   rp   ry   r~   r   s     r.   r   "AsyncFilesWithRawResponse.__init__  s    &DDLL
 )FFNN
 %BBJJ
	 'DDLL
 (EEMM
 ::&& 	r1   r   NrH   r&   r   r   r   r   r1   r.   r   r     r   r1   r   c                      \ rS rSrSS jrSrg)r4   i  c                R   Xl         [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        [        UR
                  5      U l        [        UR                  [        5      U l        [        UR                  5      U l	        g r   )
r   r   rP   r\   rj   rp   r   ry   r   r~   r   s     r.   r   #FilesWithStreamingResponse.__init__  s    2LL
 5NN
 1JJ
	 3LL
 ;MM%

 )&& 	r1   r   Nr   r   r   r1   r.   r4   r4         
r1   r4   c                      \ rS rSrSS jrSrg)r   i  c                R   Xl         [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        [        UR
                  5      U l        [        UR                  [        5      U l        [        UR                  5      U l	        g r   )
r   r   rP   r\   rj   rp   r   ry   r   r~   r   s     r.   r   (AsyncFilesWithStreamingResponse.__init__  s    8LL
 ;NN
 7JJ
	 9LL
 AMM*

 /&& 	r1   r   Nr   r   r   r1   r.   r   r     r   r1   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   r4   r   r   r1   r.   <module>r      s    #     %   E E I I  & 9  9 ? * , ,L
!uO up	u! up	
 
4
 
4
 
6
 
r1   