
    IiH                    X   S SK J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  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J r   SSK!J"r"  SSK#J$r$J%r%  SS/r& " S S\5      r' " S S\5      r( " S S5      r) " S S5      r* " S S5      r+ " S S5      r,g)    )annotations)DictOptional)LiteralN   )_legacy_response)batch_list_paramsbatch_create_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)SyncCursorPageAsyncCursorPage)Batch)AsyncPaginatormake_request_optionsBatchesAsyncBatchesc                  
   \ 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rg)r      c                    [        U 5      $ N)BatchesWithRawResponseselfs    >/venv/lib/python3.13/site-packages/openai/resources/batches.pywith_raw_responseBatches.with_raw_response   s    %d++    c                    [        U 5      $ r!   )BatchesWithStreamingResponser#   s    r%   with_streaming_responseBatches.with_streaming_response#   s    +D11r(   Nmetadataextra_headersextra_query
extra_bodytimeoutc               x    U R                  S[        UUUUS.[        R                  5      [	        XVXxS9[
        S9$ )  
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/chat/completions`, `/v1/embeddings`, and `/v1/completions` 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://platform.openai.com/docs/api-reference/files/create)
      for how to upload a file.

      Your input file must be formatted as a
      [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input),
      and must be uploaded with the purpose `batch`. The file can contain up to 50,000
      requests, and can be up to 100 MB in size.

  metadata: Optional custom metadata for the 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_idr.   r/   r0   r1   r2   bodyoptionscast_to)_postr   r
   BatchCreateParamsr   r   	r$   r7   r8   r9   r.   r/   r0   r1   r2   s	            r%   createBatches.create'   sW    \ zz ): (%2 (	 $55 )+Q[   
 	
r(   r:   c          
     n    U(       d  [        SU< 35      eU R                  SU 3[        X#XES9[        S9$ )  
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/r:   r=   r>   
ValueError_getr   r   r$   batch_idr/   r0   r1   r2   s         r%   retrieveBatches.retrievef   sO    . VW_Vbcddyyz"(+Q[   
 	
r(   afterlimitr/   r0   r1   r2   c                   U R                  S[        [           [        UUUU[	        UUS.[
        R                  5      S9[        S9$ 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
r5   )rQ   rR   )r/   r0   r1   r2   query)pager=   model)_get_api_listr   r   r   r   r	   BatchListParamsr$   rQ   rR   r/   r0   r1   r2   s          r%   listBatches.list   s_    B !!&(+'%%!&!& &55 ! " 
 	
r(   c          
     p    U(       d  [        SU< 35      eU R                  SU S3[        X#XES9[        S9$ )  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
rF   rG   /cancelr:   rH   rJ   r?   r   r   rL   s         r%   cancelBatches.cancel   sQ    4 VW_Vbcddzzz)(+Q[   
 	
r(    )returnr"   )rd   r*   r7   zLiteral['24h']r8   zDLiteral['/v1/chat/completions', '/v1/embeddings', '/v1/completions']r9   strr.   z#Optional[Dict[str, str]] | NotGivenr/   Headers | Noner0   Query | Noner1   Body | Noner2   'float | httpx.Timeout | None | NotGivenrd   r   rM   rf   r/   rg   r0   rh   r1   ri   r2   rj   rd   r   )rQ   str | NotGivenrR   int | NotGivenr/   rg   r0   rh   r1   ri   r2   rj   rd   zSyncCursorPage[Batch]__name__
__module____qualname____firstlineno__r   r&   r+   r   rB   rN   r[   ra   __static_attributes__rc   r(   r%   r   r      s   , , 2 2 9B )-$("&;D=
 *=
 W	=

 =
 6=
 &=
 "=
  =
 9=
 
=
J )-$("&;D

 &
 "
  
 9
 

H !* ) )-$("&;D2
 2
 	2
 &2
 "2
  2
 92
 
2
t )-$("&;D"
"
 &"
 ""
  "
 9"
 
"
 "
r(   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rg)r      c                    [        U 5      $ r!   )AsyncBatchesWithRawResponser#   s    r%   r&   AsyncBatches.with_raw_response   s    *400r(   c                    [        U 5      $ r!   )!AsyncBatchesWithStreamingResponser#   s    r%   r+   $AsyncBatches.with_streaming_response   s    066r(   Nr-   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)r4   r5   r6   Nr:   r;   )r?   r   r
   r@   r   r   rA   s	            r%   rB   AsyncBatches.create   sn     \ ZZ,): (%2 (	 $55  )+Q[    
 
 	

s!   /AA
A	A
AAr:   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)rE   rF   rG   r:   rH   NrI   rL   s         r%   rN   AsyncBatches.retrieve(  s\     . VW_VbcddYYz"(+Q[   
 
 	
 
s   :AAArP   c                   U R                  S[        [           [        UUUU[	        UUS.[
        R                  5      S9[        S9$ rT   )rX   r   r   r   r   r	   rY   rZ   s          r%   r[   AsyncBatches.listI  s_    B !! '(+'%%!&!& &55 ! " 
 	
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)r^   rF   rG   r_   r:   rH   Nr`   rL   s         r%   ra   AsyncBatches.cancel}  s^     4 VW_VbcddZZz)(+Q[    
 
 	
 
s   ;AAArc   )rd   rw   )rd   rz   re   rk   )rQ   rl   rR   rm   r/   rg   r0   rh   r1   ri   r2   rj   rd   z-AsyncPaginator[Batch, AsyncCursorPage[Batch]]rn   rc   r(   r%   r   r      s   1 1 7 7 9B )-$("&;D=
 *=
 W	=

 =
 6=
 &=
 "=
  =
 9=
 
=
J )-$("&;D

 &
 "
  
 9
 

H !* ) )-$("&;D2
 2
 	2
 &2
 "2
  2
 92
 
72
t )-$("&;D"
"
 &"
 ""
  "
 9"
 
"
 "
r(   c                      \ rS rSrSS jrSrg)r"   i  c                8   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        g r!   )_batchesr   to_raw_response_wrapperrB   rN   r[   ra   r$   batchess     r%   __init__BatchesWithRawResponse.__init__  ss    &>>NN
 )@@
 %<<LL
	 '>>NN
