
    2Rj f                       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mZmZ ddlmZ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/m0Z0 ddl1m2Z2 ddl3m4Z4 ddl5m6Z6 ddl7m8Z8 ddgZ9 G d de      Z: G d de      Z; G d d      Z< G d d      Z= G d d       Z> G d! d"      Z?y)#    )annotations)Optional)LiteralN   )_legacy_response)BodyOmitQueryHeadersNotGivenomit	not_given)path_template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            	      L   e Zd 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eeddde	d
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddde	d	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddde	d	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)r*   ,Manage and run evals in the OpenAI platform.c                ,    t        | j                        S r-   )r   _clientselfs    h/var/www/html/meridian/meridian-ai/venv/lib/python3.12/site-packages/openai/resources/evals/runs/runs.pyoutput_itemszRuns.output_items(   s     4<<((    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
        )RunsWithRawResponser1   s    r3   with_raw_responsezRuns.with_raw_response-   s     #4((r5   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
        )RunsWithStreamingResponser1   s    r3   with_streaming_responsezRuns.with_streaming_response7   s     )..r5   Nmetadatanameextra_headersextra_query
extra_bodytimeoutc                   |st        d|      | j                  t        d|      t        |||dt        j
                        t        ||||ddi      t              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/{eval_id}/runseval_iddata_sourcer?   r@   bearer_authTrA   rB   rC   rD   securitybodyoptionscast_to)
ValueError_postr   r   r!   RunCreateParamsr#   r'   	r2   rJ   rL   r?   r@   rA   rB   rC   rD   s	            r3   createzRuns.create@   s    N UV]U`abbzz17C #. ( 
 "11 )+'%'. &#  
 	
r5   rA   rB   rC   rD   c                   |st        d|      |st        d|      | j                  t        d||      t        ||||ddi      t              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
        rG   5Expected a non-empty value for `run_id` but received /evals/{eval_id}/runs/{run_id}rJ   run_idrM   TrN   rR   rS   rT   _getr   r#   r)   r2   r_   rJ   rA   rB   rC   rD   s          r3   retrievezRuns.retrieve}   sy    0 UV]U`abbTU[T^_``yy:GTZ[(+'%'. (  

 
	
r5   afterlimitorderstatusrA   rB   rC   rD   c                   |st        d|      | j                  t        d|      t        t           t        ||||	t        ||||dt        j                        ddi      t              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
        rG   rH   rI   )rf   rg   rh   ri   rM   T)rA   rB   rC   rD   queryrO   )pagerR   model)	rT   _get_api_listr   r   r%   r#   r   r    RunListParams
r2   rJ   rf   rg   rh   ri   rA   rB   rC   rD   s
             r3   listz	Runs.list   s    J UV]U`abb!!17C0(+'%%!&!&!&"(	 $11 (.  "' " 
 	
r5   c                   |st        d|      |st        d|      | j                  t        d||      t        ||||ddi      t              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
        rG   r\   r]   r^   rM   TrN   r`   rT   _deleter   r#   r(   rc   s          r3   deletezRuns.delete   sy    0 UV]U`abbTU[T^_``||:GTZ[(+'%'. &  

 
	
