
    h>a                       % S SK Jr  S SKrS SK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rSSK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  SS
KJrJrJrJrJr  SSK J!r!J"r"  SSK#J$r$  SSK%J&r&J'r'  SSK(J)r)J*r*  SSK+J,r,  SSK-J.r.  SSK/Jr  SS/r0Sr1\Rd                  " \35      r4S\5S'    " S S\&5      r6 " S S\'5      r7 " S S5      r8 " S S5      r9 " S S5      r: " S S 5      r;g)!    )annotationsN)Listoverload)Path   )_legacy_response   )Parts
AsyncPartsPartsWithRawResponseAsyncPartsWithRawResponsePartsWithStreamingResponseAsyncPartsWithStreamingResponse)FilePurposeupload_create_paramsupload_complete_params)	NOT_GIVENBodyQueryHeadersNotGiven)maybe_transformasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)make_request_options)Upload)r   UploadsAsyncUploadsi   zlogging.Loggerlogc                     \ rS rSr\SS j5       r\SS j5       r\SS j5       r\SS\	S.             SS jj5       r
\S\	S.               SS	 j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rg)r!   .   c                ,    [        U R                  5      $ N)r
   _clientselfs    R/var/www/html/env/lib/python3.13/site-packages/openai/resources/uploads/uploads.pypartsUploads.parts/   s    T\\""    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
)UploadsWithRawResponser)   s    r+   with_raw_responseUploads.with_raw_response3   s     &d++r.   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
)UploadsWithStreamingResponser)   s    r+   with_streaming_responseUploads.with_streaming_response=   s     ,D11r.   Nbytes	part_sizemd5c                   gzESplits a file into multiple 64MB parts and uploads them sequentially.N r*   file	mime_typepurposer:   r;   r<   s          r+   upload_file_chunkedUploads.upload_file_chunkedF       r.   r;   r<   c                   gzPSplits an in-memory file into multiple 64MB parts and uploads them sequentially.Nr?   r*   rA   filenamer:   rB   rC   r;   r<   s           r+   rD   rE   S   rF   r.   rK   r:   r;   r<   c               l   [        U[        R                  5      (       a  Uc  [        S5      eUc  [        S5      eOP[        U[        5      (       d  [	        U5      nU(       d  UR
                  nUc  UR                  5       R                  nU R                  UUUUS9n/ n	Uc  [        n[        U[        R                  5      (       a  [        R                  " U5      n
O[        R                  " U5      n
  U
R                  U5      nU(       d  OlU R                  R                  UR                  US9n[         R#                  SUR                  UR                  5        U	R%                  UR                  5        M  U R+                  UR                  XS9$ ! [&         a    U
R)                  5         e f = f)Splits the given file into multiple parts and uploads them sequentially.

```py
from pathlib import Path

client.uploads.upload_file(
    file=Path("my-paper.pdf"),
    mime_type="pdf",
    purpose="assistants",
)
```
9The `filename` argument must be given for in-memory files6The `bytes` argument must be given for in-memory filesr:   rK   rB   rC   	upload_iddataUploaded part %s for upload %srS   part_idsr<   )
isinstancebuiltinsr:   	TypeErrorr   namestatst_sizecreateDEFAULT_PART_SIZEioBytesIOFileIOreadr,   idr#   infoappend	Exceptionclosecomplete)r*   rA   rB   rC   rK   r:   r;   r<   uploadrW   bufrT   parts                r+   rD   rE   a   sq   . dHNN++ [\\} XYY  dD))Dz99}		++	  
 !)IdHNN++*,**T*:C))D/C	xx	*zz((6994(H9477FIIN(  }}vyy8}MM	  	IIK	s   7F A,F F3extra_headersextra_query
extra_bodytimeoutc               x    U R                  S[        UUUUS.[        R                  5      [	        XVXxS9[
        S9$ )  
Creates an intermediate
[Upload](https://platform.openai.com/docs/api-reference/uploads/object) object
that you can add
[Parts](https://platform.openai.com/docs/api-reference/uploads/part-object) to.
Currently, an Upload can accept at most 8 GB in total and expires after an hour
after you create it.

Once you complete the Upload, we will create a
[File](https://platform.openai.com/docs/api-reference/files/object) object that
contains all the parts you uploaded. This File is usable in the rest of our
platform as a regular File object.

For certain `purpose` values, the correct `mime_type` must be specified. Please
refer to documentation for the
[supported MIME types for your use case](https://platform.openai.com/docs/assistants/tools/file-search#supported-files).

For guidance on the proper filename extensions for each purpose, please follow
the documentation on
[creating a File](https://platform.openai.com/docs/api-reference/files/create).

Args:
  bytes: The number of bytes in the file you are uploading.

  filename: The name of the file to upload.

  mime_type: The MIME type of the file.

      This must fall within the supported MIME types for your file purpose. See the
      supported MIME types for assistants and vision.

  purpose: The intended purpose of the uploaded file.

      See the
      [documentation on File purposes](https://platform.openai.com/docs/api-reference/files/create#files-create-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
/uploadsrQ   rm   bodyoptionscast_to)_postr   r   UploadCreateParamsr   r    	r*   r:   rK   rB   rC   rn   ro   rp   rq   s	            r+   r^   Uploads.create   sW    t zz " (!*&	 %77 )+Q[   
 	
r.   c          
     p    U(       d  [        SU< 35      eU R                  SU S3[        X#XES9[        S9$ )C  Cancels the Upload.

No Parts may be added after an Upload is cancelled.

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
8Expected a non-empty value for `upload_id` but received 	/uploads//cancelrm   rw   rx   
ValueErrorry   r   r    r*   rS   rn   ro   rp   rq   s         r+   cancelUploads.cancel   sQ    0 WXaWdeffzz	{'*(+Q[   
 	
r.   r<   rn   ro   rp   rq   c                   U(       d  [        SU< 35      eU R                  SU S3[        UUS.[        R                  5      [        XEXgS9[        S9$ )  
Completes the
[Upload](https://platform.openai.com/docs/api-reference/uploads/object).

Within the returned Upload object, there is a nested
[File](https://platform.openai.com/docs/api-reference/files/object) object that
is ready to use in the rest of the platform.

You can specify the order of the Parts by passing in an ordered list of the Part
IDs.

The number of bytes uploaded upon completion must match the number of bytes
initially specified when creating the Upload object. No Parts may be added after
an Upload is completed.

Args:
  part_ids: The ordered list of Part IDs.

  md5: The optional md5 checksum for the file contents to verify if the bytes uploaded
      matches what you expect.

  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   	/completerW   r<   rm   ru   )r   ry   r   r   UploadCompleteParamsr   r    r*   rS   rW   r<   rn   ro   rp   rq   s           r+   ri   Uploads.complete  sr    T WXaWdeffzz	{),  ( ';; )+Q[   
 	
r.   r?   )returnr
   )r   r1   )r   r6   rA   zos.PathLike[str]rB   strrC   r   r:   
int | Noner;   r   r<   str | NotGivenr   r    rA   r:   rK   r   r:   intrB   r   rC   r   r;   r   r<   r   r   r    rA   zos.PathLike[str] | bytesrB   r   rC   r   rK   z
str | Noner:   r   r;   r   r<   r   r   r    r:   r   rK   r   rB   r   rC   r   rn   Headers | Nonero   Query | Nonerp   Body | Nonerq   'float | httpx.Timeout | None | NotGivenr   r    rS   r   rn   r   ro   r   rp   r   rq   r   r   r    rS   r   rW   z	List[str]r<   r   rn   r   ro   r   rp   r   rq   r   r   r    __name__
__module____qualname____firstlineno__r   r,   r2   r7   r   r   rD   r^   r   ri   __static_attributes__r?   r.   r+   r!   r!   .   s   # # , , 2 2  ! $'
T 
T 	
T
 
T 
T 
T 
T 

T 
T  !%'_ _ 	_
 _ _ _ _ _ 
_ _&  $  $'FN 'FN 	FN
 FN FN FN FN FN 
FNb )-$("&;DI
 I
 	I

 I
 I
 &I
 "I
  I
 9I
 
I
b )-$("&;D 
 
 & 
 " 
   
 9 
 
 
N ( )-$("&;D9
9
 	9

 9
 &9
 "9
  9
 99
 
9
 9
r.   c                     \ rS rSr\SS j5       r\SS j5       r\SS j5       r\SS\	S.             SS jj5       r
\S\	S.               SS	 j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rg)r"   iR  c                ,    [        U R                  5      $ r'   )r   r(   r)   s    r+   r,   AsyncUploads.partsS  s    $,,''r.   c                    [        U 5      $ r0   )AsyncUploadsWithRawResponser)   s    r+   r2   AsyncUploads.with_raw_responseW  s     +400r.   c                    [        U 5      $ r5   )!AsyncUploadsWithStreamingResponser)   s    r+   r7   $AsyncUploads.with_streaming_responsea  s     166r.   Nr9   c                  #    g7fr>   r?   r@   s          r+   rD    AsyncUploads.upload_file_chunkedj          rG   c                  #    g7frI   r?   rJ   s           r+   rD   r   w  r   r   rL   c                 #    [        U[        R                  5      (       a  Uc  [        S5      eUc  [        S5      eOo[        U[        R
                  5      (       d  [        R
                  " U5      nU(       d  UR                  nUc$  UR                  5       I Sh  vN nUR                  nU R                  UUUUS9I Sh  vN n	/ n
Uc  [        n[        U[        R
                  5      (       a  UR                  S5      I Sh  vN nU ISh  vN    UR                  U5      I Sh  vN nU(       d  OtU R                  R                  U	R                  US9I Sh  vN n[        R!                  SUR                  U	R                  5        U
R#                  UR                  5        M  SSS5      ISh  vN   O[$        R&                  " U5      n  UR                  U5      nU(       d  OtU R                  R                  U	R                  US9I Sh  vN n[        R!                  SUR                  U	R                  5        U
R#                  UR                  5        M  U R-                  U	R                  XS9I Sh  vN $  GN GN GN GN| GNe GN4 N! , ISh  vN  (       d  f       NM= f N! [(         a    UR+                  5         e f = f NS7f)	rN   NrO   rP   rQ   rbrR   rU   rV   )rX   rY   r:   rZ   anyior   r[   r\   r]   r^   r_   openrc   r,   rd   r#   re   rf   r`   ra   rg   rh   ri   )r*   rA   rB   rC   rK   r:   r;   r<   r\   rj   rW   fdrT   rl   rk   s                  r+   rD   r     s=    . dHNN++ [\\} XYY  dEJJ//zz$'99}!YY[({{	 # 
 
 !)IdEJJ''yy&Br!#!33D!%!2!2VYYT!2!RRDHH=tww		ROODGG,  rr **T"C88I.D!%!2!2VYYT!2!RRDHH=tww		ROODGG,  ]]VYY]SSSY )
 '3
 S rrr( S  		 Ts   BKJ%KJAKJ

KJKJ+J,3JJ AJ,K7J8KJ4 -K.'J4 J2AJ4 "K?K KK
KKJJKJ/J!J/+K2J4 4KKrm   c                  #    U R                  S[        UUUUS.[        R                  5      I Sh  vN [	        XVXxS9[
        S9I Sh  vN $  N N7f)rs   rt   rQ   Nrm   ru   )ry   r   r   rz   r   r    r{   s	            r+   r^   AsyncUploads.create  sn     t ZZ," (!*&	 %77  )+Q[    
 
 	

s!   /AA
A	A
AA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)r~   r   r   r   rm   r   Nr   r   s         r+   r   AsyncUploads.cancel#  s^     0 WXaWdeffZZ	{'*(+Q[    
 
 	
 
s   ;AAAr   c                  #    U(       d  [        SU< 35      eU R                  SU S3[        UUS.[        R                  5      I Sh  vN [        XEXgS9[        S9I Sh  vN $  N N7f)r   r   r   r   r   Nrm   ru   )r   ry   r   r   r   r   r    r   s           r+   ri   AsyncUploads.completeE  s     T WXaWdeffZZ	{),, ( ';;  )+Q[    
 
 	

s$   AA*	A&

A*!A("A*(A*r?   )r   r   )r   r   )r   r   r   r   r   r   r   r   r   r?   r.   r+   r"   r"   R  s   ( ( 1 1 7 7  ! $'
T 
T 	
T
 
T 
T 
T 
T 

T 
T  !%'_ _ 	_
 _ _ _ _ _ 
_ _&  $  $'QT 'QT 	QT
 QT QT QT QT QT 
QTx )-$("&;DI
 I
 	I

 I
 I
 &I
 "I
  I
 9I
 
I
b )-$("&;D 
 
 & 
 " 
   
 9 
 
 
N ( )-$("&;D9
9
 	9

 9
 &9
 "9
  9
 99
 
9
 9
r.   c                  2    \ rS rSrSS jr\SS j5       rSrg)r1   i  c                    Xl         [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR
                  5      U l        g r'   )_uploadsr   to_raw_response_wrapperr^   r   ri   r*   uploadss     r+   __init__UploadsWithRawResponse.__init__  sX    &>>NN
 '>>NN
 )@@
r.   c                @    [        U R                  R                  5      $ r'   )r   r   r,   r)   s    r+   r,   UploadsWithRawResponse.parts  s    #DMM$7$788r.   r   r   ri   r^   Nr   r!   r   None)r   r   r   r   r   r   r   r   r,   r   r?   r.   r+   r1   r1     s    
 9 9r.   r1   c                  2    \ rS rSrSS jr\SS j5       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        g r'   )r   r   async_to_raw_response_wrapperr^   r   ri   r   s     r+   r   $AsyncUploadsWithRawResponse.__init__  sX    &DDNN
 'DDNN
 )FF
r.   c                @    [        U R                  R                  5      $ r'   )r   r   r,   r)   s    r+   r,   !AsyncUploadsWithRawResponse.parts  s    ()<)<==r.   r   Nr   r"   r   r   )r   r   r   r?   r.   r+   r   r     s    
 > >r.   r   c                  2    \ rS rSrSS jr\SS j5       rSrg)r6   i  c                    Xl         [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        g r'   )r   r   r^   r   ri   r   s     r+   r   %UploadsWithStreamingResponse.__init__  sF    2NN
 3NN
 5
r.   c                @    [        U R                  R                  5      $ r'   )r   r   r,   r)   s    r+   r,   "UploadsWithStreamingResponse.parts  s    )$--*=*=>>r.   r   Nr   )r   r   r   r?   r.   r+   r6   r6     s    
 ? ?r.   r6   c                  2    \ rS rSrSS jr\SS j5       rSrg)r   i  c                    Xl         [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        g r'   )r   r   r^   r   ri   r   s     r+   r   *AsyncUploadsWithStreamingResponse.__init__  sF    8NN
 9NN
 ;
r.   c                @    [        U R                  R                  5      $ r'   )r   r   r,   r)   s    r+   r,   'AsyncUploadsWithStreamingResponse.parts  s    .t}}/B/BCCr.   r   Nr   )r   r   r   r?   r.   r+   r   r     s    
 D Dr.   r   )<
__future__r   r`   osloggingrY   typingr   r   pathlibr   r   httpx r   r,   r
   r   r   r   r   r   typesr   r   r   _typesr   r   r   r   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   _base_clientr   types.uploadr    types.file_purpose__all__r_   	getLoggerr   r#   __annotations__r!   r"   r1   r   r6   r   r?   r.   r+   <module>r      s    # 	 	   !       O N ? ? ' : Y 0 " -n
% % ''1^ 1a
o a
H	l
# l
^	9 9&> >&? ?&D Dr.   