
    dh%d                       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            	      J   e Zd Zedd       Zedd       Zedd       Ze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    a/var/www/html/lionshead-backend/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_response7   s     *$//r3   Nmetadatanameshare_with_openai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.

          share_with_openai: Indicates whether the evaluation is shared with OpenAI.

          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   rC   bodyoptionscast_to)_postr   r
   EvalCreateParamsr"   r$   
r0   rH   rI   r=   r>   r?   r@   rA   rB   rC   s
             r1   createzEvals.create@   s_    \ zz *<(8 ( ): #33	 )+Q[el '  
 	
r3   rJ   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/rJ   rM   rN   
ValueError_getr"   r'   r0   eval_idr@   rA   rB   rC   s         r1   retrievezEvals.retrieve   sT    . UV]U`abbyygY(+Q[el )  
 	
r3   r=   r>   r@   rA   rB   rC   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
        rU   rV   r=   r>   rJ   rK   )rY   rO   r   r   EvalUpdateParamsr"   r&   r0   r\   r=   r>   r@   rA   rB   rC   s           r1   updatezEvals.update   su    D UV]U`abbzzgY  (  #33 )+Q[el '  
 	
r3   afterlimitorderorder_byr@   rA   rB   rC   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
        rF   )rf   rg   rh   ri   )r@   rA   rB   rC   query)pagerM   model)_get_api_listr   r#   r"   r   r	   EvalListParams	r0   rf   rg   rh   ri   r@   rA   rB   rC   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
        rU   rV   rJ   rW   rY   _deleter"   r%   r[   s         r1   deletezEvals.delete  sT    . UV]U`abb||gY(+Q[el '  
 	
r3   )returnr   )rx   r6   )rx   r:   rH   z#eval_create_params.DataSourceConfigrI   z-Iterable[eval_create_params.TestingCriterion]r=   Optional[Metadata] | NotGivenr>   str | NotGivenr?   zbool | NotGivenr@   Headers | NonerA   Query | NonerB   Body | NonerC   'float | httpx.Timeout | None | NotGivenrx   r$   r\   strr@   r|   rA   r}   rB   r~   rC   r   rx   r'   r\   r   r=   rz   r>   r{   r@   r|   rA   r}   rB   r~   rC   r   rx   r&   )rf   r{   rg   int | NotGivenrh   !Literal['asc', 'desc'] | NotGivenri   .Literal['created_at', 'updated_at'] | NotGivenr@   r|   rA   r}   rB   r~   rC   r   rx   z SyncCursorPage[EvalListResponse]r\   r   r@   r|   rA   r}   rB   r~   rC   r   rx   r%   __name__
__module____qualname__r   r2   r7   r;   r   rR   r]   rd   rr   rw    r3   r1   r)   r)   (   sC   " " * * 0 0 3<(-6 )-$("&;D>
 @>
 H	>

 0>
 >
 +>
 &>
 ">
  >
 9>
 
>
L )-$("&;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            	      J   e Zd Zedd       Zedd       Zedd       Ze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.runs0  s    &&r3   c                    t        |       S r5   )AsyncEvalsWithRawResponser/   s    r1   r7   zAsyncEvals.with_raw_response4  s     )..r3   c                    t        |       S r9   )AsyncEvalsWithStreamingResponser/   s    r1   r;   z"AsyncEvals.with_streaming_response>  s     /t44r3   Nr<   c       	           K   | j                  dt        |||||dt        j                         d{   t	        ||||	      t
               d{   S 7 $7 w)rE   rF   rG   NrJ   rK   )rO   r   r
   rP   r"   r$   rQ   s
             r1   rR   zAsyncEvals.createG  sx     \ ZZ,*<(8 ( ): #33	 	 )+Q[el '   
 
 	
	
s!   0AA
AAAArJ   c          	        K   |st        d|      | j                  d| t        ||||      t               d{   S 7 w)rT   rU   rV   rJ   rW   NrX   r[   s         r1   r]   zAsyncEvals.retrieve  sb     . UV]U`abbYYgY(+Q[el )  
 
 	
 
   <AAAr^   c          
        K   |st        d|      | j                  d| t        ||dt        j                         d{   t        ||||      t               d{   S 7 $7 w)r`   rU   rV   ra   NrJ   rK   )rY   rO   r   r   rb   r"   r&   rc   s           r1   rd   zAsyncEvals.update  s     D UV]U`abbZZgY, (  #33  )+Q[el '   
 
 	

s$   A A+A'
A+"A)#A+)A+re   c                   | j                  dt        t           t        ||||t	        ||||dt
        j                              t              S rk   )ro   r    r#   r"   r   r	   rp   rq   s	            r1   rr   zAsyncEvals.list  sf    H !! !12(+'%%!&!&!&$,	 %33 #% " 
 	
r3   c          	        K   |st        d|      | j                  d| t        ||||      t               d{   S 7 w)rt   rU   rV   rJ   rW   Nru   r[   s         r1   rw   zAsyncEvals.delete  sb     . UV]U`abb\\gY(+Q[el ' " 
 
 	
 
r   )rx   r   )rx   r   )rx   r   ry   r   r   )rf   r{   rg   r   rh   r   ri   r   r@   r|   rA   r}   rB   r~   rC   r   rx   zCAsyncPaginator[EvalListResponse, AsyncCursorPage[EvalListResponse]]r   r   r   r3   r1   r*   r*   /  sD   ' ' / / 5 5 3<(-6 )-$("&;D>
 @>
 H	>

 0>
 >
 +>
 &>
 ">
  >
 9>
 
>
L )-$("&;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_wrapperrR   r]   rd   rr   rw   r0   evalss     r1   __init__zEvalsWithRawResponse.__init__7  s    &>>LL
 )@@NN
 '>>LL
 %<<JJ
	 '>>LL
r3   c                @    t        | j                  j                        S r-   )r   r   r2   r/   s    r1   r2   zEvalsWithRawResponse.runsJ  s    "4;;#3#344r3   Nr   r)   rx   None)rx   r   r   r   r   r   r   r2   r   r3   r1   r6   r6   6  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_wrapperrR   r]   rd   rr   rw   r   s     r1   r   z"AsyncEvalsWithRawResponse.__init__P  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.runsc  s    '(8(899r3   Nr   r*   rx   r   )rx   r   r   r   r3   r1   r   r   O  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   rR   r]   rd   rr   rw   r   s     r1   r   z#EvalsWithStreamingResponse.__init__i  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.runs|  s    ()9)9::r3   Nr   )rx   r   r   r   r3   r1   r:   r:   h  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   rR   r]   rd   rr   rw   r   s     r1   r   z(AsyncEvalsWithStreamingResponse.__init__  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   )rx   r   r   r   r3   r1   r   r     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
!D
O D
ND
! D
N5 52: :2; ;2@ @r3   