r5   c                   |st        d|      |st        d|      | j                  t        d||      t        ||||ddi      t              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
        rG   r\   r]   r^   rM   TrN   r`   rT   rU   r   r#   r&   rc   s          r3   cancelzRuns.cancel
  sy    0 UV]U`abbTU[T^_``zz:GTZ[(+'%'. &  

 
	
r5   )returnr   )r|   r8   )r|   r<   rJ   strrL   zrun_create_params.DataSourcer?   zOptional[Metadata] | Omitr@   
str | OmitrA   Headers | NonerB   Query | NonerC   Body | NonerD   'float | httpx.Timeout | None | NotGivenr|   r'   r_   r~   rJ   r~   rA   r   rB   r   rC   r   rD   r   r|   r)   )rJ   r~   rf   r   rg   
int | Omitrh   Literal['asc', 'desc'] | Omitri   JLiteral['queued', 'in_progress', 'completed', 'canceled', 'failed'] | OmitrA   r   rB   r   rC   r   rD   r   r|   zSyncCursorPage[RunListResponse]r_   r~   rJ   r~   rA   r   rB   r   rC   r   rD   r   r|   r(   r_   r~   rJ   r~   rA   r   rB   r   rC   r   rD   r   r|   r&   __name__
__module____qualname____doc__r   r4   r9   r=   r   r   rX   rd   rr   rw   r{    r5   r3   r*   r*   %   s?   6) ) ) ) / / /3 )-$("&;D;
;
 2	;

 ,;
 ;
 &;
 ";
  ;
 9;
 
;
H )-$("&;D&
&
 	&
 &&
 "&
  &
 9&
 
&
X ! /3]a )-$("&;D;
;
 	;

 ;
 -;
 [;
 &;
 ";
  ;
 9;
 
);
H )-$("&;D&
&
 	&
 &&
 "&
  &
 9&
 
&
^ )-$("&;D&
&
 	&
 &&
 "&
  &
 9&
 
&
r5   c            	      L   e Zd 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eeddde	d
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddde	d	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddde	d	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)r+   r-   c                ,    t        | j                        S r/   )r   r0   r1   s    r3   r4   zAsyncRuns.output_items6  s      --r5   c                    t        |       S r7   )AsyncRunsWithRawResponser1   s    r3   r9   zAsyncRuns.with_raw_response;  s     (--r5   c                    t        |       S r;   )AsyncRunsWithStreamingResponser1   s    r3   r=   z!AsyncRuns.with_streaming_responseE  s     .d33r5   Nr>   c                  K   |st        d|      | j                  t        d|      t        |||dt        j
                         d{   t        ||||ddi      t        	       d{   S 7 '7 w)
rF   rG   rH   rI   rK   NrM   TrN   rP   )rT   rU   r   r   r!   rV   r#   r'   rW   s	            r3   rX   zAsyncRuns.createN  s     N UV]U`abbZZ17C,#. ( 
 "11  )+'%'. &#   
 
 	

s$   A	A7A3
"A7.A5/A75A7rY   c                  K   |st        d|      |st        d|      | j                  t        d||      t        ||||ddi      t               d	{   S 7 w)
r[   rG   r\   r]   r^   rM   TrN   r`   Nra   rc   s          r3   rd   zAsyncRuns.retrieve  s     0 UV]U`abbTU[T^_``YY:GTZ[(+'%'. (  

 

 
	
 

   AA!AA!re   c                   |st        d|      | j                  t        d|      t        t           t        ||||	t        ||||dt        j                        ddi      t              S rk   )	rT   ro   r   r   r%   r#   r   r    rp   rq   s
             r3   rr   zAsyncRuns.list  s    J UV]U`abb!!17C 1(+'%%!&!&!&"(	 $11 (.  "' " 
 	
r5   c                  K   |st        d|      |st        d|      | j                  t        d||      t        ||||ddi      t               d	{   S 7 w)
rt   rG   r\   r]   r^   rM   TrN   r`   Nru   rc   s          r3   rw   zAsyncRuns.delete  s     0 UV]U`abbTU[T^_``\\:GTZ[(+'%'. & " 

 

 
	
 

r   c                  K   |st        d|      |st        d|      | j                  t        d||      t        ||||ddi      t               d	{   S 7 w)
ry   rG   r\   r]   r^   rM   TrN   r`   Nrz   rc   s          r3   r{   zAsyncRuns.cancel  s     0 UV]U`abbTU[T^_``ZZ:GTZ[(+'%'. &   

 

 
	
 

r   )r|   r   )r|   r   )r|   r   r}   r   )rJ   r~   rf   r   rg   r   rh   r   ri   r   rA   r   rB   r   rC   r   rD   r   r|   zAAsyncPaginator[RunListResponse, AsyncCursorPage[RunListResponse]]r   r   r   r   r5   r3   r+   r+   3  s@   6. . . . 4 4 /3 )-$("&;D;
;
 2	;

 ,;
 ;
 &;
 ";
  ;
 9;
 
;
H )-$("&;D&
&
 	&
 &&
 "&
  &
 9&
 
&
X ! /3]a )-$("&;D;
;
 	;

 ;
 -;
 [;
 &;
 ";
  ;
 9;
 
K;
H )-$("&;D&
&
 	&
 &&
 "&
  &
 9&
 
&
^ )-$("&;D&
&
 	&
 &&
 "&
  &
 9&
 
&
r5   c                  &    e Zd ZddZedd       Zy)r8   c                z   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j
                        | _        t        j                  |j                        | _        t        j                  |j                        | _        y N)_runsr   to_raw_response_wrapperrX   rd   rr   rw   r{   r2   runss     r3   __init__zRunsWithRawResponse.__init__B  s    
&>>KK
 )@@MM
 %<<II
	 '>>KK
 '>>KK
r5   c                @    t        | j                  j                        S r/   )r   r   r4   r1   s    r3   r4   z RunsWithRawResponse.output_itemsU  s     *$***A*ABBr5   Nr   r*   r|   None)r|   r   r   r   r   r   r   r4   r   r5   r3   r8   r8   A  s    
& C Cr5   r8   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_wrapperrX   rd   rr   rw   r{   r   s     r3   r   z!AsyncRunsWithRawResponse.__init__\  s    
&DDKK
 )FFMM
 %BBII
	 'DDKK
 'DDKK
r5   c                @    t        | j                  j                        S r/   )r   r   r4   r1   s    r3   r4   z%AsyncRunsWithRawResponse.output_itemso  s     /tzz/F/FGGr5   Nr   r+   r|   r   )r|   r   r   r   r5   r3   r   r   [  s    
& H Hr5   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   rX   rd   rr   rw   r{   r   s     r3   r   z"RunsWithStreamingResponse.__init__v  sp    
2KK
 5MM
 1II
	 3KK
 3KK
r5   c                @    t        | j                  j                        S r/   )r   r   r4   r1   s    r3   r4   z&RunsWithStreamingResponse.output_items  s     0

0G0GHHr5   Nr   )r|   r   r   r   r5   r3   r<   r<   u  s    
& I Ir5   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   rX   rd   rr   rw   r{   r   s     r3   r   z'AsyncRunsWithStreamingResponse.__init__  sp    
8KK
 ;MM
 7II
	 9KK
 9KK
r5   c                @    t        | j                  j                        S r/   )r   r   r4   r1   s    r3   r4   z+AsyncRunsWithStreamingResponse.output_items  s     5TZZ5L5LMMr5   Nr   )r|   r   r   r   r5   r3   r   r     s    
& N Nr5   r   )@
__future__r   typingr   typing_extensionsr   httpx r   _typesr   r	   r
   r   r   r   r   _utilsr   r   r   _compatr   	_resourcer   r   	_responser   r   r4   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+   r8   r   r<   r   r   r5   r3   <module>r      s    #  %  ! L L L L L ' ; Z  ; > A 5 = A A A E;
K
? K
\K
  K
\C C4H H4I I4N Nr5   