U
    ZhB                     @  sD  d dl mZ d dl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 ddl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 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 )    )annotationsN)List)Literal   )_legacy_response)	NOT_GIVENBodyQueryHeadersNotGiven)maybe_transformasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)SyncCursorPageAsyncCursorPage)AsyncPaginatormake_request_options)step_list_paramsstep_retrieve_params)RunStep)RunStepIncludeSteps
AsyncStepsc                   @  s   e Zd ZeddddZeddddZeded	d	d	ed
dddddddddd	ddZ	edeeeeed	d	d	ed	dddddddddddddddZ
d	S )r   StepsWithRawResponsereturnc                 C  s   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
        )r   self r#   L/tmp/pip-unpacked-wheel-693nel7n/openai/resources/beta/threads/runs/steps.pywith_raw_response   s    zSteps.with_raw_responseStepsWithStreamingResponsec                 C  s   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
        )r&   r!   r#   r#   r$   with_streaming_response%   s    zSteps.with_streaming_response>The Assistants API is deprecated in favor of the Responses APINincludeextra_headersextra_query
extra_bodytimeoutstrList[RunStepInclude] | NotGivenHeaders | NoneQuery | NoneBody | None'float | httpx.Timeout | None | NotGivenr   	step_id	thread_idrun_idr+   r,   r-   r.   r/   r   c          	   
   C  s   |st d||s$t d||s6t d|ddi|pBi }| jd| d| d| t||||td	|itjd
tdS )  
        Retrieves a run step.

        Args:
          include: A list of additional fields to include in the response. Currently the only
              supported value is `step_details.tool_calls[*].file_search.results[*].content`
              to fetch the file search result content.

              See the
              [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings)
              for more information.

          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+   r,   r-   r.   r/   queryoptionsZcast_to)
ValueError_getr   r   r   StepRetrieveParamsr   	r"   r7   r8   r9   r+   r,   r-   r.   r/   r#   r#   r$   retrieve.   s$    #zSteps.retrieve	afterbeforer+   limitorderr,   r-   r.   r/   str | NotGivenint | NotGiven#Literal[('asc', 'desc')] | NotGivenzSyncCursorPage[RunStep]r9   r8   rM   rN   r+   rO   rP   r,   r-   r.   r/   r   c       
         C  sz   |st d||s$t d|ddi|p0i }| 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,
              starting with obj_foo, your subsequent call can include before=obj_foo in order
              to fetch the previous page of the list.

          include: A list of additional fields to include in the response. Currently the only
              supported value is `step_details.tool_calls[*].file_search.results[*].content`
              to fetch the file search result content.

              See the
              [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings)
              for more information.

          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
        r;   r<   r>   r?   r@   rA   z/steps)rM   rN   r+   rO   rP   rC   )pagerF   model)rG   _get_api_listr   r   r   r   r   StepListParamsr"   r9   r8   rM   rN   r+   rO   rP   r,   r-   r.   r/   r#   r#   r$   listd   s2    6z
Steps.list__name__
__module____qualname__r   r%   r(   typing_extensions
deprecatedr   rK   r[   r#   r#   r#   r$   r      s,   	$5c                   @  s   e Zd ZeddddZeddddZeded	d	d	ed
dddddddddd	ddZ	edeeeeed	d	d	ed	dddddddddddddddZ
d	S )r   AsyncStepsWithRawResponser   c                 C  s   t | S r    )rb   r!   r#   r#   r$   r%      s    zAsyncSteps.with_raw_responseAsyncStepsWithStreamingResponsec                 C  s   t | S r'   )rc   r!   r#   r#   r$   r(      s    z"AsyncSteps.with_streaming_responser)   Nr*   r0   r1   r2   r3   r4   r5   r   r6   c          	   
     s   |st d||s$t d||s6t d|ddi|pBi }| jd| d| d| t||||td	|itjI d
H dtdI d
H S )r:   r;   r<   r=   r>   r?   r@   rA   rB   r+   NrC   rE   )rG   rH   r   r   r   rI   r   rJ   r#   r#   r$   rK      s$    #zAsyncSteps.retrieverL   rQ   rR   rS   z1AsyncPaginator[RunStep, AsyncCursorPage[RunStep]]rT   c       
         C  sz   |st d||s$t d|ddi|p0i }| jd| d| dtt t||	|
|t|||||dtjd	td
S rU   )rG   rX   r   r   r   r   r   rY   rZ   r#   r#   r$   r[      s2    6zAsyncSteps.listr\   r#   r#   r#   r$   r      s,   	$5c                   @  s   e Zd ZdddddZdS )r   r   Nonestepsr   c                 C  s&   || _ t|j| _t|j| _d S N)_stepsr   Zto_raw_response_wrapperrK   r[   r"   rf   r#   r#   r$   __init__S  s    zStepsWithRawResponse.__init__Nr]   r^   r_   rj   r#   r#   r#   r$   r   R  s   r   c                   @  s   e Zd ZdddddZdS )rb   r   rd   re   c                 C  s&   || _ t|j| _t|j| _d S rg   )rh   r   Zasync_to_raw_response_wrapperrK   r[   ri   r#   r#   r$   rj   c  s    z"AsyncStepsWithRawResponse.__init__Nrk   r#   r#   r#   r$   rb   b  s   rb   c                   @  s   e Zd ZdddddZdS )r&   r   rd   re   c                 C  s"   || _ t|j| _t|j| _d S rg   )rh   r   rK   r[   ri   r#   r#   r$   rj   s  s    z#StepsWithStreamingResponse.__init__Nrk   r#   r#   r#   r$   r&   r  s   r&   c                   @  s   e Zd ZdddddZdS )rc   r   rd   re   c                 C  s"   || _ t|j| _t|j| _d S rg   )rh   r   rK   r[   ri   r#   r#   r$   rj     s    z(AsyncStepsWithStreamingResponse.__init__Nrk   r#   r#   r#   r$   rc     s   rc   ).
__future__r   r`   typingr   r   Zhttpx r   _typesr   r   r	   r
   r   _utilsr   r   _compatr   Z	_resourcer   r   	_responser   r   Z
paginationr   r   Z_base_clientr   r   Ztypes.beta.threads.runsr   r   Z types.beta.threads.runs.run_stepr   Z(types.beta.threads.runs.run_step_includer   __all__r   r   r   rb   r&   rc   r#   r#   r#   r$   <module>   s0     