U
    ·ÜŸjb^  ã                   @  sŒ  d dl mZ d dl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 ddlmZmZmZmZmZ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- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m5Z5 ddgZ6G dd„ deƒZ7G dd„ deƒZ8G dd„ dƒZ9G dd„ dƒZ:G dd „ d ƒZ;G d!d"„ d"ƒZ<dS )#é    )Úannotations)ÚOptional)ÚLiteralNé   )Ú_legacy_response)Ú	NOT_GIVENÚBodyÚQueryÚHeadersÚNotGiven)Úmaybe_transformÚasync_maybe_transform)Úcached_property)ÚSyncAPIResourceÚAsyncAPIResource)Úto_streamed_response_wrapperÚ"async_to_streamed_response_wrapperé   )ÚOutputItemsÚAsyncOutputItemsÚOutputItemsWithRawResponseÚAsyncOutputItemsWithRawResponseÚ OutputItemsWithStreamingResponseÚ%AsyncOutputItemsWithStreamingResponse)ÚSyncCursorPageÚAsyncCursorPage)Úrun_list_paramsÚrun_create_params)ÚAsyncPaginatorÚmake_request_options)ÚMetadata)ÚRunListResponse)ÚRunCancelResponse)ÚRunCreateResponse)ÚRunDeleteResponse)ÚRunRetrieveResponseÚRunsÚ	AsyncRunsc                   @  s  e Zd Zeddœdd„ƒZeddœdd„ƒZeddœd	d
„ƒZe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d„Z	eeeedddedœ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'd(„Zdddedœddddddd)dœd*d+„ZdS ),r&   r   ©Úreturnc                 C  s
   t | jƒS ©N)r   Ú_client©Úself© r.   úD/tmp/pip-unpacked-wheel-2qj3ofc_/openai/resources/evals/runs/runs.pyÚoutput_items)   s    zRuns.output_itemsÚRunsWithRawResponsec                 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/openai/openai-python#accessing-raw-response-data-eg-headers
        )r1   r,   r.   r.   r/   Úwith_raw_response-   s    zRuns.with_raw_responseÚRunsWithStreamingResponsec                 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/openai/openai-python#with_streaming_response
        )r4   r,   r.   r.   r/   Úwith_streaming_response7   s    zRuns.with_streaming_responseN©ÚmetadataÚnameÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutÚstrúrun_create_params.DataSourceúOptional[Metadata] | NotGivenústr | NotGivenúHeaders | NoneúQuery | NoneúBody | Noneú'float | httpx.Timeout | None | NotGivenr#   ©	Úeval_idÚdata_sourcer8   r9   r:   r;   r<   r=   r)   c          	   	   C  sH   |st d|›�ƒ‚| jd|› d�t|||dœtjƒt||||d�td�S )áv  Create a new evaluation run.

        This is the endpoint that will kick off grading.

        Args:
          data_source: Details about the run's data source.

          metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
              for storing additional information about the object in a structured format, and
              querying for objects via API or the dashboard.

              Keys are strings with a maximum length of 64 characters. Values are strings with
              a maximum length of 512 characters.

          name: The name of the run.

          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
        ú6Expected a non-empty value for `eval_id` but received ú/evals/ú/runs©rH   r8   r9   ©r:   r;   r<   r=   ©ÚbodyÚoptionsÚcast_to)Ú
ValueErrorÚ_postr   r   ÚRunCreateParamsr   r#   ©	r-   rG   rH   r8   r9   r:   r;   r<   r=   r.   r.   r/   Úcreate@   s&    &
ýú   ÿózRuns.createrN   r%   ©Úrun_idrG   r:   r;   r<   r=   r)   c                C  sL   |st d|›�ƒ‚|s$t d|›�ƒ‚| jd|› d|› �t||||d�td�S )áP  
        Get an evaluation run by ID.

        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   ú5Expected a non-empty value for `run_id` but received rK   ú/runs/rN   ©rQ   rR   ©rS   Ú_getr   r%   ©r-   rY   rG   r:   r;   r<   r=   r.   r.   r/   Úretrievex   s       ÿûzRuns.retrieve©ÚafterÚlimitÚorderÚstatusr:   r;   r<   r=   úint | NotGivenú#Literal[('asc', 'desc')] | NotGivenúPLiteral[('queued', 'in_progress', 'completed', 'canceled', 'failed')] | NotGivenzSyncCursorPage[RunListResponse]©
