
    R1ib                       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Z8 G d de!      Z9 G d de"      Z: G d d      Z; G d d      Z< G d d       Z= G d! d"      Z>y)#    )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            	      D   e Zd Zedd       Zedd       Zedd       Ze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
eeeeddded
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddded	 	 	 	 	 	 	 	 	 	 	 ddZy)r)   c                ,    t        | j                        S N)r   _clientselfs    `/home/cursorai/projects/iching/venv/lib/python3.12/site-packages/openai/resources/evals/evals.pyrunsz
Evals.runs&   s    DLL!!    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
        )EvalsWithRawResponser/   s    r1   with_raw_responsezEvals.with_raw_response*   s     $D))r3   c                    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
        )EvalsWithStreamingResponser/   s    r1   with_streaming_responsezEvals.with_streaming_response4   s     *$//r3   Nmetadatanameextra_headersextra_query
extra_bodytimeoutc          
         | j                  dt        ||||dt        j                        t	        ||||      t
              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 a datasource. 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.

          testing_criteria: A list of graders for all eval runs in this group.

          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data_source_configtesting_criteriar=   r>   r?   r@   rA   rB   bodyoptionscast_to)_postr   r
   EvalCreateParamsr"   r$   	r0   rG   rH   r=   r>   r?   r@   rA   rB   s	            r1   createzEvals.create=   s\    V zz *<(8 ( 	 #33 )+Q[el '  
 	
r3   rI   c          	     r    |st        d|      | j                  d| t        ||||      t              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/rI   rL   rM   
ValueError_getr"   r'   r0   eval_idr?   r@   rA   rB   s         r1   retrievezEvals.retrievey   sT    . UV]U`abbyygY(+Q[el )  
 	
r3   c          
         |st        d|      | j                  d| t        ||dt        j                        t        ||||      t              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
        rT   rU   r=   r>   rI   rJ   )rX   rN   r   r   EvalUpdateParamsr"   r&   r0   r[   r=   r>   r?   r@   rA   rB   s           r1   updatezEvals.update   su    D UV]U`abbzzgY  (  #33 )+Q[el '  
 	
r3   afterlimitorderorder_byr?   r@   rA   rB   c                   | j                  dt        t           t        ||||t	        ||||dt
        j                              t              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
        rE   )rd   re   rf   rg   )r?   r@   rA   rB   query)pagerL   model)_get_api_listr   r#   r"   r   r	   EvalListParams	r0   rd   re   rf   rg   r?   r@   rA   rB   s	            r1   listz
Evals.list   sf    H !! 01(+'%%!&!&!&$,	 %33 #% " 
 	
r3   c          	     r    |st        d|      | j                  d| t        ||||      t              S )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
        rT   rU   rI   rV   rX   _deleter"   r%   rZ   s         r1   deletezEvals.delete  sT    . UV]U`abb||gY(+Q[el '  
 	
r3   )returnr   )rv   r6   )rv   r:   rG   z#eval_create_params.DataSourceConfigrH   z-Iterable[eval_create_params.TestingCriterion]r=   Optional[Metadata] | NotGivenr>   str | NotGivenr?   Headers | Noner@   Query | NonerA   Body | NonerB   'float | httpx.Timeout | None | NotGivenrv   r$   r[   strr?   rz   r@   r{   rA   r|   rB   r}   rv   r'   r[   r   r=   rx   r>   ry   r?   rz   r@   r{   rA   r|   rB   r}   rv   r&   )rd   ry   re   int | NotGivenrf   !Literal['asc', 'desc'] | NotGivenrg   .Literal['created_at', 'updated_at'] | NotGivenr?   rz   r@   r{   rA   r|   rB   r}   rv   z SyncCursorPage[EvalListResponse]r[   r   r?   rz   r@   r{   rA   r|   rB   r}   rv   r%   __name__
__module____qualname__r   r2   r7   r;   r   rQ   r\   rb   rp   ru    r3   r1   r)   r)   %   s6   " " * * 0 0 3<( )-$("&;D:
 @:
 H	:

 0:
 :
 &:
 ":
  :
 9:
 
:
D )-$("&;D

 &
 "
  
 9
 

J 3<( )-$("&;D1
1
 0	1

 1
 &1
 "1
  1
 91
 
1
l !* )3<CL )-$("&;D7
 7
 	7

 17
 A7
 &7
 "7
  7
 97
 
*7
~ )-$("&;D

 &
 "
  
 9
 

r3   c            	      D   e Zd Zedd       Zedd       Zedd       Ze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
eeeeddded
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddded	 	 	 	 	 	 	 	 	 	 	 ddZy)r*   c                ,    t        | j                        S r-   )r   r.   r/   s    r1   r2   zAsyncEvals.runs)  s    &&r3   c                    t        |       S r5   )AsyncEvalsWithRawResponser/   s    r1   r7   zAsyncEvals.with_raw_response-  s     )..r3   c                    t        |       S r9   )AsyncEvalsWithStreamingResponser/   s    r1   r;   z"AsyncEvals.with_streaming_response7  s     /t44r3   Nr<   c          
        K   | j                  dt        ||||dt        j                         d{   t	        ||||      t
               d{   S 7 $7 w)rD   rE   rF   NrI   rJ   )rN   r   r
   rO   r"   r$   rP   s	            r1   rQ   zAsyncEvals.create@  su     V ZZ,*<(8 ( 	 #33  )+Q[el '   
 
 	

