U
    &Jj?                     @  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                   @  s   e Zd ZeddddZeddddZeddded	d
dd
ddddddd	ddZdddedd
ddddddddZ	dddedddddddddZ
dddedd
dddddddd ZdS )!r   BatchesWithRawResponsereturnc                 C  s   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%   w/var/www/api.dyntland.com/public_html/python_social_comments/venv/lib/python3.8/site-packages/groq/resources/batches.pywith_raw_response   s    zBatches.with_raw_responseBatchesWithStreamingResponsec                 C  s   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
        )r(   r#   r%   r%   r&   with_streaming_response)   s    zBatches.with_streaming_responseNmetadataextra_headersextra_query
extra_bodytimeoutstrLiteral['/v1/chat/completions']Optional[Dict[str, str]] | OmitHeaders | NoneQuery | NoneBody | None'float | httpx.Timeout | None | NotGivenr   	completion_windowendpointinput_file_idr,   r-   r.   r/   r0   r!   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r9   r:   r;   r,   r-   r.   r/   r0   bodyoptionscast_to)_postr   r   BatchCreateParamsr   r   	r$   r9   r:   r;   r,   r-   r.   r/   r0   r%   r%   r&   create2   s$    *	   zBatches.creater?   r   batch_idr-   r.   r/   r0   r!   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$   rI   r-   r.   r/   r0   r%   r%   r&   retrievem   s       zBatches.retriever   r-   r.   r/   r0   r!   c                C  s   | j dt||||dtdS )!List your organization's batches.r=   r?   rM   rP   r   r   r$   r-   r.   r/   r0   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   rD   r   r   rQ   r%   r%   r&   cancel   s    
   zBatches.cancel__name__
__module____qualname__r   r'   r*   r   r   rG   rR   rW   r[   r%   r%   r%   r&   r      s2   	"A&c                   @  s   e Zd ZeddddZeddddZeddded	d
dd
ddddddd	ddZdddedd
ddddddddZ	dddedddddddddZ
dddedd
dddddddd ZdS )!r   AsyncBatchesWithRawResponser    c                 C  s   t | S r"   )r`   r#   r%   r%   r&   r'      s    zAsyncBatches.with_raw_response!AsyncBatchesWithStreamingResponsec                 C  s   t | S r)   )ra   r#   r%   r%   r&   r*      s    z$AsyncBatches.with_streaming_responseNr+   r1   r2   r3   r4   r5   r6   r7   r   r8   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?   r   rH   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   rS   c                  s"   | j dt||||dtdI dH S )rT   r=   r?   rM   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   rK   rL   rY   r?   rM   NrZ   rQ   r%   r%   r&   r[   F  s    
   zAsyncBatches.cancelr\   r%   r%   r%   r&   r      s2   	"A&c                   @  s   e Zd ZdddddZdS )r   r   Nonebatchesr!   c                 C  s:   || _ t|j| _t|j| _t|j| _t|j| _d S N)_batchesr   rG   rR   rW   r[   r$   rd   r%   r%   r&   __init__i  s    zBatchesWithRawResponse.__init__Nr]   r^   r_   rh   r%   r%   r%   r&   r   h  s   r   c                   @  s   e Zd ZdddddZdS )r`   r   rb   rc   c                 C  s:   || _ t|j| _t|j| _t|j| _t|j| _d S re   )rf   r   rG   rR   rW   r[   rg   r%   r%   r&   rh   {  s    z$AsyncBatchesWithRawResponse.__init__Nri   r%   r%   r%   r&   r`   z  s   r`   c                   @  s   e Zd ZdddddZdS )r(   r   rb   rc   c                 C  s:   || _ t|j| _t|j| _t|j| _t|j| _d S re   )rf   r   rG   rR   rW   r[   rg   r%   r%   r&   rh     s    z%BatchesWithStreamingResponse.__init__Nri   r%   r%   r%   r&   r(     s   r(   c                   @  s   e Zd ZdddddZdS )ra   r   rb   rc   c                 C  s:   || _ t|j| _t|j| _t|j| _t|j| _d S re   )rf   r   rG   rR   rW   r[   rg   r%   r%   r&   rh     s    z*AsyncBatchesWithStreamingResponse.__init__Nri   r%   r%   r%   r&   ra     s   ra   )0
__future__r   typingr   r   typing_extensionsr   Zhttpxtypesr   _typesr   r	   r
   r   r   r   r   Z_utilsr   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   r`   r(   ra   r%   r%   r%   r&   <module>   s.   $ & &