o
    {$f/                     @  s  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 ddl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 ddlmZmZ ddlmZ ddlm Z  ddgZ!G dd deZ"G 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)LiteralN   )_legacy_response)	NOT_GIVENBodyQueryHeadersNotGiven)maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)SyncCursorPageAsyncCursorPage)AsyncPaginatormake_request_options)step_list_params)RunStepSteps
AsyncStepsc                	   @  \   e Zd Zed$ddZed%ddZddded	d&ddZeeeedddedd'd"d#ZdS )(r   returnStepsWithRawResponsec                 C     t | S N)r   self r    ^/var/www/html/dev/env/lib/python3.10/site-packages/openai/resources/beta/threads/runs/steps.pywith_raw_response      zSteps.with_raw_responseStepsWithStreamingResponsec                 C  r   r   )r$   r   r    r    r!   with_streaming_response   r#   zSteps.with_streaming_responseNextra_headersextra_query
extra_bodytimeoutstep_idstr	thread_idrun_idr'   Headers | Noner(   Query | Noner)   Body | Noner*   'float | httpx.Timeout | None | NotGivenr   c                C  st   |s	t d||st d||st d|ddi|p!i }| jd| d| d| t||||d	td
S )I  
        Retrieves a run step.

        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
        8Expected a non-empty value for `thread_id` but received 5Expected a non-empty value for `run_id` but received 6Expected a non-empty value for `step_id` but received OpenAI-Betaassistants=v2	/threads//runs//steps/r&   optionscast_to
ValueError_getr   r   r   r+   r-   r.   r'   r(   r)   r*   r    r    r!   retrieve#   s   zSteps.retrieveafterbeforelimitorderr'   r(   r)   r*   rE   str | NotGivenrF   rG   int | NotGivenrH   !Literal['asc', 'desc'] | NotGivenSyncCursorPage[RunStep]c       	         C  x   |s	t d||st d|ddi|pi }| jd| d| dtt t|||	|
t||||dtjd	td
S a!  
        Returns a list of run steps belonging to a run.

        Args:
          after: A cursor for use in pagination. `after` is an object ID that defines your place
              in the list. For instance, if you make a list request and receive 100 objects,
              ending with obj_foo, your subsequent call can include after=obj_foo in order to
              fetch the next page of the list.

          before: A cursor for use in pagination. `before` is an object ID that defines your place
              in the list. For instance, if you make a list request and receive 100 objects,
              ending with obj_foo, your subsequent call can include before=obj_foo in order to
              fetch the previous page of the list.

          limit: A limit on the number of objects to be returned. Limit can range between 1 and
              100, and the default is 20.

          order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending
              order and `desc` for descending order.

          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
        r4   r5   r7   r8   r9   r:   z/steps)rE   rF   rG   rH   )r'   r(   r)   r*   query)pager=   model)r@   _get_api_listr   r   r   r   r   StepListParamsr   r.   r-   rE   rF   rG   rH   r'   r(   r)   r*   r    r    r!   listK   0   ,z
Steps.list)r   r   )r   r$   r+   r,   r-   r,   r.   r,   r'   r/   r(   r0   r)   r1   r*   r2   r   r   )r.   r,   r-   r,   rE   rI   rF   rI   rG   rJ   rH   rK   r'   r/   r(   r0   r)   r1   r*   r2   r   rL   	__name__
__module____qualname__r   r"   r%   r   rC   rU   r    r    r    r!   r      &    -c                	   @  r   )(r   r   AsyncStepsWithRawResponsec                 C  r   r   )r]   r   r    r    r!   r"      r#   zAsyncSteps.with_raw_responseAsyncStepsWithStreamingResponsec                 C  r   r   )r^   r   r    r    r!   r%      r#   z"AsyncSteps.with_streaming_responseNr&   r+   r,   r-   r.   r'   r/   r(   r0   r)   r1   r*   r2   r   c                  s|   |s
t d||st d||st d|ddi|p"i }| jd| d| d| t||||d	td
I dH S )r3   r4   r5   r6   r7   r8   r9   r:   r;   r&   r<   Nr?   rB   r    r    r!   rC      s   zAsyncSteps.retrieverD   rE   rI   rF   rG   rJ   rH   rK   1AsyncPaginator[RunStep, AsyncCursorPage[RunStep]]c       	         C  rM   rN   )r@   rR   r   r   r   r   r   rS   rT   r    r    r!   rU      rV   zAsyncSteps.list)r   r]   )r   r^   rW   )r.   r,   r-   r,   rE   rI   rF   rI   rG   rJ   rH   rK   r'   r/   r(   r0   r)   r1   r*   r2   r   r_   rX   r    r    r    r!   r      r\   c                   @     e Zd ZdddZdS )	r   stepsr   r   Nonec                 C  &   || _ t|j| _t|j| _d S r   )_stepsr   to_raw_response_wrapperrC   rU   r   ra   r    r    r!   __init__     
zStepsWithRawResponse.__init__Nra   r   r   rb   rY   rZ   r[   rg   r    r    r    r!   r   
      r   c                   @  r`   )	r]   ra   r   r   rb   c                 C  rc   r   )rd   r   async_to_raw_response_wrapperrC   rU   rf   r    r    r!   rg     rh   z"AsyncStepsWithRawResponse.__init__Nra   r   r   rb   rj   r    r    r    r!   r]     rk   r]   c                   @  r`   )	r$   ra   r   r   rb   c                 C  "   || _ t|j| _t|j| _d S r   )rd   r   rC   rU   rf   r    r    r!   rg   #     
z#StepsWithStreamingResponse.__init__Nri   rj   r    r    r    r!   r$   "  rk   r$   c                   @  r`   )	r^   ra   r   r   rb   c                 C  rn   r   )rd   r   rC   rU   rf   r    r    r!   rg   /  ro   z(AsyncStepsWithStreamingResponse.__init__Nrm   rj   r    r    r    r!   r^   .  rk   r^   )(
__future__r   typing_extensionsr   httpx r   _typesr   r   r   r	   r
   _utilsr   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   _base_clientr   r   types.beta.threads.runsr    types.beta.threads.runs.run_stepr   __all__r   r   r   r]   r$   r^   r    r    r    r!   <module>   s(   xx