r(   r   ra   rB   r[   rN   Nr   r   rd   Nonero   rp   rq   rr   r   rs   rc   r(   r%   r"   r"         
r(   r"   c                      \ rS rSrSS jrSrg)rw   i  c                8   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        g r!   )r   r   async_to_raw_response_wrapperrB   rN   r[   ra   r   s     r%   r   $AsyncBatchesWithRawResponse.__init__  ss    &DDNN
 )FF
 %BBLL
	 'DDNN
r(   r   Nr   r   rd   r   r   rc   r(   r%   rw   rw     r   r(   rw   c                      \ rS rSrSS jrSrg)r*   i  c                    X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   rB   rN   r[   ra   r   s     r%   r   %BatchesWithStreamingResponse.__init__  s[    2NN
 5
 1LL
	 3NN
r(   r   Nr   r   rc   r(   r%   r*   r*     r   r(   r*   c                      \ rS rSrSS jrSrg)rz   i  c                    X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   rB   rN   r[   ra   r   s     r%   r   *AsyncBatchesWithStreamingResponse.__init__  s[    8NN
 ;
 7LL
	 9NN
r(   r   Nr   r   rc   r(   r%   rz   rz     r   r(   rz   )-
__future__r   typingr   r   typing_extensionsr   httpx r   typesr	   r
   _typesr   r   r   r   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   types.batchr   _base_clientr   r   __all__r   r   r"   rw   r*   rz   rc   r(   r%   <module>r      s    # ! %   : > > & 9 X 8 
 n
%
o 
D
# 
D
 
$
 
$
 
$
 
r(   