Ë
    Fü´jßW  ã                  ól  — d dl mZ d dlmZ d dlmZ d dl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mZ dd	l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$ ddl%m&Z&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«      Z0y)é    )Úannotations)ÚOptional)ÚLiteralNé   )Ú_legacy_response)Úbatch_list_paramsÚbatch_create_params)ÚBodyÚOmitÚQueryÚHeadersÚNotGivenÚomitÚ	not_given)Úpath_templateÚmaybe_transformÚasync_maybe_transform)Úcached_property)ÚSyncAPIResourceÚAsyncAPIResource)Úto_streamed_response_wrapperÚ"async_to_streamed_response_wrapper)ÚSyncCursorPageÚAsyncCursorPage)ÚBatch)ÚAsyncPaginatorÚmake_request_options)ÚMetadataÚBatchesÚAsyncBatchesc                  óø   — e Zd ZdZedd„«       Zedd„«       Zeedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z	dddedœ	 	 	 	 	 	 	 	 	 	 	 dd„Z
eeddded	œ	 	 	 	 	 	 	 	 	 	 	 	 	 dd
„Zdddedœ	 	 	 	 	 	 	 	 	 	 	 dd„Zy)r   ú;Create large batches of API requests to run asynchronously.c                ó   — 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
        )ÚBatchesWithRawResponse©Úselfs    úV/root/workspace/ytshorts/venv/lib/python3.12/site-packages/openai/resources/batches.pyÚwith_raw_responsezBatches.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
        )ÚBatchesWithStreamingResponser&   s    r(   Úwith_streaming_responsezBatches.with_streaming_response&   s   € ô ,¨DÓ1Ð1r*   N©ÚmetadataÚoutput_expires_afterÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutc       	        ó�   — | j                  dt        |||||dœt        j                  «      t	        ||||	ddi¬«      t
        ¬«      S )á  
        Creates and executes a batch from an uploaded file of requests

        Args:
          completion_window: The time frame within which the batch should be processed. Currently only `24h`
              is supported.

          endpoint: The endpoint to be used for all requests in the batch. Currently
              `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`,
              `/v1/moderations`, `/v1/images/generations`, `/v1/images/edits`, and
              `/v1/videos` are supported. Note that `/v1/embeddings` batches are also
              restricted to a maximum of 50,000 embedding inputs across all requests in the
              batch.

          input_file_id: The ID of an uploaded file that contains requests for the new batch.

              See
              [upload file](https://developers.openai.com/api/reference/resources/files/methods/create)
              for how to upload a file.

              Your input file must be formatted as a
              [JSONL file](https://developers.openai.com/api/docs/guides/batch#1-prepare-your-batch-file),
              and must be uploaded with the purpose `batch`. The file can contain up to 50,000
              requests, and can be up to 200 MB in size.

          metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
              for storing additional information about the object in a structured format, and
              querying for objects via API or the dashboard.

              Keys are strings with a maximum length of 64 characters. Values are strings with
              a maximum length of 512 characters.

          output_expires_after: The expiration policy for the output and/or error file that are generated for a
              batch.

          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
        ú/batches©Úcompletion_windowÚendpointÚinput_file_idr0   r1   Úbearer_authT©r2   r3   r4   r5   Úsecurity©ÚbodyÚoptionsÚcast_to)Ú_postr   r	   ÚBatchCreateParamsr   r   ©
r'   r:   r;   r<   r0   r1   r2   r3   r4   r5   s
             r(   ÚcreatezBatches.create/   sh   € ðF �z‰zØÜ à):Ø (Ø%2Ø (Ø,@ñô $×5Ñ5ó	ô )Ø+Ø'Ø%ØØ'¨Ð.ôô ð' ó 
ð 	
r*   ©r2   r3   r4   r5   c               óˆ   — |st        d|›�«      ‚| j                  t        d|¬«      t        ||||ddi¬«      t        ¬«      S )áF  
        Retrieves a batch.

        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
        ú7Expected a non-empty value for `batch_id` but received ú/batches/{batch_id}©Úbatch_idr=   Tr>   ©rB   rC   ©Ú
ValueErrorÚ_getr   r   r   ©r'   rN   r2   r3   r4   r5   s         r(   ÚretrievezBatches.retrieveˆ   s^   € ñ. ÜÐVÐW_ÐVbÐcÓdÐdØ�y‰yÜÐ/¸(ÔCÜ(Ø+Ø'Ø%ØØ'¨Ð.ôô ð ó 

ð 
	
r*   ©ÚafterÚlimitr2   r3   r4   r5   c               ó¢   — | j                  dt        t           t        ||||t	        ||dœt
        j                  «      ddi¬«      t        ¬«      S ©a,  List your organization's batches.

        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
              100, and the default is 20.

          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
        r8   )rV   rW   r=   T)r2   r3   r4   r5   Úqueryr?   )ÚpagerB   Úmodel)Ú_get_api_listr   r   r   r   r   ÚBatchListParams©r'   rV   rW   r2   r3   r4   r5   s          r(   ÚlistzBatches.list­   si   € ðB ×!Ñ!ØÜ¤Ñ&Ü(Ø+Ø'Ø%ØÜ%à!&Ø!&ñô &×5Ñ5óð (¨Ð.ôô ð# "ó 
ð 	
r*   c               óˆ   — |st        d|›�«      ‚| j                  t        d|¬«      t        ||||ddi¬«      t        ¬«      S )á
  Cancels an in-progress batch.

        The batch will be in status `cancelling` for up to
        10 minutes, before changing to `cancelled`, where it will have partial results
        (if any) available in the output 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
        rK   ú/batches/{batch_id}/cancelrM   r=   Tr>   rO   ©rQ   rD   r   r   r   rS   s         r(   ÚcancelzBatches.cancelâ   s^   € ñ4 ÜÐVÐW_ÐVbÐcÓdÐdØ�z‰zÜÐ6ÀÔJÜ(Ø+Ø'Ø%ØØ'¨Ð.ôô ð ó 

ð 
	
r*   )Úreturnr%   )rf   r-   ©r:   zLiteral['24h']r;   z¤Literal['/v1/responses', '/v1/chat/completions', '/v1/embeddings', '/v1/completions', '/v1/moderations', '/v1/images/generations', '/v1/images/edits', '/v1/videos']r<   Ústrr0   zOptional[Metadata] | Omitr1   z-batch_create_params.OutputExpiresAfter | Omitr2   úHeaders | Noner3   úQuery | Noner4   úBody | Noner5   ú(float | httpx2.Timeout | None | NotGivenrf   r   ©rN   rh   r2   ri   r3   rj   r4   rk   r5   rl   rf   r   )rV   ú
str | OmitrW   ú
int | Omitr2   ri   r3   rj   r4   rk   r5   rl   rf   zSyncCursorPage[Batch]©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r)   r.   r   r   rG   rT   r`   re   © r*   r(   r   r      s´  „ ÙEàò,ó ð,ð ò2ó ð2ð. /3ØNRð )-Ø$(Ø"&Ø<Eñ-W
ð *ðW
ð	
ð	W
ð ðW
ð ,ðW
ð  Lð!W
ð& &ð'W
ð( "ð)W
ð*  ð+W
ð, :ð-W
ð. 
ó/W
ð~ )-Ø$(Ø"&Ø<Eñ#
àð#
ð &ð#
ð "ð#
ð  ð#
ð :ð#
ð 
ó#
ðP !Ø ð )-Ø$(Ø"&Ø<Eñ3
ð ð3
ð ð	3
ð &ð3
ð "ð3
ð  ð3
ð :ð3
ð 
ó3
ðv )-Ø$(Ø"&Ø<Eñ&
àð&
ð &ð&
ð "ð&
ð  ð&
ð :ð&
ð 
ô&
r*   c                  óø   — e Zd ZdZedd„«       Zedd„«       Zeedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z	dddedœ	 	 	 	 	 	 	 	 	 	 	 dd„Z
eeddded	œ	 	 	 	 	 	 	 	 	 	 	 	 	 dd
„Zdddedœ	 	 	 	 	 	 	 	 	 	 	 dd„Zy)r    r"   c                ó   — t        | «      S r$   )ÚAsyncBatchesWithRawResponser&   s    r(   r)   zAsyncBatches.with_raw_response  s   € ô +¨4Ó0Ð0r*   c                ó   — t        | «      S r,   )Ú!AsyncBatchesWithStreamingResponser&   s    r(   r.   z$AsyncBatches.with_streaming_response  s   € ô 1°Ó6Ð6r*   Nr/   c       	      ƒ  óÀ   K  — | j                  dt        |||||dœt        j                  «      ƒ d{  –—† t	        ||||	ddi¬«      t
        ¬«      ƒ d{  –—† S 7 Œ'7 Œ­w)r7   r8   r9   Nr=   Tr>   r@   )rD   r   r	   rE   r   r   rF   s
             r(   rG   zAsyncBatches.create!  s�   è ø€ ðF —Z‘ZØÜ,à):Ø (Ø%2Ø (Ø,@ñô $×5Ñ5ó	÷ 	ô )Ø+Ø'Ø%ØØ'¨Ð.ôô ð'  ó 
÷ 
ð 	
ð	øð
ús!   ‚0A²A
³"AÁAÁAÁArH   c             ƒ  ó¤   K  — |st        d|›�«      ‚| j                  t        d|¬«      t        ||||ddi¬«      t        ¬«      ƒ d{  –—† S 7 Œ­w)	rJ   rK   rL   rM   r=   Tr>   rO   NrP   rS   s         r(   rT   zAsyncBatches.retrievez  sl   è ø€ ñ. ÜÐVÐW_ÐVbÐcÓdÐdØ—Y‘YÜÐ/¸(ÔCÜ(Ø+Ø'Ø%ØØ'¨Ð.ôô ð ó 

÷ 

ð 
	
ð 

úó   ‚AAÁ	AÁ
ArU   c               ó¢   — | j                  dt        t           t        ||||t	        ||dœt
        j                  «      ddi¬«      t        ¬«      S rY   )r]   r   r   r   r   r   r^   r_   s          r(   r`   zAsyncBatches.listŸ  si   € ðB ×!Ñ!ØÜ ¤Ñ'Ü(Ø+Ø'Ø%ØÜ%à!&Ø!&ñô &×5Ñ5óð (¨Ð.ôô ð# "ó 
ð 	
r*   c             ƒ  ó¤   K  — |st        d|›�«      ‚| j                  t        d|¬«      t        ||||ddi¬«      t        ¬«      ƒ d{  –—† S 7 Œ­w)	rb   rK   rc   rM   r=   Tr>   rO   Nrd   rS   s         r(   re   zAsyncBatches.cancelÔ  sl   è ø€ ñ4 ÜÐVÐW_ÐVbÐcÓdÐdØ—Z‘ZÜÐ6ÀÔJÜ(Ø+Ø'Ø%ØØ'¨Ð.ôô ð  ó 

÷ 

ð 
	
ð 

úr}   )rf   rx   )rf   rz   rg   rm   )rV   rn   rW   ro   r2   ri   r3   rj   r4   rk   r5   rl   rf   z-AsyncPaginator[Batch, AsyncCursorPage[Batch]]rp   ru   r*   r(   r    r      s´  „ ÙEàò1ó ð1ð ò7ó ð7ð. /3ØNRð )-Ø$(Ø"&Ø<Eñ-W
ð *ðW
ð	
ð	W
ð ðW
ð ,ðW
ð  Lð!W
ð& &ð'W
ð( "ð)W
ð*  ð+W
ð, :ð-W
ð. 
ó/W
ð~ )-Ø$(Ø"&Ø<Eñ#
àð#
ð &ð#
ð "ð#
ð  ð#
ð :ð#
ð 
ó#
ðP !Ø ð )-Ø$(Ø"&Ø<Eñ3
ð ð3
ð ð	3
ð &ð3
ð "ð3
ð  ð3
ð :ð3
ð 
7ó3
ðv )-Ø$(Ø"&Ø<Eñ&
àð&
ð &ð&
ð "ð&
ð  ð&
ð :ð&
ð 
ô&
r*   c                  ó   — e Zd Zdd„Zy)r%   c                ó2  — || _         t        j                  |j                  «      | _        t        j                  |j                  «      | _        t        j                  |j
                  «      | _        t        j                  |j                  «      | _        y ©N)Ú_batchesr   Úto_raw_response_wrapperrG   rT   r`   re   ©r'   Úbatchess     r(   Ú__init__zBatchesWithRawResponse.__init__þ  su   € ØˆŒä&×>Ñ>Ø�N‰Nó
ˆŒô )×@Ñ@Ø×Ñó
ˆŒô %×<Ñ<Ø�L‰Ló
ˆŒ	ô '×>Ñ>Ø�N‰Nó
ˆ�r*   N©r†   r   rf   ÚNone©rq   rr   rs   r‡   ru   r*   r(   r%   r%   ý  ó   „ ô
r*   r%   c                  ó   — e Zd Zdd„Zy)rx   c                ó2  — || _         t        j                  |j                  «      | _        t        j                  |j                  «      | _        t        j                  |j
                  «      | _        t        j                  |j                  «      | _        y r‚   )rƒ   r   Úasync_to_raw_response_wrapperrG   rT   r`   re   r…   s     r(   r‡   z$AsyncBatchesWithRawResponse.__init__  su   € ØˆŒä&×DÑDØ�N‰Nó
ˆŒô )×FÑFØ×Ñó
ˆŒô %×BÑBØ�L‰Ló
ˆŒ	ô '×DÑDØ�N‰Nó
ˆ�r*   N©r†   r    rf   r‰   rŠ   ru   r*   r(   rx   rx     r‹   r*   rx   c                  ó   — e Zd Zdd„Zy)r-   c                óâ   — || _         t        |j                  «      | _        t        |j                  «      | _        t        |j                  «      | _        t        |j
                  «      | _        y r‚   )rƒ   r   rG   rT   r`   re   r…   s     r(   r‡   z%BatchesWithStreamingResponse.__init__"  s]   € ØˆŒä2Ø�N‰Nó
ˆŒô 5Ø×Ñó
ˆŒô 1Ø�L‰Ló
ˆŒ	ô 3Ø�N‰Nó
ˆ�r*   Nrˆ   rŠ   ru   r*   r(   r-   r-   !  r‹   r*   r-   c                  ó   — e Zd Zdd„Zy)rz   c                óâ   — || _         t        |j                  «      | _        t        |j                  «      | _        t        |j                  «      | _        t        |j
                  «      | _        y r‚   )rƒ   r   rG   rT   r`   re   r…   s     r(   r‡   z*AsyncBatchesWithStreamingResponse.__init__4  s]   € ØˆŒä8Ø�N‰Nó
ˆŒô ;Ø×Ñó
ˆŒô 7Ø�L‰Ló
ˆŒ	ô 9Ø�N‰Nó
ˆ�r*   Nr�   rŠ   ru   r*   r(   rz   rz   3  r‹   r*   rz   )1Ú
__future__r   Útypingr   Útyping_extensionsr   Úhttpx2Ú r   Útypesr   r	   Ú_typesr
   r   r   r   r   r   r   Ú_utilsr   r   r   Ú_compatr   Ú	_resourcer   r   Ú	_responser   r   Ú
paginationr   r   Útypes.batchr   Ú_base_clientr   r   Útypes.shared_params.metadatar   Ú__all__r   r    r%   rx   r-   rz   ru   r*   r(   ú<module>r¤      sŽ   ðõ #å Ý %ã å ß :ß J× JÑ Jß JÑ JÝ %ß 9ß Xß 8Ý ß ?Ý 3à�nÐ
%€ôo
ˆoô o
ôdo
Ð#ô o
÷d
ñ 
÷$
ñ 
÷$
ñ 
÷$
ò 
r*   