rG   rc   rd   re   rf   r:   r;   r<   r=   r)   c          
      C  sP   |st d|›�ƒ‚| jd|› d�tt t||||	t||||dœtjƒd�td�S ©aê  
        Get a list of runs for an evaluation.

        Args:
          after: Identifier for the last run from the previous pagination request.

          limit: Number of runs to retrieve.

          order: Sort order for runs by timestamp. Use `asc` for ascending order or `desc` for
              descending order. Defaults to `asc`.

          status: Filter runs by status. Use "queued" | "in_progress" | "failed" | "completed" |
              "canceled".

          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   rL   )rc   rd   re   rf   )r:   r;   r<   r=   Úquery)ÚpagerQ   Úmodel)rS   Ú_get_api_listr   r!   r   r   r   ÚRunListParams©
r-   rG   rc   rd   re   rf   r:   r;   r<   r=   r.   r.   r/   Úlistœ   s*    %
üùûîz	Runs.listr$   c                C  sL   |st d|›�ƒ‚|s$t d|›�ƒ‚| jd|› d|› �t||||d�td�S )áG  
        Delete an eval run.

        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   r[   rK   r\   rN   r]   ©rS   Ú_deleter   r$   r`   r.   r.   r/   ÚdeleteØ   s       ÿûzRuns.deleter"   c                C  sL   |st d|›�ƒ‚|s$t d|›�ƒ‚| jd|› d|› �t||||d�td�S )áU  
        Cancel an ongoing evaluation run.

        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   r[   rK   r\   rN   r]   ©rS   rT   r   r"   r`   r.   r.   r/   Úcancelü   s       ÿûzRuns.cancel©Ú__name__Ú
