o
    hq?                     @  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$   j/var/www/html/construction_image-detection-poc/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Literal['24h']endpointLiteral['/v1/chat/completions']input_file_idstrr-   #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 )2  
        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` 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%   create5   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@   rC   rD   
ValueError_getr   r   r#   rI   r.   r/   r0   r1   r$   r$   r%   retrieveo   s   zBatches.retriever   c                C  s   | j dt||||dtdS )!List your organization's batches.r>   r@   rM   rP   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
        rK   rL   /cancelr@   rM   rO   rE   r   r   rQ   r$   r$   r%   cancel   s   
zBatches.cancel)r   r   )r   r(   r2   r3   r4   r5   r6   r7   r-   r8   r.   r9   r/   r:   r0   r;   r1   r<   r   r   rI   r7   r.   r9   r/   r:   r0   r;   r1   r<   r   r   
r.   r9   r/   r:   r0   r;   r1   r<   r   r   rI   r7   r.   r9   r/   r:   r0   r;   r1   r<   r   r   __name__
__module____qualname__r   r&   r*   r   rH   rR   rV   rZ   r$   r$   r$   r%   r   !   4    	@&c                   @  r   ).r   r   AsyncBatchesWithRawResponsec                 C  r    r!   )rd   r"   r$   r$   r%   r&      r'   zAsyncBatches.with_raw_response!AsyncBatchesWithStreamingResponsec                 C  r    r)   )re   r"   r$   r$   r%   r*      r+   z$AsyncBatches.with_streaming_responseNr,   r2   r3   r4   r5   r6   r7   r-   r8   r.   r9   r/   r:   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@   rA   )rE   r   r   rF   r   r   rG   r$   r$   r%   rH      s    )	zAsyncBatches.creater@   rI   r   c                  s<   |s
t d|| jd| t||||dtdI dH S )rJ   rK   rL   r@   rM   NrN   rQ   r$   r$   r%   rR     s   zAsyncBatches.retriever   c                  s$   | j dt||||dtdI dH S )rS   r>   r@   rM   NrT   rU   r$   r$   r%   rV   4  s   zAsyncBatches.listr   c                  s>   |s
t d|| jd| dt||||dtdI dH S )rW   rK   rL   rX   r@   rM   NrY   rQ   r$   r$   r%   rZ   G  s   
zAsyncBatches.cancel)r   rd   )r   re   r[   r\   r]   r^   r_   r$   r$   r$   r%   r      rc   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   rH   rR   rV   rZ   r#   rg   r$   r$   r%   __init__j     
zBatchesWithRawResponse.__init__Nrg   r   r   rh   r`   ra   rb   rm   r$   r$   r$   r%   r   i      r   c                   @  rf   )	rd   rg   r   r   rh   c                 C  ri   rj   )rk   r   rH   rR   rV   rZ   rl   r$   r$   r%   rm   |  rn   z$AsyncBatchesWithRawResponse.__init__Nrg   r   r   rh   rp   r$   r$   r$   r%   rd   {  rq   rd   c                   @  rf   )	r(   rg   r   r   rh   c                 C  ri   rj   )rk   r   rH   rR   rV   rZ   rl   r$   r$   r%   rm     rn   z%BatchesWithStreamingResponse.__init__Nro   rp   r$   r$   r$   r%   r(     rq   r(   c                   @  rf   )	re   rg   r   r   rh   c                 C  ri   rj   )rk   r   rH   rR   rV   rZ   rl   r$   r$   r%   rm     rn   z*AsyncBatchesWithStreamingResponse.__init__Nrr   rp   r$   r$   r$   r%   re     rq   re   ).
__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   rd   r(   re   r$   r$   r$   r%   <module>   s0    % %