§
    Ý
@gzL  ã                  ó~  — 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 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 ddlmZm Z  ddl!m"Z" ddl#m$Z$m%Z% ddgZ& G d„ de¦  «        Z' G d„ de¦  «        Z( G d„ d¦  «        Z) G d„ d¦  «        Z* G d„ d¦  «        Z+ G d„ d¦  «        Z,dS )é    )Úannotations)ÚDictÚOptional)ÚLiteralNé   )Ú_legacy_response)Úbatch_list_paramsÚbatch_create_params)Ú	NOT_GIVENÚBodyÚQueryÚHeadersÚNotGiven)Úmaybe_transformÚasync_maybe_transform)Úcached_property)ÚSyncAPIResourceÚAsyncAPIResource)Úto_streamed_response_wrapperÚ"async_to_streamed_response_wrapper)ÚSyncCursorPageÚAsyncCursorPage)ÚBatch)ÚAsyncPaginatorÚmake_request_optionsÚBatchesÚAsyncBatchesc                  ó”   — e Zd Zed%d„¦   «         Zed&d„¦   «         Zedddedœd'd„Zdddedœd(d„Zeedddedœd)d#„Z	dddedœd(d$„Z
dS )*r   ÚreturnÚBatchesWithRawResponsec                ó    — t          | ¦  «        S ©a  
        This property can be used as a prefix for any HTTP method call to return the
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
        )r    ©Úselfs    úL/var/www/piapp/venv/lib/python3.11/site-packages/openai/resources/batches.pyÚwith_raw_responsezBatches.with_raw_response   s   € õ & dÑ+Ô+Ð+ó    ÚBatchesWithStreamingResponsec                ó    — 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/openai/openai-python#with_streaming_response
        )r(   r#   s    r%   Úwith_streaming_responsezBatches.with_streaming_response)   s   € õ ,¨DÑ1Ô1Ð1r'   N©ÚmetadataÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutÚcompletion_windowúLiteral['24h']ÚendpointúDLiteral['/v1/chat/completions', '/v1/embeddings', '/v1/completions']Úinput_file_idÚstrr-   ú#Optional[Dict[str, str]] | NotGivenr.   úHeaders | Noner/   úQuery | Noner0   úBody | Noner1   ú'float | httpx.Timeout | None | NotGivenr   c          
     óš   — |                       dt          ||||dœt          j        ¦  «        t	          ||||¬¦  «        t
          ¬¦  «        S )áœ  
        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`, `/v1/embeddings`, and `/v1/completions` are supported.
              Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000
              embedding inputs across all requests in the batch.

          input_file_id: The ID of an uploaded file that contains requests for the new batch.

              See [upload file](https://platform.openai.com/docs/api-reference/files/create)
              for how to upload a file.

              Your input file must be formatted as a
              [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input),
              and must be uploaded with the purpose `batch`. The file can contain up to 50,000
              requests, and can be up to 200 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
        ú/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   s	            r%   ÚcreatezBatches.create2   sr   € ð\ �zŠzØÝ à):Ø (Ø%2Ø (ð	ð õ $Ô5ñô õ )Ø+¸ÐQ[Ðelðñ ô õ ð ñ 
ô 
ð 	
r'   rA   Úbatch_idc          	     óŒ   — |st          d|›�¦  «        ‚|                      d|› �t          ||||¬¦  «        t          ¬¦  «        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 ú	/batches/rA   ©rD   rE   ©Ú
ValueErrorÚ_getr   r   ©r$   rJ   r.   r/   r0   r1   s         r%   ÚretrievezBatches.retrieveq   sm   € ð. ð 	eÝÐcÐW_ÐcÐcÑdÔdÐdØ�yŠyØ"˜Ð"Ð"Ý(Ø+¸ÐQ[Ðelðñ ô õ ð ñ 
ô 
ð 	
r'   ©ÚafterÚlimitr.   r/   r0   r1   rV   ústr | NotGivenrW   úint | NotGivenúSyncCursorPage[Batch]c               ó¸   — |                       dt          t                   t          ||||t	          ||dœt
          j        ¦  «        ¬¦  «        t          ¬¦  «        S ©a,  List your organization's batches.

        Args:
          after: A cursor for use in pagination.

        `after` is an object ID that defines your place
              in the list. For instance, if you make a list request and receive 100 objects,
              ending with obj_foo, your subsequent call can include after=obj_foo in order to
              fetch the next page of the list.

          limit: A limit on the number of objects to be returned. Limit can range between 1 and
              100, and the default is 20.

          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
        r?   )rV   rW   )r.   r/   r0   r1   Úquery)ÚpagerD   Úmodel)Ú_get_api_listr   r   r   r   r	   ÚBatchListParams©r$   rV   rW   r.   r/   r0   r1   s          r%   ÚlistzBatches.list’   su   € ðB ×!Ò!ØÝ¥Ô&Ý(Ø+Ø'Ø%ØÝ%à!&Ø!&ðð õ &Ô5ñô ðñ ô õ ð! "ñ 
ô 
ð 	
r'   c          	     óŽ   — |st          d|›�¦  «        ‚|                      d|› d�t          ||||¬¦  «        t          ¬¦  «        S )á
  Cancels an in-progress batch.

        The batch will be in status `cancelling` for up to
        10 minutes, before changing to `cancelled`, where it will have partial results
        (if any) available in the output file.

        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
        rM   rN   ú/cancelrA   rO   ©rQ   rF   r   r   rS   s         r%   ÚcancelzBatches.cancelÆ   sp   € ð4 ð 	eÝÐcÐW_ÐcÐcÑdÔdÐdØ�zŠzØ)˜Ð)Ð)Ð)Ý(Ø+¸ÐQ[Ðelðñ ô õ ð ñ 
ô 
ð 	
r'   )r   r    )r   r(   ©r2   r3   r4   r5   r6   r7   r-   r8   r.   r9   r/   r:   r0   r;   r1   r<   r   r   ©rJ   r7   r.   r9   r/   r:   r0   r;   r1   r<   r   r   )rV   rX   rW   rY   r.   r9   r/   r:   r0   r;   r1   r<   r   rZ   ©Ú__name__Ú
__module__Ú__qualname__r   r&   r+   r   rI   rT   rc   rh   © r'   r%   r   r      s  € € € € € Øð,ð ,ð ,ñ „_ð,ð ð2ð 2ð 2ñ „_ð2ð 9Bð )-Ø$(Ø"&Ø;Dð=
ð =
ð =
ð =
ð =
ð =
ðJ )-Ø$(Ø"&Ø;Dð
ð 
ð 
ð 
ð 
ð 
ðH !*Ø )ð )-Ø$(Ø"&Ø;Dð2
ð 2
ð 2
ð 2
ð 2
ð 2
ðt )-Ø$(Ø"&Ø;Dð"
ð "
ð "
ð "
ð "
ð "
ð "
ð "
r'   c                  ó”   — e Zd Zed%d„¦   «         Zed&d„¦   «         Zedddedœd'd„Zdddedœd(d„Zeedddedœd)d#„Z	dddedœd(d$„Z
dS )*r   r   ÚAsyncBatchesWithRawResponsec                ó    — t          | ¦  «        S r"   )rq   r#   s    r%   r&   zAsyncBatches.with_raw_responseì   s   € õ +¨4Ñ0Ô0Ð0r'   Ú!AsyncBatchesWithStreamingResponsec                ó    — t          | ¦  «        S r*   )rs   r#   s    r%   r+   z$AsyncBatches.with_streaming_responseö   s   € õ 1°Ñ6Ô6Ð6r'   Nr,   r2   r3   r4   r5   r6   r7   r-   r8   r.   r9   r/   r:   r0   r;   r1   r<   r   c          
   ƒ  ó¶   K  — |                       dt          ||||dœt          j        ¦  «        ƒ d{V —†t	          ||||¬¦  «        t
          ¬¦  «        ƒ d{V —†S )r>   r?   r@   NrA   rB   )rF   r   r
   rG   r   r   rH   s	            r%   rI   zAsyncBatches.createÿ   s²   è è € ð\ —Z’ZØÝ,à):Ø (Ø%2Ø (ð	ð õ $Ô5ñô ð ð ð ð ð ð õ )Ø+¸ÐQ[Ðelðñ ô õ ð  ñ 
ô 
ð 
ð 
ð 
ð 
ð 
ð 
ð 	
r'   rA   rJ   c          	   ƒ  óœ   K  — |st          d|›�¦  «        ‚|                      d|› �t          ||||¬¦  «        t          ¬¦  «        ƒ d{V —†S )rL   rM   rN   rA   rO   NrP   rS   s         r%   rT   zAsyncBatches.retrieve>  s�   è è € ð. ð 	eÝÐcÐW_ÐcÐcÑdÔdÐdØ—Y’YØ"˜Ð"Ð"Ý(Ø+¸ÐQ[Ðelðñ ô õ ð ñ 
ô 
ð 
ð 
ð 
ð 
ð 
ð 
ð 	
r'   rU   rV   rX   rW   rY   ú-AsyncPaginator[Batch, AsyncCursorPage[Batch]]c               ó¸   — |                       dt          t                   t          ||||t	          ||dœt
          j        ¦  «        ¬¦  «        t          ¬¦  «        S r\   )r`   r   r   r   r   r	   ra   rb   s          r%   rc   zAsyncBatches.list_  su   € ðB ×!Ò!ØÝ ¥Ô'Ý(Ø+Ø'Ø%ØÝ%à!&Ø!&ðð õ &Ô5ñô ðñ ô õ ð! "ñ 
