
    ib                       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    q/Users/manta/Documents/Projects/TheRoad-I1/.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        ||||      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@   rA   rB   rC   rD   bodyoptionscast_to)
ValueError_postr   r   r!   RunCreateParamsr#   r'   	r2   rJ   rL   r?   r@   rA   rB   rC   rD   s	            r3   createzRuns.create@   sy    N UV]U`abbzz17C #. ( 
 "11 )+Q[el &  
 	
r5   rM   c          	         |st        d|      |st        d|      | j                  t        d||      t        ||||      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   rP   rQ   rR   _getr   r#   r)   r2   r\   rJ   rA   rB   rC   rD   s          r3   retrievezRuns.retrievey   sp    0 UV]U`abbTU[T^_``yy:GTZ[(+Q[el (  
 	
r5   afterlimitorderstatusrA   rB   rC   rD   c                   |st        d|      | j                  t        d|      t        t           t        ||||	t        ||||dt        j                              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   )rc   rd   re   rf   )rA   rB   rC   rD   query)pagerP   model)	rR   _get_api_listr   r   r%   r#   r   r    RunListParams
r2   rJ   rc   rd   re   rf   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        ||||      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   rY   rZ   r[   rM   r]   rR   _deleter   r#   r(   r`   s          r3   deletezRuns.delete   sp    0 UV]U`abbTU[T^_``||:GTZ[(+Q[el &  
 	
r5   c          	         |st        d|      |st        d|      | j                  t        d||      t        ||||      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   rY   rZ   r[   rM   r]   rR   rS   r   r#   r&   r`   s          r3   cancelzRuns.cancel   sp    0 UV]U`abbTU[T^_``zz:GTZ[(+Q[el &  
 	
r5   )returnr   )ry   r8   )ry   r<   rJ   strrL   zrun_create_params.DataSourcer?   zOptional[Metadata] | Omitr@   
str | OmitrA   Headers | NonerB   Query | NonerC   Body | NonerD   'float | httpx.Timeout | None | NotGivenry   r'   r\   r{   rJ   r{   rA   r}   rB   r~   rC   r   rD   r   ry   r)   )rJ   r{   rc   r|   rd   
int | Omitre   Literal['asc', 'desc'] | Omitrf   JLiteral['queued', 'in_progress', 'completed', 'canceled', 'failed'] | OmitrA   r}   rB   r~   rC   r   rD   r   ry   zSyncCursorPage[RunListResponse]r\   r{   rJ   r{   rA   r}   rB   r~   rC   r   rD   r   ry   r(   r\   r{   rJ   r{   rA   r}   rB   r~   rC   r   rD   r   ry   r&   __name__
__module____qualname____doc__r   r4   r9   r=   r   r   rV   ra   ro   rt   rx    r5   r3   r*   r*   %   s?   6) ) ) ) / / /3 )-$("&;D7
7
 2	7

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

 :
 -:
 [:
 &:
 ":
  :
 9:
 
):
F )-$("&;D"
"
 	"
 &"
 ""
  "
 9"
 
"
V )-$("&;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_items%  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_response4  s     .d33r5   Nr>   c          
        K   |st        d|      | j                  t        d|      t        |||dt        j
                         d{   t        ||||      t               d{   S 7 $7 w)rF   rG   rH   rI   rK   NrM   rN   )rR   rS   r   r   r!   rT   r#   r'   rU   s	            r3   rV   zAsyncRuns.create=  s     N UV]U`abbZZ17C,#. ( 
 "11  )+Q[el &   
 
 	

s$   A	A4A0
A4+A2,A42A4rM   c          	        K   |st        d|      |st        d|      | j                  t        d||      t        ||||      t               d{   S 7 w)rX   rG   rY   rZ   r[   rM   r]   Nr^   r`   s          r3   ra   zAsyncRuns.retrievev  s~     0 UV]U`abbTU[T^_``YY:GTZ[(+Q[el (  
 
 	
 
   AAAArb   c                   |st        d|      | j                  t        d|      t        t           t        ||||	t        ||||dt        j                              t              S rh   )	rR   rl   r   r   r%   r#   r   r    rm   rn   s
             r3   ro   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        ||||      t               d{   S 7 w)rq   rG   rY   rZ   r[   rM   r]   Nrr   r`   s          r3   rt   zAsyncRuns.delete  s~     0 UV]U`abbTU[T^_``\\:GTZ[(+Q[el & " 
 
 	
 
r   c          	        K   |st        d|      |st        d|      | j                  t        d||      t        ||||      t               d{   S 7 w)rv   rG   rY   rZ   r[   rM   r]   Nrw   r`   s          r3   rx   zAsyncRuns.cancel  s~     0 UV]U`abbTU[T^_``ZZ:GTZ[(+Q[el &   
 
 	
 
r   )ry   r   )ry   r   )ry   r   rz   r   )rJ   r{   rc   r|   rd   r   re   r   rf   r   rA   r}   rB   r~   rC   r   rD   r   ry   zAAsyncPaginator[RunListResponse, AsyncCursorPage[RunListResponse]]r   r   r   r   r5   r3   r+   r+   "  s@   6. . . . 4 4 /3 )-$("&;D7
7
 2	7

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

 :
 -:
 [:
 &:
 ":
  :
 9:
 
K:
F )-$("&;D"
"
 	"
 &"
 ""
  "
 9"
 
"
V )-$("&;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_wrapperrV   ra   ro   rt   rx   r2   runss     r3   __init__zRunsWithRawResponse.__init__   s    
&>>KK
 )@@MM
 %<<II
	 '>>KK
 '>>KK
r5   c                @    t        | j                  j                        S r/   )r   r   r4   r1   s    r3   r4   z RunsWithRawResponse.output_items3  s     *$***A*ABBr5   Nr   r*   ry   None)ry   r   r   r   r   r   r   r4   r   r5   r3   r8   r8     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_wrapperrV   ra   ro   rt   rx   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_itemsM  s     /tzz/F/FGGr5   Nr   r+   ry   r   )ry   r   r   r   r5   r3   r   r   9  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   rV   ra   ro   rt   rx   r   s     r3   r   z"RunsWithStreamingResponse.__init__T  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_itemsg  s     0

0G0GHHr5   Nr   )ry   r   r   r   r5   r3   r<   r<   S  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   rV   ra   ro   rt   rx   r   s     r3   r   z'AsyncRunsWithStreamingResponse.__init__n  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   )ry   r   r   r   r5   r3   r   r   m  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;
z
? z
zz
  z
zC C4H H4I I4N Nr5   