o
    "ch_                     @  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                	   @     e Zd Zed6ddZed7ddZed8d	d
Zeedddedd9ddZddded d:d#d$Z	eeeeddded%d;d.d/Z
ddded d<d1d2Zddded d=d4d5ZdS )>r&   returnr   c                 C  
   t | jS N)r   _clientself r/   ^/home/air/goalskill/back/venv/lib/python3.10/site-packages/openai/resources/evals/runs/runs.pyoutput_items&      
zRuns.output_itemsRunsWithRawResponsec                 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/openai/openai-python#accessing-raw-response-data-eg-headers
        )r3   r-   r/   r/   r0   with_raw_response*      zRuns.with_raw_responseRunsWithStreamingResponsec                 C  r4   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
        )r8   r-   r/   r/   r0   with_streaming_response4      zRuns.with_streaming_responseNmetadatanameextra_headersextra_query
extra_bodytimeouteval_idstrdata_sourcerun_create_params.DataSourcer=   Optional[Metadata] | NotGivenr>   str | NotGivenr?   Headers | Noner@   Query | NonerA   Body | NonerB   'float | httpx.Timeout | None | NotGivenr#   c          	   	   C  sH   |s	t d|| jd| dt|||dtjt||||dtdS )  
        Kicks off a new run for a given evaluation, specifying the data source, and what
        model configuration to use to test. The datasource will be validated against the
        schema specified in the config of the evaluation.

        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rE   r=   r>   r?   r@   rA   rB   bodyoptionscast_to)
ValueError_postr   r   RunCreateParamsr   r#   	r.   rC   rE   r=   r>   r?   r@   rA   rB   r/   r/   r0   create=   s    '
zRuns.createrR   run_idr%   c                C  L   |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
        rN   5Expected a non-empty value for `run_id` but received rO   /runs/rR   rU   rV   rW   _getr   r%   r.   r\   rC   r?   r@   rA   rB   r/   r/   r0   retrievev      zRuns.retrieveafterlimitorderstatusr?   r@   rA   rB   rh   ri   int | NotGivenrj   !Literal['asc', 'desc'] | NotGivenrk   NLiteral['queued', 'in_progress', 'completed', 'canceled', 'failed'] | NotGivenSyncCursorPage[RunListResponse]c          
      C  P   |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. One of `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
        rN   rO   rP   )rh   ri   rj   rk   )r?   r@   rA   rB   query)pagerU   model)rW   _get_api_listr   r!   r   r   r   RunListParams
r.   rC   rh   ri   rj   rk   r?   r@   rA   rB   r/   r/   r0   list   *   %
z	Runs.listr$   c                C  r]   )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
        rN   r_   rO   r`   rR   ra   rW   _deleter   r$   rd   r/   r/   r0   delete   rf   zRuns.deleter"   c                C  r]   )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
        rN   r_   rO   r`   rR   ra   rW   rX   r   r"   rd   r/   r/   r0   cancel   rf   zRuns.cancel)r)   r   )r)   r3   )r)   r8   rC   rD   rE   rF   r=   rG   r>   rH   r?   rI   r@   rJ   rA   rK   rB   rL   r)   r#   r\   rD   rC   rD   r?   rI   r@   rJ   rA   rK   rB   rL   r)   r%   )rC   rD   rh   rH   ri   rl   rj   rm   rk   rn   r?   rI   r@   rJ   rA   rK   rB   rL   r)   ro   r\   rD   rC   rD   r?   rI   r@   rJ   rA   rK   rB   rL   r)   r$   r\   rD   rC   rD   r?   rI   r@   rJ   rA   rK   rB   rL   r)   r"   __name__
__module____qualname__r   r1   r6   r:   r   r[   re   rx   r}   r   r/   r/   r/   r0   r&   %   L    	@(C+c                	   @  r(   )>r'   r)   r   c                 C  r*   r+   )r   r,   r-   r/   r/   r0   r1      r2   zAsyncRuns.output_itemsAsyncRunsWithRawResponsec                 C  r4   r5   )r   r-   r/   r/   r0   r6   $  r7   zAsyncRuns.with_raw_responseAsyncRunsWithStreamingResponsec                 C  r4   r9   )r   r-   r/   r/   r0   r:   .  r;   z!AsyncRuns.with_streaming_responseNr<   rC   rD   rE   rF   r=   rG   r>   rH   r?   rI   r@   rJ   rA   rK   rB   rL   r#   c          	   	     sV   |s
t d|| jd| dt|||dtjI dH t||||dtdI dH S )rM   rN   rO   rP   rQ   NrR   rS   )rW   rX   r   r   rY   r   r#   rZ   r/   r/   r0   r[   7  s"   '
zAsyncRuns.createrR   r\   r%   c                  T   |s
t d||st d|| jd| d| t||||dtdI dH S )r^   rN   r_   rO   r`   rR   ra   Nrb   rd   r/   r/   r0   re   p     zAsyncRuns.retrieverg   rh   ri   rl   rj   rm   rk   rn   AAsyncPaginator[RunListResponse, AsyncCursorPage[RunListResponse]]c          
      C  rp   rq   )rW   ru   r   r!   r   r   r   rv   rw   r/   r/   r0   rx     ry   zAsyncRuns.listr$   c                  r   )rz   rN   r_   rO   r`   rR   ra   Nr{   rd   r/   r/   r0   r}     r   zAsyncRuns.deleter"   c                  r   )r~   rN   r_   rO   r`   rR   ra   Nr   rd   r/   r/   r0   r     r   zAsyncRuns.cancel)r)   r   )r)   r   )r)   r   r   r   )rC   rD   rh   rH   ri   rl   rj   rm   rk   rn   r?   rI   r@   rJ   rA   rK   rB   rL   r)   r   r   r   r   r/   r/   r/   r0   r'     r   c                   @  $   e Zd ZdddZeddd	Zd
