o
    i?                     @  sD  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 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Z/dS )    )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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&   \/var/www/html/karishye-ai-python/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_idr/   Optional[Dict[str, str]] | Omitr0   Headers | Noner1   Query | Noner2   Body | Noner3   '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r4   r6   r8   r/   r0   r1   r2   r3   bodyoptionscast_to)_postr   r   BatchCreateParamsr   r   	r%   r4   r6   r8   r/   r0   r1   r2   r3   r&   r&   r'   create2   s   *	zBatches.createrA   batch_idr   c                C  s4   |s	t d|| j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/rA   rD   rE   
ValueError_getr   r   r%   rJ   r0   r1   r2   r3   r&   r&   r'   retrievem   s   zBatches.retriever   c                C  s   | j dt||||dtdS )!List your organization's batches.r?   rA   rN   rQ   r   r   r%   r0   r1   r2   r3   r&   r&   r'   list   s   zBatches.listr   c                C  s6   |s	t d|| jd| dt||||dtd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
        rL   rM   /cancelrA   rN   rP   rF   r   r   rR   r&   r&   r'   cancel   s   
zBatches.cancel)r    r!   )r    r*   r4   r5   r6   r7   r8   r5   r/   r9   r0   r:   r1   r;   r2   r<   r3   r=   r    r   rJ   r5   r0   r:   r1   r;   r2   r<   r3   r=   r    r   
r0   r:   r1   r;   r2   r<   r3   r=   r    r   rJ   r5   r0   r:   r1   r;   r2   r<   r3   r=   r    r   __name__
__module____qualname__r   r(   r,   r   r   rI   rS   rW   r[   r&   r&   r&   r'   r      4    	A&c                   @  r   )-r   r    AsyncBatchesWithRawResponsec                 C  r"   r#   )re   r$   r&   r&   r'   r(      r)   zAsyncBatches.with_raw_response!AsyncBatchesWithStreamingResponsec                 C  r"   r+   )rf   r$   r&   r&   r'   r,      r-   z$AsyncBatches.with_streaming_responseNr.   r4   r5   r6   r7   r8   r/   r9   r0   r:   r1   r;   r2   r<   r3   r=   r   c          	   	     s>   | j dt||||dtjI dH t||||dtdI dH S )r>   r?   r@   NrA   rB   )rF   r   r   rG   r   r   rH   r&   r&   r'   rI      s    *	zAsyncBatches.createrA   rJ   r   c                  s<   |s
t d|| jd| t||||dtdI dH S )rK   rL   rM   rA   rN   NrO   rR   r&   r&   r'   rS     s   zAsyncBatches.retriever   c                  s$   | j dt||||dtdI dH S )rT   r?   rA   rN   NrU   rV   r&   r&   r'   rW   3  s   zAsyncBatches.listr   c                  s>   |s
t d|| jd| dt||||dtdI dH S )rX   rL   rM   rY   rA   rN   NrZ   rR   r&   r&   r'   r[   F  s   
zAsyncBatches.cancel)r    re   )r    rf   r\   r]   r^   r_   r`   r&   r&   r&   r'   r      rd   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   rI   rS   rW   r[   r%   rh   r&   r&   r'   __init__i     
zBatchesWithRawResponse.__init__Nrh   r   r    ri   ra   rb   rc   rn   r&   r&   r&   r'   r!   h      r!   c                   @  rg   )	re   rh   r   r    ri   c                 C  rj   rk   )rl   r   rI   rS   rW   r[   rm   r&   r&   r'   rn   {  ro   z$AsyncBatchesWithRawResponse.__init__Nrh   r   r    ri   rq   r&   r&   r&   r'   re   z  rr   re   c                   @  rg   )	r*   rh   r   r    ri   c                 C  rj   rk   )rl   r   rI   rS   rW   r[   rm   r&   r&   r'   rn     ro   z%BatchesWithStreamingResponse.__init__Nrp   rq   r&   r&   r&   r'   r*     rr   r*   c                   @  rg   )	rf   rh   r   r    ri   c                 C  rj   rk   )rl   r   rI   rS   rW   r[   rm   r&   r&   r'   rn     ro   z*AsyncBatchesWithStreamingResponse.__init__Nrs   rq   r&   r&   r&   r'   rf     rr   rf   )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!   re   r*   rf   r&   r&   r&   r'   <module>   s0   $ & &