o
    i5@                     @  sH  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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 deZ+G dd deZ,G dd dZ-G dd dZ.G dd dZ/G dd dZ0dS )    )annotations)DictOptional)LiteralN   )batch_create_params)BodyOmitQueryHeadersNotGivenomit	not_given)path_template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dZed(ddZeddded	d)ddZdddedd*dd Z	dddedd+d"d#Z
dddedd,d%d&ZdS )-r   returnBatchesWithRawResponsec                 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
        )r"   self r'   P/home/kim/smarthome/.venv/lib/python3.10/site-packages/groq/resources/batches.pywith_raw_response      zBatches.with_raw_responseBatchesWithStreamingResponsec                 C  r#   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
        )r+   r%   r'   r'   r(   with_streaming_response)      zBatches.with_streaming_responseNmetadataextra_headersextra_query
extra_bodytimeoutcompletion_windowstrendpointLiteral['/v1/chat/completions']input_file_idr0   Optional[Dict[str, str]] | Omitr1   Headers | Noner2   Query | Noner3   Body | Noner4   'float | httpx.Timeout | None | NotGivenr   c          	   	   C  s0   | j dt||||dtjt||||dtd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r5   r7   r9   r0   r1   r2   r3   r4   bodyoptionscast_to)_postr   r   BatchCreateParamsr   r   	r&   r5   r7   r9   r0   r1   r2   r3   r4   r'   r'   r(   create2   s   *	zBatches.createrB   batch_idr   c                C  6   |s	t d|| jtd|dt||||dtd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/{batch_id}rK   rB   rE   rF   
ValueError_getr   r   r   r&   rK   r1   r2   r3   r4   r'   r'   r(   retrievem      
zBatches.retriever   c                C  s   | j dt||||dtdS )!List your organization's batches.r@   rB   rQ   rT   r   r   r&   r1   r2   r3   r4   r'   r'   r(   list   s   zBatches.listr   c                C  rL   )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
        rN   $/openai/v1/batches/{batch_id}/cancelrP   rB   rQ   rS   rG   r   r   r   rU   r'   r'   r(   cancel   rW   zBatches.cancel)r!   r"   )r!   r+   r5   r6   r7   r8   r9   r6   r0   r:   r1   r;   r2   r<   r3   r=   r4   r>   r!   r   rK   r6   r1   r;   r2   r<   r3   r=   r4   r>   r!   r   
r1   r;   r2   r<   r3   r=   r4   r>   r!   r   rK   r6   r1   r;   r2   r<   r3   r=   r4   r>   r!   r   __name__
__module____qualname__r   r)   r-   r   r   rJ   rV   r[   r_   r'   r'   r'   r(   r      4    	A&c                   @  r    )-r   r!   AsyncBatchesWithRawResponsec                 C  r#   r$   )ri   r%   r'   r'   r(   r)      r*   zAsyncBatches.with_raw_response!AsyncBatchesWithStreamingResponsec                 C  r#   r,   )rj   r%   r'   r'   r(   r-      r.   z$AsyncBatches.with_streaming_responseNr/   r5   r6   r7   r8   r9   r0   r:   r1   r;   r2   r<   r3   r=   r4   r>   r   c          	   	     s>   | j dt||||dtjI dH t||||dtdI dH S )r?   r@   rA   NrB   rC   )rG   r   r   rH   r   r   rI   r'   r'   r(   rJ      s    *	zAsyncBatches.createrB   rK   r   c                  >   |s
t d|| jtd|dt||||dtdI dH S )rM   rN   rO   rP   rB   rQ   NrR   rU   r'   r'   r(   rV        
zAsyncBatches.retriever   c                  s$   | j dt||||dtdI dH S )rX   r@   rB   rQ   NrY   rZ   r'   r'   r(   r[   3  s   zAsyncBatches.listr   c                  rk   )r\   rN   r]   rP   rB   rQ   Nr^   rU   r'   r'   r(   r_   F  rl   zAsyncBatches.cancel)r!   ri   )r!   rj   r`   ra   rb   rc   rd   r'   r'   r'   r(   r      rh   c                   @     e Zd ZdddZdS )	r"   batchesr   r!   Nonec                 C  :   || _ t|j| _t|j| _t|j| _t|j| _d S N)_batchesr   rJ   rV   r[   r_   r&   rn   r'   r'   r(   __init__i     
zBatchesWithRawResponse.__init__Nrn   r   r!   ro   re   rf   rg   rt   r'   r'   r'   r(   r"   h      r"   c                   @  rm   )	ri   rn   r   r!   ro   c                 C  rp   rq   )rr   r   rJ   rV   r[   r_   rs   r'   r'   r(   rt   {  ru   z$AsyncBatchesWithRawResponse.__init__Nrn   r   r!   ro   rw   r'   r'   r'   r(   ri   z  rx   ri   c                   @  rm   )	r+   rn   r   r!   ro   c                 C  rp   rq   )rr   r   rJ   rV   r[   r_   rs   r'   r'   r(   rt     ru   z%BatchesWithStreamingResponse.__init__Nrv   rw   r'   r'   r'   r(   r+     rx   r+   c                   @  rm   )	rj   rn   r   r!   ro   c                 C  rp   rq   )rr   r   rJ   rV   r[   r_   rs   r'   r'   r(   rt     ru   z*AsyncBatchesWithStreamingResponse.__init__Nry   rw   r'   r'   r'   r(   rj     rx   rj   )1
__future__r   typingr   r   Ztyping_extensionsr   Zhttpxtypesr   _typesr   r	   r
   r   r   r   r   Z_utilsr   r   r   Z_compatr   Z	_resourcer   r   	_responser   r   r   r   Z_base_clientr   Ztypes.batch_list_responser   Ztypes.batch_cancel_responser   Ztypes.batch_create_responser   Ztypes.batch_retrieve_responser   __all__r   r   r"   ri   r+   rj   r'   r'   r'   r(   <module>   s0   $ & &