o
    "che                     @  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 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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*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m5Z5 ddl6m7Z7 ddgZ8G dd de!Z9G 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)IterableOptional)LiteralN   )_legacy_response)eval_list_paramseval_create_paramseval_update_params)	NOT_GIVENBodyQueryHeadersNotGiven)maybe_transformasync_maybe_transform)cached_property   )Runs	AsyncRunsRunsWithRawResponseAsyncRunsWithRawResponseRunsWithStreamingResponseAsyncRunsWithStreamingResponse)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)SyncCursorPageAsyncCursorPage)AsyncPaginatormake_request_options)EvalListResponse)EvalCreateResponse)EvalDeleteResponse)EvalUpdateResponse)EvalRetrieveResponse)MetadataEvals
AsyncEvalsc                	   @     e Zd Zed7ddZed8ddZed9d	d
Zeedddedd:ddZddded d;d$d%Z	eedddedd<d'd(Z
eeeeddded)d=d2d3Zddded d>d5d6ZdS )?r(   returnr   c                 C  
   t | jS N)r   _clientself r1   Z/home/air/goalskill/back/venv/lib/python3.10/site-packages/openai/resources/evals/evals.pyruns&      
z
Evals.runsEvalsWithRawResponsec                 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
        )r5   r/   r1   r1   r2   with_raw_response*      zEvals.with_raw_responseEvalsWithStreamingResponsec                 C  r6   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/   r1   r1   r2   with_streaming_response4      zEvals.with_streaming_responseNmetadatanameextra_headersextra_query
extra_bodytimeoutdata_source_config#eval_create_params.DataSourceConfigtesting_criteria-Iterable[eval_create_params.TestingCriterion]r?   Optional[Metadata] | NotGivenr@   str | NotGivenrA   Headers | NonerB   Query | NonerC   Body | NonerD   'float | httpx.Timeout | None | NotGivenr#   c          	   	   C  s0   | j dt||||dtjt||||dtdS )  
        Create the structure of an evaluation that can be used to test a model's
        performance. An evaluation is a set of testing criteria and the config for a
        data source, which dictates the schema of the data used in the evaluation. After
        creating an evaluation, you can run it on different models and model parameters.
        We support several types of graders and datasources. For more information, see
        the [Evals guide](https://platform.openai.com/docs/guides/evals).

        Args:
          data_source_config: The configuration for the data source used for the evaluation runs. Dictates the
              schema of the data used in the evaluation.

          testing_criteria: A list of graders for all eval runs in this group. Graders can reference
              variables in the data source using double curly braces notation, like
              `{{item.variable_name}}`. To reference the model's output, use the `sample`
              namespace (ie, `{{sample.output_text}}`).

          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 evaluation.

          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
        /evalsrE   rG   r?   r@   rA   rB   rC   rD   bodyoptionscast_to)_postr   r	   EvalCreateParamsr!   r#   	r0   rE   rG   r?   r@   rA   rB   rC   rD   r1   r1   r2   create=   s   0	zEvals.createrR   eval_idstrr&   c                C  4   |s	t d|| jd| t||||dtdS )L  
        Get an evaluation 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
        6Expected a non-empty value for `eval_id` but received /evals/rR   rU   rV   
ValueError_getr!   r&   r0   r[   rA   rB   rC   rD   r1   r1   r2   retrieve~      zEvals.retriever%   c             	   C  sD   |s	t d|| jd| t||dtjt||||dtdS )  
        Update certain properties of an evaluation.

        Args:
          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: Rename the evaluation.

          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_   r`   r?   r@   rR   rS   )rc   rW   r   r
   EvalUpdateParamsr!   r%   r0   r[   r?   r@   rA   rB   rC   rD   r1   r1   r2   update   s   "zEvals.updateafterlimitorderorder_byrA   rB   rC   rD   rn   ro   int | NotGivenrp   !Literal['asc', 'desc'] | NotGivenrq   .Literal['created_at', 'updated_at'] | NotGiven SyncCursorPage[EvalListResponse]c          	      C  6   | j dtt t||||t||||dtjdtdS a  
        List evaluations for a project.

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

          limit: Number of evals to retrieve.

          order: Sort order for evals by timestamp. Use `asc` for ascending order or `desc` for
              descending order.

          order_by: Evals can be ordered by creation time or last updated time. Use `created_at` for
              creation time or `updated_at` for last updated time.

          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
        rP   )rn   ro   rp   rq   )rA   rB   rC   rD   query)pagerU   model)_get_api_listr   r"   r!   r   r   EvalListParams	r0   rn   ro   rp   rq   rA   rB   rC   rD   r1   r1   r2   list   &   $z
Evals.listr$   c                C  r]   )I  
        Delete an evaluation.

        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
        r_   r`   rR   ra   rc   _deleter!   r$   re   r1   r1   r2   delete  rg   zEvals.delete)r+   r   )r+   r5   )r+   r:   rE   rF   rG   rH   r?   rI   r@   rJ   rA   rK   rB   rL   rC   rM   rD   rN   r+   r#   r[   r\   rA   rK   rB   rL   rC   rM   rD   rN   r+   r&   r[   r\   r?   rI   r@   rJ   rA   rK   rB   rL   rC   rM   rD   rN   r+   r%   )rn   rJ   ro   rr   rp   rs   rq   rt   rA   rK   rB   rL   rC   rM   rD   rN   r+   ru   r[   r\   rA   rK   rB   rL   rC   rM   rD   rN   r+   r$   __name__
