o
    ͩZh=                     @  s<  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 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 )    )annotations)List)LiteralN   )_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                
   @  `   e Zd Zed&ddZed'ddZeddded	d(ddZeeeeeddded	d)d$d%ZdS )*r   returnStepsWithRawResponsec                 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
        )r   self r$   _/var/www/html/lang_env/lib/python3.10/site-packages/openai/resources/beta/threads/runs/steps.pywith_raw_response      zSteps.with_raw_responseStepsWithStreamingResponsec                 C  r    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'      zSteps.with_streaming_responseNincludeextra_headersextra_query
extra_bodytimeoutstep_idstr	thread_idrun_idr-   List[RunStepInclude] | NotGivenr.   Headers | Noner/   Query | Noner0   Body | Noner1   'float | httpx.Timeout | None | NotGivenr   c          	   
   C  s   |s	t d||st d||st d|ddi|p!i }| 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/   r0   r1   queryoptionsZcast_to)
ValueError_getr   r   r   StepRetrieveParamsr   	r#   r2   r4   r5   r-   r.   r/   r0   r1   r$   r$   r%   retrieve0   s$   "zSteps.retrieve	afterbeforer-   limitorderr.   r/   r0   r1   rN   str | NotGivenrO   rP   int | NotGivenrQ   !Literal['asc', 'desc'] | NotGivenSyncCursorPage[RunStep]c       
         C  z   |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,
              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@   rA   rB   z/steps)rN   rO   r-   rP   rQ   rD   )pagerG   model)rH   _get_api_listr   r   r   r   r   StepListParamsr#   r5   r4   rN   rO   r-   rP   rQ   r.   r/   r0   r1   r$   r$   r%   liste   2   5z
Steps.list)r   r   )r   r(   r2   r3   r4   r3   r5   r3   r-   r6   r.   r7   r/   r8   r0   r9   r1   r:   r   r   )r5   r3   r4   r3   rN   rR   rO   rR   r-   r6   rP   rS   rQ   rT   r.   r7   r/   r8   r0   r9   r1   r:   r   rU   	__name__
__module____qualname__r   r&   r*   r   rL   r]   r$   r$   r$   r%   r      *    	:c                
   @  r   )*r   r   AsyncStepsWithRawResponsec                 C  r    r!   )re   r"   r$   r$   r%   r&      r'   zAsyncSteps.with_raw_responseAsyncStepsWithStreamingResponsec                 C  r    r)   )rf   r"   r$   r$   r%   r*      r+   z"AsyncSteps.with_streaming_responseNr,   r2   r3   r4   r5   r-   r6   r.   r7   r/   r8   r0   r9   r1   r:   r   c          	   
     s   |s
t d||st d||st d|ddi|p"i }| 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@   rA   rB   rC   r-   NrD   rF   )rH   rI   r   r   r   rJ   r   rK   r$   r$   r%   rL      s&   "zAsyncSteps.retrieverM   rN   rR   rO   rP   rS   rQ   rT   1AsyncPaginator[RunStep, AsyncCursorPage[RunStep]]c       
         C  rV   rW   )rH   rZ   r   r   r   r   r   r[   r\   r$   r$   r%   r]      r^   zAsyncSteps.list)r   re   )r   rf   r_   )r5   r3   r4   r3   rN   rR   rO   rR   r-   r6   rP   rS   rQ   rT   r.   r7   r/   r8   r0   r9   r1   r:   r   rg   r`   r$   r$   r$   r%   r      rd   c                   @     e Zd ZdddZdS )	r   stepsr   r   Nonec                 C  &   || _ t|j| _t|j| _d S N)_stepsr   Zto_raw_response_wrapperrL   r]   r#   ri   r$   r$   r%   __init__Q     
zStepsWithRawResponse.__init__Nri   r   r   rj   ra   rb   rc   ro   r$   r$   r$   r%   r   P      r   c                   @  rh   )	re   ri   r   r   rj   c                 C  rk   rl   )rm   r   Zasync_to_raw_response_wrapperrL   r]   rn   r$   r$   r%   ro   ]  rp   z"AsyncStepsWithRawResponse.__init__Nri   r   r   rj   rr   r$   r$   r$   r%   re   \  rs   re   c                   @  rh   )	r(   ri   r   r   rj   c                 C  "   || _ t|j| _t|j| _d S rl   )rm   r   rL   r]   rn   r$   r$   r%   ro   i     
z#StepsWithStreamingResponse.__init__Nrq   rr   r$   r$   r$   r%   r(   h  rs   r(   c                   @  rh   )	rf   ri   r   r   rj   c                 C  ru   rl   )rm   r   rL   r]   rn   r$   r$   r%   ro   u  rv   z(AsyncStepsWithStreamingResponse.__init__Nrt   rr   r$   r$   r$   r%   rf   t  rs   rf   ).
__future__r   typingr   Ztyping_extensionsr   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   re   r(   rf   r$   r$   r$   r%   <module>   s0     