__module__Ú__qualname__r   r0   r3   r6   r   rW   ra   rr   rv   ry   r.   r.   r.   r/   r&   (   sJ   	ô"?ö(ó$Cö+öc                   @  s  e Zd Zeddœdd„ƒZeddœdd„ƒZeddœd	d
„ƒZe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d„Z	eeeedddedœ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'd(„Zdddedœddddddd)dœd*d+„ZdS ),r'   r   r(   c                 C  s
   t | jƒS r*   )r   r+   r,   r.   r.   r/   r0   "  s    zAsyncRuns.output_itemsÚAsyncRunsWithRawResponsec                 C  s   t | ƒS r2   )r~   r,   r.   r.   r/   r3   &  s    zAsyncRuns.with_raw_responseÚAsyncRunsWithStreamingResponsec                 C  s   t | ƒS r5   )r   r,   r.   r.   r/   r6   0  s    z!AsyncRuns.with_streaming_responseNr7   r>   r?   r@   rA   rB   rC   rD   rE   r#   rF   c          	   	   Ã  sT   |st d|›�ƒ‚| jd|› d�t|||dœtjƒI dH t||||d�td�I dH S )rI   rJ   rK   rL   rM   NrN   rO   )rS   rT   r   r   rU   r   r#   rV   r.   r.   r/   rW   9  s&    &
ýú   ÿózAsyncRuns.createrN   r%   rX   c                Ã  sR   |st d|›�ƒ‚|s$t d|›�ƒ‚| jd|› d|› �t||||d�td�I dH S )rZ   rJ   r[   rK   r\   rN   r]   Nr^   r`   r.   r.   r/   ra   q  s       ÿûzAsyncRuns.retrieverb   rg   rh   ri   zAAsyncPaginator[RunListResponse, AsyncCursorPage[RunListResponse]]rj   c          
      C  sP   |st d|›�ƒ‚| jd|› d�tt t||||	t||||dœtjƒd�td�S rk   )rS   ro   r   r!   r   r   r   rp   rq   r.   r.   r/   rr   •  s*    %
üùûîzAsyncRuns.listr$   c                Ã  sR   |st d|›�ƒ‚|s$t d|›�ƒ‚| jd|› d|› �t||||d�td�I dH S )rs   rJ   r[   rK   r\   rN   r]   Nrt   r`   r.   r.   r/   rv   Ñ  s       ÿûzAsyncRuns.deleter"   c                Ã  sR   |st d|›�ƒ‚|s$t d|›�ƒ‚| jd|› d|› �t||||d�td�I dH S )rw   rJ   r[   rK   r\   rN   r]   Nrx   r`   r.   r.   r/   ry   õ  s       ÿûzAsyncRuns.cancelrz   r.   r.   r.   r/   r'   !  sJ   	ô"?ö(ó$Cö+öc                   @  s.   e Zd Zdddœdd„Zeddœdd	„ƒZd
S )r1   r&   ÚNone©Úrunsr)   c                 C  sP   || _ t |j¡| _t |j¡| _t |j¡| _t |j¡| _t |j¡| _d S r*   )Ú_runsr   Zto_raw_response_wrapperrW   ra   rr   rv   ry   ©r-   r‚   r.   r.   r/   Ú__init__  s     ÿÿÿÿÿzRunsWithRawResponse.__init__r   r(   c                 C  s   t | jjƒS r*   )r   rƒ   r0   r,   r.   r.   r/   r0   .  s    z RunsWithRawResponse.output_itemsN©r{   r|   r}   r…   r   r0   r.   r.   r.   r/   r1     s   r1   c                   @  s.   e Zd Zdddœdd„Zeddœdd	„ƒZd
S )r~   r'   r€   r�   c                 C  sP   || _ t |j¡| _t |j¡| _t |j¡| _t |j¡| _t |j¡| _d S r*   )rƒ   r   Zasync_to_raw_response_wrapperrW   ra   rr   rv   ry   r„   r.   r.   r/   r…   4  s     ÿÿÿÿÿz!AsyncRunsWithRawResponse.__init__r   r(   c                 C  s   t | jjƒS r*   )r   rƒ   r0   r,   r.   r.   r/   r0   G  s    z%AsyncRunsWithRawResponse.output_itemsNr†   r.   r.   r.   r/   r~   3  s   r~   c                   @  s.   e Zd Zdddœdd„Zeddœdd	„ƒZd
S )r4   r&   r€   r�   c                 C  sF   || _ t|jƒ| _t|jƒ| _t|jƒ| _t|jƒ| _t|jƒ| _d S r*   )rƒ   r   rW   ra   rr   rv   ry   r„   r.   r.   r/   r…   M  s     ÿÿÿÿÿz"RunsWithStreamingResponse.__init__r   r(   c                 C  s   t | jjƒS r*   )r   rƒ   r0   r,   r.   r.   r/   r0   `  s    z&RunsWithStreamingResponse.output_itemsNr†   r.   r.   r.   r/   r4   L  s   r4   c                   @  s.   e Zd Zdddœdd„Zeddœdd	„ƒZd
S )r   r'   r€   r�   c                 C  sF   || _ t|jƒ| _t|jƒ| _t|jƒ| _t|jƒ| _t|jƒ| _d S r*   )rƒ   r   rW   ra   rr   rv   ry   r„   r.   r.   r/   r…   f  s     ÿÿÿÿÿz'AsyncRunsWithStreamingResponse.__init__r   r(   c                 C  s   t | jjƒS r*   )r   rƒ   r0   r,   r.   r.   r/   r0   y  s    z+AsyncRunsWithStreamingResponse.output_itemsNr†   r.   r.   r.   r/   r   e  s   r   )=Ú
__future__r   Útypingr   Útyping_extensionsr   ZhttpxÚ r   Ú_typesr   r   r	   r
   r   Ú_utilsr   r   Ú_compatr   Z	_resourcer   r   Ú	_responser   r   r0   r   r   r   r   r   r   Z
paginationr   r   Ztypes.evalsr   r   Z_base_clientr   r   Ztypes.shared_params.metadatar    Ztypes.evals.run_list_responser!   Ztypes.evals.run_cancel_responser"   Ztypes.evals.run_create_responser#   Ztypes.evals.run_delete_responser$   Z!types.evals.run_retrieve_responser%   Ú__all__r&   r'   r1   r~   r4   r   r.   r.   r.   r/   Ú<module>   s8     z z