
    g                    @   d dl mZ d dlmZmZ d dlZddl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 ddl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      Z% G d d      Z& G d d      Z' G d d      Z(y)    )annotations)MappingcastN   )_legacy_response)	NOT_GIVENBodyQueryHeadersNotGiven	FileTypes)extract_filesmaybe_transformdeepcopy_minimalasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)make_request_options)part_create_params)
UploadPartParts
AsyncPartsc                  ^    e Zd Zedd       Zedd       Zddded	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)	r   c                    t        |       S a  
        This property can be used as a prefix for any HTTP method call to return the
        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
        )PartsWithRawResponseselfs    S/var/www/openai/venv/lib/python3.12/site-packages/openai/resources/uploads/parts.pywith_raw_responsezParts.with_raw_response   s     $D))    c                    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
        )PartsWithStreamingResponser    s    r"   with_streaming_responsezParts.with_streaming_response&   s     *$//r$   Nextra_headersextra_query
extra_bodytimeoutc               *   |st        d|      t        d|i      }t        t        t        t
        t        f   |      dgg      }ddi|xs i }| j                  d| dt        |t        j                        |t        ||||      t        	      S )
  
        Adds a
        [Part](https://platform.openai.com/docs/api-reference/uploads/part-object) to an
        [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object.
        A Part represents a chunk of bytes from the file you are trying to upload.

        Each Part can be at most 64 MB, and you can add Parts until you hit the Upload
        maximum of 8 GB.

        It is possible to add multiple Parts in parallel. You can decide the intended
        order of the Parts when you
        [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).

        Args:
          data: The chunk of bytes for this Part.

          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 datapathsContent-Typemultipart/form-data	/uploads//partsr)   bodyfilesoptionscast_to)
ValueErrorr   r   r   r   strobject_postr   r   PartCreateParamsr   r   	r!   	upload_idr1   r*   r+   r,   r-   r9   r:   s	            r"   createzParts.create/   s    H WXaWdeff/d73;#7>xjQ ()>X=CVTVXzz	{&) '9'J'JK(+Q[el   
 	
r$   )returnr   )rE   r'   rC   r>   r1   r   r*   zHeaders | Noner+   zQuery | Noner,   zBody | Noner-   z'float | httpx.Timeout | None | NotGivenrE   r   __name__
__module____qualname__r   r#   r(   r   rD    r$   r"   r   r      s    * * 0 0 )-$("&;D4
4
 	4
 &4
 "4
  4
 94
 
4
r$   c                  ^    e Zd Zedd       Zedd       Zddded	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)	r   c                    t        |       S r   )AsyncPartsWithRawResponser    s    r"   r#   zAsyncParts.with_raw_responseg   s     )..r$   c                    t        |       S r&   )AsyncPartsWithStreamingResponser    s    r"   r(   z"AsyncParts.with_streaming_responseq   s     /t44r$   Nr)   c               Z  K   |st        d|      t        d|i      }t        t        t        t
        t        f   |      dgg      }ddi|xs i }| j                  d| dt        |t        j                         d{   |t        ||||	      t        
       d{   S 7 %7 w)r/   r0   r1   r2   r4   r5   r6   r7   Nr)   r8   )r=   r   r   r   r   r>   r?   r@   r   r   rA   r   r   rB   s	            r"   rD   zAsyncParts.createz   s     H WXaWdeff/d73;#7>xjQ ()>X=CVTVXZZ	{&),T3E3V3VWW(+Q[el    
 
 	
W
s$   A?B+B'
 B+"B)#B+)B+)rE   rN   )rE   rP   rF   rG   rK   r$   r"   r   r   f   s    / / 5 5 )-$("&;D4
4
 	4
 &4
 "4
  4
 94
 
4
r$   c                      e Zd ZddZy)r   c                Z    || _         t        j                  |j                        | _        y N)_partsr   to_raw_response_wrapperrD   r!   partss     r"   __init__zPartsWithRawResponse.__init__   s"    &>>LL
r$   NrX   r   rE   NonerH   rI   rJ   rY   rK   r$   r"   r   r          
r$   r   c                      e Zd ZddZy)rN   c                Z    || _         t        j                  |j                        | _        y rT   )rU   r   async_to_raw_response_wrapperrD   rW   s     r"   rY   z"AsyncPartsWithRawResponse.__init__   s"    &DDLL
r$   NrX   r   rE   r[   r\   rK   r$   r"   rN   rN      r]   r$   rN   c                      e Zd ZddZy)r'   c                F    || _         t        |j                        | _        y rT   )rU   r   rD   rW   s     r"   rY   z#PartsWithStreamingResponse.__init__   s    2LL
r$   NrZ   r\   rK   r$   r"   r'   r'      r]   r$   r'   c                      e Zd ZddZy)rP   c                F    || _         t        |j                        | _        y rT   )rU   r   rD   rW   s     r"   rY   z(AsyncPartsWithStreamingResponse.__init__   s    8LL
r$   Nra   r\   rK   r$   r"   rP   rP      r]   r$   rP   ))
__future__r   typingr   r   httpx r   _typesr   r	   r
   r   r   r   _utilsr   r   r   r   _compatr   	_resourcer   r   	_responser   r   _base_clientr   types.uploadsr   types.uploads.upload_partr   __all__r   r   r   rN   r'   rP   rK   r$   r"   <module>rs      s    #      J J  ' : Y 0 / 3L
!H
O H
VH
! H
V
 

 

 

 
r$   