o
    ?0mh?                     @  s<  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 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)	NOT_GIVENBodyQueryHeadersNotGiven)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$   d/var/www/html/tas-one-backend/ai_backend/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]] | NotGivenr.   Headers | Noner/   Query | Noner0   Body | Noner1   '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r2   r4   r6   r-   r.   r/   r0   r1   bodyoptionscast_to)_postr   r   BatchCreateParamsr   r   	r#   r2   r4   r6   r-   r.   r/   r0   r1   r$   r$   r%   create2   s   *	zBatches.creater?   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/r?   rB   rC   
ValueError_getr   r   r#   rH   r.   r/   r0   r1   r$   r$   r%   retrievem   s   zBatches.retriever   c                C  s   | j dt||||dtdS )!List your organization's batches.r=   r?   rL   rO   r   r   r#   r.   r/   r0   r1   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
        rJ   rK   /cancelr?   rL   rN   rD   r   r   rP   r$   r$   r%   cancel   s   
zBatches.cancel)r   r   )r   r(   r2   r3   r4   r5   r6   r3   r-   r7   r.   r8   r/   r9   r0   r:   r1   r;   r   r   rH   r3   r.   r8   r/   r9   r0   r:   r1   r;   r   r   
r.   r8   r/   r9   r0   r:   r1   r;   r   r   rH   r3   r.   r8   r/   r9   r0   r:   r1   r;   r   r   __name__
__module____qualname__r   r&   r*   r   rG   rQ   rU   rY   r$   r$   r$   r%   r      4    	A&c                   @  r   )-r   r   AsyncBatchesWithRawResponsec                 C  r    r!   )rc   r"   r$   r$   r%   r&      r'   zAsyncBatches.with_raw_response!AsyncBatchesWithStreamingResponsec                 C  r    r)   )rd   r"   r$   r$   r%   r*      r+   z$AsyncBatches.with_streaming_responseNr,   r2   r3   r4   r5   r6   r-   r7   r.   r8   r/   r9   r0   r:   r1   r;   r   c          	   	     s>   | j dt||||dtjI dH t||||dtdI dH S )r<   r=   r>   Nr?   r@   )rD   r   r   rE   r   r   rF   r$   r$   r%   rG      s    *	zAsyncBatches.creater?   rH   r   c                  s<   |s
t d|| jd| t||||dtdI dH S )rI   rJ   rK   r?   rL   NrM   rP   r$   r$   r%   rQ     s   zAsyncBatches.retriever   c                  s$   | j dt||||dtdI dH S )rR   r=   r?   rL   NrS   rT   r$   r$   r%   rU   3  s   zAsyncBatches.listr   c                  s>   |s
t d|| jd| dt||||dtdI dH S )rV   rJ   rK   rW   r?   rL   NrX   rP   r$   r$   r%   rY   F  s   
zAsyncBatches.cancel)r   rc   )r   rd   rZ   r[   r\   r]   r^   r$   r$   r$   r%   r      rb   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   rG   rQ   rU   rY   r#   rf   r$   r$   r%   __init__i     
zBatchesWithRawResponse.__init__Nrf   r   r   rg   r_   r`   ra   rl   r$   r$   r$   r%   r   h      r   c                   @  re   )	rc   rf   r   r   rg   c                 C  rh   ri   )rj   r   rG   rQ   rU   rY   rk   r$   r$   r%   rl   {  rm   z$AsyncBatchesWithRawResponse.__init__Nrf   r   r   rg   ro   r$   r$   r$   r%   rc   z  rp   rc   c                   @  re   )	r(   rf   r   r   rg   c                 C  rh   ri   )rj   r   rG   rQ   rU   rY   rk   r$   r$   r%   rl     rm   z%BatchesWithStreamingResponse.__init__Nrn   ro   r$   r$   r$   r%   r(     rp   r(   c                   @  re   )	rd   rf   r   r   rg   c                 C  rh   ri   )rj   r   rG   rQ   rU   rY   rk   r$   r$   r%   rl     rm   z*AsyncBatchesWithStreamingResponse.__init__Nrq   ro   r$   r$   r$   r%   rd     rp   rd   ).
__future__r   typingr   r   typing_extensionsr   httpxtypesr   _typesr   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   rc   r(   rd   r$   r$   r$   r%   <module>   s0    & &