s!   /AA
AAAArI   c          	        K   |st        d|      | j                  d| t        ||||      t               d{   S 7 w)rS   rT   rU   rI   rV   NrW   rZ   s         r1   r\   zAsyncEvals.retrieve|  sb     . UV]U`abbYYgY(+Q[el )  
 
 	
 
   <AAAc          
        K   |st        d|      | j                  d| t        ||dt        j                         d{   t        ||||      t               d{   S 7 $7 w)r^   rT   rU   r_   NrI   rJ   )rX   rN   r   r   r`   r"   r&   ra   s           r1   rb   zAsyncEvals.update  s     D UV]U`abbZZgY, (  #33  )+Q[el '   
 
 	

s$   A A+A'
A+"A)#A+)A+rc   c                   | j                  dt        t           t        ||||t	        ||||dt
        j                              t              S ri   )rm   r    r#   r"   r   r	   rn   ro   s	            r1   rp   zAsyncEvals.list  sf    H !! !12(+'%%!&!&!&$,	 %33 #% " 
 	
r3   c          	        K   |st        d|      | j                  d| t        ||||      t               d{   S 7 w)rr   rT   rU   rI   rV   Nrs   rZ   s         r1   ru   zAsyncEvals.delete	  sb     . UV]U`abb\\gY(+Q[el ' " 
 
 	
 
r   )rv   r   )rv   r   )rv   r   rw   r~   r   )rd   ry   re   r   rf   r   rg   r   r?   rz   r@   r{   rA   r|   rB   r}   rv   zCAsyncPaginator[EvalListResponse, AsyncCursorPage[EvalListResponse]]r   r   r   r3   r1   r*   r*   (  s7   ' ' / / 5 5 3<( )-$("&;D:
 @:
 H	:

 0:
 :
 &:
 ":
  :
 9:
 
:
D )-$("&;D

 &
 "
  
 9
 

J 3<( )-$("&;D1
1
 0	1

 1
 &1
 "1
  1
 91
 
1
l !* )3<CL )-$("&;D7
 7
 	7

 17
 A7
 &7
 "7
  7
 97
 
M7
~ )-$("&;D

 &
 "
  
 9
 

r3   c                  &    e Zd ZddZedd       Zy)r6   c                z   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j
                        | _        t        j                  |j                        | _        t        j                  |j                        | _        y r-   )_evalsr   to_raw_response_wrapperrQ   r\   rb   rp   ru   r0   evalss     r1   __init__zEvalsWithRawResponse.__init__,  s    &>>LL
 )@@NN
 '>>LL
 %<<JJ
	 '>>LL
r3   c                @    t        | j                  j                        S r-   )r   r   r2   r/   s    r1   r2   zEvalsWithRawResponse.runs?  s    "4;;#3#344r3   Nr   r)   rv   None)rv   r   r   r   r   r   r   r2   r   r3   r1   r6   r6   +  s    
& 5 5r3   r6   c                  &    e Zd ZddZedd       Zy)r   c                z   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j
                        | _        t        j                  |j                        | _        t        j                  |j                        | _        y r-   )r   r   async_to_raw_response_wrapperrQ   r\   rb   rp   ru   r   s     r1   r   z"AsyncEvalsWithRawResponse.__init__E  s    &DDLL
 )FFNN
 'DDLL
 %BBJJ
	 'DDLL
r3   c                @    t        | j                  j                        S r-   )r   r   r2   r/   s    r1   r2   zAsyncEvalsWithRawResponse.runsX  s    '(8(899r3   Nr   r*   rv   r   )rv   r   r   r   r3   r1   r   r   D  s    
& : :r3   r   c                  &    e Zd ZddZedd       Zy)r:   c                   || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        t        |j                        | _        y r-   )r   r   rQ   r\   rb   rp   ru   r   s     r1   r   z#EvalsWithStreamingResponse.__init__^  sp    2LL
 5NN
 3LL
 1JJ
	 3LL
r3   c                @    t        | j                  j                        S r-   )r   r   r2   r/   s    r1   r2   zEvalsWithStreamingResponse.runsq  s    ()9)9::r3   Nr   )rv   r   r   r   r3   r1   r:   r:   ]  s    
& ; ;r3   r:   c                  &    e Zd ZddZedd       Zy)r   c                   || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        t        |j                        | _        y r-   )r   r   rQ   r\   rb   rp   ru   r   s     r1   r   z(AsyncEvalsWithStreamingResponse.__init__w  sp    8LL
 ;NN
 9LL
 7JJ
	 9LL
r3   c                @    t        | j                  j                        S r-   )r   r   r2   r/   s    r1   r2   z$AsyncEvalsWithStreamingResponse.runs  s    -dkk.>.>??r3   Nr   )rv   r   r   r   r3   r1   r   r   v  s    
& @ @r3   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*   r6   r   r:   r   r   r3   r1   <module>r      s    # % %    M M ? ? < &  ; Y 9 @ 8 < < < @ 4L
!@
O @
F@
! @
F5 52: :2; ;2@ @r3   