
    ^=i?                    h   d dl mZ d dlmZmZ d dl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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mZmZmZ ddlm Z  ddl!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)DictOptional)LiteralN   )batch_create_params)BodyOmitQueryHeadersNotGivenomit	not_given)maybe_transformasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_raw_response_wrapperto_streamed_response_wrapperasync_to_raw_response_wrapper"async_to_streamed_response_wrapper)make_request_options)BatchListResponse)BatchCancelResponse)BatchCreateResponse)BatchRetrieveResponseBatchesAsyncBatchesc                      e Zd Zed
d       Zedd       Zeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddded	 	 	 	 	 	 	 	 	 	 	 ddZ	ddded	 	 	 	 	 	 	 	 	 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 raw response object instead of the parsed content.

        For more information, see https://www.github.com/groq/groq-python#accessing-raw-response-data-eg-headers
        )BatchesWithRawResponseselfs    S/home/rose/Desktop/poly/venv/lib/python3.12/site-packages/groq/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/groq/groq-python#with_streaming_response
        )BatchesWithStreamingResponser$   s    r&   with_streaming_responsezBatches.with_streaming_response)   s     ,D11r(   Nmetadataextra_headersextra_query
extra_bodytimeoutc          
         | j                  dt        ||||dt        j                        t	        ||||      t
              S )_  
        Creates and executes a batch from an uploaded file of requests.
        [Learn more](/docs/batch).

        Args:
          completion_window: The time frame within which the batch should be processed. Durations from `24h`
              to `7d` are supported.

          endpoint: The endpoint to be used for all requests in the batch. Currently
              `/v1/chat/completions` is supported.

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

              See [upload file](/docs/api-reference#files-upload) for how to upload a file.

              Your input file must be formatted as a [JSONL file](/docs/batch), and must be
              uploaded with the purpose `batch`. The file 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
        /openai/v1/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&   createzBatches.create2   s\    T zz  ): (%2 (	 $55 )+Q[el (  
 	
r(   r:   c          	     r    |st        d|      | j                  d| t        ||||      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 /openai/v1/batches/r:   r=   r>   
ValueError_getr   r   r%   batch_idr/   r0   r1   r2   s         r&   retrievezBatches.retrievem   sT    . VW_Vbcddyy!(,(+Q[el *  
 	
r(   c          	     L    | j                  dt        ||||      t              S )!List your organization's batches.r5   r:   rG   rJ   r   r   r%   r/   r0   r1   r2   s        r&   listzBatches.list   s5     yy (+Q[el &  
 	
r(   c          	     t    |st        d|      | j                  d| dt        ||||      t              S )D  
        Cancels 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
        rE   rF   /cancelr:   rG   rI   r?   r   r   rK   s         r&   cancelzBatches.cancel   sV    . VW_Vbcddzz!(73(+Q[el (  
 	
r(   )returnr#   )rX   r+   r7   strr8   zLiteral['/v1/chat/completions']r9   rZ   r.   zOptional[Dict[str, str]] | Omitr/   Headers | Noner0   Query | Noner1   Body | Noner2   'float | httpx.Timeout | None | NotGivenrX   r   rL   rZ   r/   r[   r0   r\   r1   r]   r2   r^   rX   r   
r/   r[   r0   r\   r1   r]   r2   r^   rX   r   rL   rZ   r/   r[   r0   r\   r1   r]   r2   r^   rX   r   __name__
__module____qualname__r   r'   r,   r   r   rB   rM   rR   rW    r(   r&   r   r      s{   , , 2 2 59 )-$("&;D9
 9
 2	9

 9
 29
 &9
 "9
  9
 99
 
9
B )-$("&;D

 &
 "
  
 9
 

L )-$("&;D

 &
 "
  
 9
 

2 )-$("&;D

 &
 "
  
 9
 

r(   c                      e Zd Zed
d       Zedd       Zeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddded	 	 	 	 	 	 	 	 	 	 	 ddZ	ddded	 	 	 	 	 	 	 	 	 ddZ
ddded	 	 	 	 	 	 	 	 	 	 	 dd	Zy)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	        ||||      t
               d{   S 7 $7 w)r4   r5   r6   Nr:   r;   )r?   r   r   r@   r   r   rA   s	            r&   rB   zAsyncBatches.create   su     T ZZ ,): (%2 (	 $55  )+Q[el (   
 
 	

s!   /AA
AAAAr:   c          	        K   |st        d|      | j                  d| t        ||||      t               d{   S 7 w)rD   rE   rF   r:   rG   NrH   rK   s         r&   rM   zAsyncBatches.retrieve  sb     . VW_VbcddYY!(,(+Q[el *  
 
 	
 
s   <AAAc          	     h   K   | j                  dt        ||||      t               d{   S 7 w)rO   r5   r:   rG   NrP   rQ   s        r&   rR   zAsyncBatches.list3  sC      YY (+Q[el &  
 
 	
 
s   )202c          	        K   |st        d|      | j                  d| dt        ||||      t               d{   S 7 w)rT   rE   rF   rU   r:   rG   NrV   rK   s         r&   rW   zAsyncBatches.cancelF  sd     . VW_VbcddZZ!(73(+Q[el (   
 
 	
 
s   =AA A)rX   ri   )rX   rk   rY   r_   r`   ra   rb   rf   r(   r&   r   r      s{   1 1 7 7 59 )-$("&;D9
 9
 2	9

 9
 29
 &9
 "9
  9
 99
 
9
B )-$("&;D

 &
 "
  
 9
 

L )-$("&;D

 &
 "
  
 9
 

2 )-$("&;D

 &
 "
  
 9
 

r(   c                      e Zd ZddZy)r#   c                    || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        y N)_batchesr   rB   rM   rR   rW   r%   batchess     r&   __init__zBatchesWithRawResponse.__init__i  s]    -NN
 0
 ,LL
	 .NN
r(   Nru   r   rX   Nonerc   rd   re   rv   rf   r(   r&   r#   r#   h      
r(   r#   c                      e Zd ZddZy)ri   c                    || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        y rr   )rs   r   rB   rM   rR   rW   rt   s     r&   rv   z$AsyncBatchesWithRawResponse.__init__{  s]    3NN
 6
 2LL
	 4NN
r(   Nru   r   rX   rx   ry   rf   r(   r&   ri   ri   z  rz   r(   ri   c                      e Zd ZddZy)r+   c                    || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        y rr   )rs   r   rB   rM   rR   rW   rt   s     r&   rv   z%BatchesWithStreamingResponse.__init__  s]    2NN
 5
 1LL
	 3NN
r(   Nrw   ry   rf   r(   r&   r+   r+     rz   r(   r+   c                      e Zd ZddZy)rk   c                    || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        y rr   )rs   r   rB   rM   rR   rW   rt   s     r&   rv   z*AsyncBatchesWithStreamingResponse.__init__  s]    8NN
 ;
 7LL
	 9NN
r(   Nr}   ry   rf   r(   r&   rk   rk     rz   r(   rk   )0
__future__r   typingr   r   typing_extensionsr   httpxtypesr   _typesr	   r
   r   r   r   r   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   r   r   _base_clientr   types.batch_list_responser   types.batch_cancel_responser   types.batch_create_responser   types.batch_retrieve_responser   __all__r   r   r#   ri   r+   rk   rf   r(   r&   <module>r      s    # ! %  ' J J J ; % 9  0 9 = = An
%b
o b
Jb
# b
J
 
$
 
$
 
$
 
r(   