S )r3   runsr&   r)   Nonec                 C  P   || _ t|j| _t|j| _t|j| _t|j| _t|j| _d S r+   )_runsr   to_raw_response_wrapperr[   re   rx   r}   r   r.   r   r/   r/   r0   __init__      
zRunsWithRawResponse.__init__r   c                 C     t | jjS r+   )r   r   r1   r-   r/   r/   r0   r1   -     z RunsWithRawResponse.output_itemsNr   r&   r)   r   )r)   r   r   r   r   r   r   r1   r/   r/   r/   r0   r3         
r3   c                   @  r   )r   r   r'   r)   r   c                 C  r   r+   )r   r   async_to_raw_response_wrapperr[   re   rx   r}   r   r   r/   r/   r0   r   3  r   z!AsyncRunsWithRawResponse.__init__r   c                 C  r   r+   )r   r   r1   r-   r/   r/   r0   r1   F  r   z%AsyncRunsWithRawResponse.output_itemsNr   r'   r)   r   )r)   r   r   r/   r/   r/   r0   r   2  r   r   c                   @  r   )r8   r   r&   r)   r   c                 C  F   || _ t|j| _t|j| _t|j| _t|j| _t|j| _d S r+   )r   r   r[   re   rx   r}   r   r   r/   r/   r0   r   L      
z"RunsWithStreamingResponse.__init__r   c                 C  r   r+   )r   r   r1   r-   r/   r/   r0   r1   _  r   z&RunsWithStreamingResponse.output_itemsNr   )r)   r   r   r/   r/   r/   r0   r8   K  r   r8   c                   @  r   )r   r   r'   r)   r   c                 C  r   r+   )r   r   r[   re   rx   r}   r   r   r/   r/   r0   r   e  r   z'AsyncRunsWithStreamingResponse.__init__r   c                 C  r   r+   )r   r   r1   r-   r/   r/   r0   r1   x  r   z+AsyncRunsWithStreamingResponse.output_itemsNr   )r)   r   r   r/   r/   r/   r0   r   d  r   r   )=
__future__r   typingr   typing_extensionsr   httpx r   _typesr   r   r	   r
   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   r1   r   r   r   r   r   r   
paginationr   r   types.evalsr   r   _base_clientr   r   types.shared_params.metadatar    types.evals.run_list_responser!   types.evals.run_cancel_responser"   types.evals.run_create_responser#   types.evals.run_delete_responser$   !types.evals.run_retrieve_responser%   __all__r&   r'   r3   r   r8   r   r/   r/   r/   r0   <module>   s:     { {