__module____qualname__r   r3   r8   r<   r   rZ   rf   rl   r~   r   r1   r1   r1   r2   r(   %   P    	G%6?c                	   @  r*   )?r)   r+   r   c                 C  r,   r-   )r   r.   r/   r1   r1   r2   r3   .  r4   zAsyncEvals.runsAsyncEvalsWithRawResponsec                 C  r6   r7   )r   r/   r1   r1   r2   r8   2  r9   zAsyncEvals.with_raw_responseAsyncEvalsWithStreamingResponsec                 C  r6   r;   )r   r/   r1   r1   r2   r<   <  r=   z"AsyncEvals.with_streaming_responseNr>   rE   rF   rG   rH   r?   rI   r@   rJ   rA   rK   rB   rL   rC   rM   rD   rN   r#   c          	   	     s>   | j dt||||dtjI dH t||||dtdI dH S )rO   rP   rQ   NrR   rS   )rW   r   r	   rX   r!   r#   rY   r1   r1   r2   rZ   E  s    0	zAsyncEvals.createrR   r[   r\   r&   c                  <   |s
t d|| jd| t||||dtdI dH S )r^   r_   r`   rR   ra   Nrb   re   r1   r1   r2   rf        zAsyncEvals.retriever%   c             	     sR   |s
t d|| jd| t||dtjI dH t||||dtdI dH S )rh   r_   r`   ri   NrR   rS   )rc   rW   r   r
   rj   r!   r%   rk   r1   r1   r2   rl     s    "zAsyncEvals.updaterm   rn   ro   rr   rp   rs   rq   rt   CAsyncPaginator[EvalListResponse, AsyncCursorPage[EvalListResponse]]c          	      C  rv   rw   )r{   r   r"   r!   r   r   r|   r}   r1   r1   r2   r~     r   zAsyncEvals.listr$   c                  r   )r   r_   r`   rR   ra   Nr   re   r1   r1   r2   r     r   zAsyncEvals.delete)r+   r   )r+   r   )r+   r   r   r   r   )rn   rJ   ro   rr   rp   rs   rq   rt   rA   rK   rB   rL   rC   rM   rD   rN   r+   r   r   r   r1   r1   r1   r2   r)   -  r   c                   @  $   e Zd ZdddZeddd	Zd
S )r5   evalsr(   r+   Nonec                 C  P   || _ t|j| _t|j| _t|j| _t|j| _t|j| _d S r-   )_evalsr   to_raw_response_wrapperrZ   rf   rl   r~   r   r0   r   r1   r1   r2   __init__6      
zEvalsWithRawResponse.__init__r   c                 C     t | jjS r-   )r   r   r3   r/   r1   r1   r2   r3   I     zEvalsWithRawResponse.runsNr   r(   r+   r   )r+   r   r   r   r   r   r   r3   r1   r1   r1   r2   r5   5      
r5   c                   @  r   )r   r   r)   r+   r   c                 C  r   r-   )r   r   async_to_raw_response_wrapperrZ   rf   rl   r~   r   r   r1   r1   r2   r   O  r   z"AsyncEvalsWithRawResponse.__init__r   c                 C  r   r-   )r   r   r3   r/   r1   r1   r2   r3   b  r   zAsyncEvalsWithRawResponse.runsNr   r)   r+   r   )r+   r   r   r1   r1   r1   r2   r   N  r   r   c                   @  r   )r:   r   r(   r+   r   c                 C  F   || _ t|j| _t|j| _t|j| _t|j| _t|j| _d S r-   )r   r   rZ   rf   rl   r~   r   r   r1   r1   r2   r   h      
z#EvalsWithStreamingResponse.__init__r   c                 C  r   r-   )r   r   r3   r/   r1   r1   r2   r3   {  r   zEvalsWithStreamingResponse.runsNr   )r+   r   r   r1   r1   r1   r2   r:   g  r   r:   c                   @  r   )r   r   r)   r+   r   c                 C  r   r-   )r   r   rZ   rf   rl   r~   r   r   r1   r1   r2   r     r   z(AsyncEvalsWithStreamingResponse.__init__r   c                 C  r   r-   )r   r   r3   r/   r1   r1   r2   r3     r   z$AsyncEvalsWithStreamingResponse.runsNr   )r+   r   r   r1   r1   r1   r2   r     r   r   )?
__future__r   typingr   r   typing_extensionsr   httpx r   typesr   r	   r
   _typesr   r   r   r   r   _utilsr   r   _compatr   	runs.runsr   r   r   r   r   r   	_resourcer   r   	_responser   r   
paginationr   r   _base_clientr    r!   types.eval_list_responser"   types.eval_create_responser#   types.eval_delete_responser$   types.eval_update_responser%   types.eval_retrieve_responser&   types.shared_params.metadatar'   __all__r(   r)   r5   r   r:   r   r1   r1   r1   r2   <module>   s>      
  