ô 
ð 	
r'   c          	   ƒ  óž   K  — |st          d|›�¦  «        ‚|                      d|› d�t          ||||¬¦  «        t          ¬¦  «        ƒ d{V —†S )re   rM   rN   rf   rA   rO   Nrg   rS   s         r%   rh   zAsyncBatches.cancel“  s’   è è € ð4 ð 	eÝÐcÐW_ÐcÐcÑdÔdÐdØ—Z’ZØ)˜Ð)Ð)Ð)Ý(Ø+¸ÐQ[Ðelðñ ô õ ð  ñ 
ô 
ð 
ð 
ð 
ð 
ð 
ð 
ð 	
r'   )r   rq   )r   rs   ri   rj   )rV   rX   rW   rY   r.   r9   r/   r:   r0   r;   r1   r<   r   rw   rk   ro   r'   r%   r   r   ë   s  € € € € € Øð1ð 1ð 1ñ „_ð1ð ð7ð 7ð 7ñ „_ð7ð 9Bð )-Ø$(Ø"&Ø;Dð=
ð =
ð =
ð =
ð =
ð =
ðJ )-Ø$(Ø"&Ø;Dð
ð 
ð 
ð 
ð 
ð 
ðH !*Ø )ð )-Ø$(Ø"&Ø;Dð2
ð 2
ð 2
ð 2
ð 2
ð 2
ðt )-Ø$(Ø"&Ø;Dð"
ð "
ð "
ð "
ð "
ð "
ð "
ð "
r'   c                  ó   — e Zd Zdd„ZdS )r    Úbatchesr   r   ÚNonec                ó  — || _         t          j        |j        ¦  «        | _        t          j        |j        ¦  «        | _        t          j        |j        ¦  «        | _        t          j        |j        ¦  «        | _        d S ©N)Ú_batchesr   Úto_raw_response_wrapperrI   rT   rc   rh   ©r$   r{   s     r%   Ú__init__zBatchesWithRawResponse.__init__¹  sx   € ØˆŒå&Ô>ØŒNñ
ô 
ˆŒõ )Ô@ØÔñ
ô 
ˆŒõ %Ô<ØŒLñ
ô 
ˆŒ	õ 'Ô>ØŒNñ
ô 
ˆŒˆˆr'   N©r{   r   r   r|   ©rl   rm   rn   r‚   ro   r'   r%   r    r    ¸  ó(   € € € € € ð
ð 
ð 
ð 
ð 
ð 
r'   r    c                  ó   — e Zd Zdd„ZdS )rq   r{   r   r   r|   c                ó  — || _         t          j        |j        ¦  «        | _        t          j        |j        ¦  «        | _        t          j        |j        ¦  «        | _        t          j        |j        ¦  «        | _        d S r~   )r   r   Úasync_to_raw_response_wrapperrI   rT   rc   rh   r�   s     r%   r‚   z$AsyncBatchesWithRawResponse.__init__Ë  sx   € ØˆŒå&ÔDØŒNñ
ô 
ˆŒõ )ÔFØÔñ
ô 
ˆŒõ %ÔBØŒLñ
ô 
ˆŒ	õ 'ÔDØŒNñ
ô 
ˆŒˆˆr'   N©r{   r   r   r|   r„   ro   r'   r%   rq   rq   Ê  r…   r'   rq   c                  ó   — e Zd Zdd„ZdS )r(   r{   r   r   r|   c                óÜ   — || _         t          |j        ¦  «        | _        t          |j        ¦  «        | _        t          |j        ¦  «        | _        t          |j        ¦  «        | _        d S r~   )r   r   rI   rT   rc   rh   r�   s     r%   r‚   z%BatchesWithStreamingResponse.__init__Ý  sl   € ØˆŒå2ØŒNñ
ô 
ˆŒõ 5ØÔñ
ô 
ˆŒõ 1ØŒLñ
ô 
ˆŒ	õ 3ØŒNñ
ô 
ˆŒˆˆr'   Nrƒ   r„   ro   r'   r%   r(   r(   Ü  r…   r'   r(   c                  ó   — e Zd Zdd„ZdS )rs   r{   r   r   r|   c                óÜ   — || _         t          |j        ¦  «        | _        t          |j        ¦  «        | _        t          |j        ¦  «        | _        t          |j        ¦  «        | _        d S r~   )r   r   rI   rT   rc   rh   r�   s     r%   r‚   z*AsyncBatchesWithStreamingResponse.__init__ï  sl   € ØˆŒå8ØŒNñ
ô 
ˆŒõ ;ØÔñ
ô 
ˆŒõ 7ØŒLñ
ô 
ˆŒ	õ 9ØŒNñ
ô 
ˆŒˆˆr'   Nr‰   r„   ro   r'   r%   rs   rs   î  r…   r'   rs   )-Ú
__future__r   Útypingr   r   Útyping_extensionsr   ÚhttpxÚ r   Útypesr	   r
   Ú_typesr   r   r   r   r   Ú_utilsr   r   Ú_compatr   Ú	_resourcer   r   Ú	_responser   r   Ú
paginationr   r   Útypes.batchr   Ú_base_clientr   r   Ú__all__r   r   r    rq   r(   rs   ro   r'   r%   ú<module>r�      s{  ðð #Ð "Ð "Ð "Ð "Ð "à !Ð !Ð !Ð !Ð !Ð !Ð !Ð !Ø %Ð %Ð %Ð %Ð %Ð %à €€€à Ð Ð Ð Ð Ð Ø :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ø >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >ðð ð ð ð ð ð ð ð &Ð %Ð %Ð %Ð %Ð %Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø XÐ XÐ XÐ XÐ XÐ XÐ XÐ XØ 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð
 �nÐ
%€ðJ
ð J
ð J
ð J
ð J
ˆoñ J
ô J
ð J
ðZJ
ð J
ð J
ð J
ð J
Ð#ñ J
ô J
ð J
ðZ
ð 
ð 
ð 
ð 
ñ 
ô 
ð 
ð$
ð 
ð 
ð 
ð 
ñ 
ô 
ð 
ð$
ð 
ð 
ð 
ð 
ñ 
ô 
ð 
ð$
ð 
ð 
ð 
ð 
ñ 
ô 
ð 
ð 
ð 
r'   