o
    ilD                     @  sP  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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 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Z0dS )    )annotationsN)List)Literal   )_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)SyncCursorPageAsyncCursorPage)AsyncPaginatormake_request_options)step_list_paramsstep_retrieve_params)RunStep)RunStepIncludeSteps
AsyncStepsc                   @  x   e Zd ZdZed(ddZed)ddZed	e	d
d
d
e
dd*ddZed	e	e	e	e	e	d
d
d
e
d	d+d&d'Zd
S ),r   4Build Assistants that can call models and use tools.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(   b/home/kim/smarthome/.venv/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_response>The Assistants API is deprecated in favor of the Responses APINincludeextra_headersextra_query
extra_bodytimeoutstep_idstr	thread_idrun_idr2   List[RunStepInclude] | Omitr3   Headers | Noner4   Query | Noner5   Body | Noner6   'float | httpx.Timeout | None | NotGivenr   c          	   
   C  s|   |s	t d||st d||st d|ddi|p!i }| jt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=v22/threads/{thread_id}/runs/{run_id}/steps/{step_id}r9   r:   r7   r2   r3   r4   r5   r6   queryoptionsZcast_to)
ValueError_getr   r   r   r   StepRetrieveParamsr   	r'   r7   r9   r:   r2   r3   r4   r5   r6   r(   r(   r)   retrieve0   s.   #zSteps.retrieve	afterbeforer2   limitorderr3   r4   r5   r6   rR   
str | OmitrS   rT   
int | OmitrU   Literal['asc', 'desc'] | OmitSyncCursorPage[RunStep]c       
         C  v   |s	t d||st d|ddi|pi }| jt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
        rA   rB   rD   rE   z(/threads/{thread_id}/runs/{run_id}/steps)r9   r:   )rR   rS   r2   rT   rU   rH   )pagerK   model)	rL   _get_api_listr   r   r   r   r   r   StepListParamsr'   r:   r9   rR   rS   r2   rT   rU   r3   r4   r5   r6   r(   r(   r)   listk   2   6z
Steps.list)r"   r#   )r"   r,   r7   r8   r9   r8   r:   r8   r2   r;   r3   r<   r4   r=   r5   r>   r6   r?   r"   r   )r:   r8   r9   r8   rR   rV   rS   rV   r2   r;   rT   rW   rU   rX   r3   r<   r4   r=   r5   r>   r6   r?   r"   rY   __name__
__module____qualname____doc__r   r*   r.   typing_extensions
deprecatedr   r   rP   ra   r(   r(   r(   r)   r      0    	:c                   @  r    ),r   r!   r"   AsyncStepsWithRawResponsec                 C  r$   r%   )rl   r&   r(   r(   r)   r*      r+   zAsyncSteps.with_raw_responseAsyncStepsWithStreamingResponsec                 C  r$   r-   )rm   r&   r(   r(   r)   r.      r/   z"AsyncSteps.with_streaming_responser0   Nr1   r7   r8   r9   r:   r2   r;   r3   r<   r4   r=   r5   r>   r6   r?   r   c          	   
     s   |s
t d||st d||st d|ddi|p"i }| jtd|||dt||||td|itjI d	H d
tdI d	H S )r@   rA   rB   rC   rD   rE   rF   rG   r2   NrH   rJ   )rL   rM   r   r   r   r   rN   r   rO   r(   r(   r)   rP      s0   #zAsyncSteps.retrieverQ   rR   rV   rS   rT   rW   rU   rX   1AsyncPaginator[RunStep, AsyncCursorPage[RunStep]]c       
         C  rZ   r[   )	rL   r^   r   r   r   r   r   r   r_   r`   r(   r(   r)   ra     rb   zAsyncSteps.list)r"   rl   )r"   rm   rc   )r:   r8   r9   r8   rR   rV   rS   rV   r2   r;   rT   rW   rU   rX   r3   r<   r4   r=   r5   r>   r6   r?   r"   rn   rd   r(   r(   r(   r)   r      rk   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_wrapperrP   ra   r'   rp   r(   r(   r)   __init__a     zStepsWithRawResponse.__init__Nrp   r   r"   rq   re   rf   rg   rv   r(   r(   r(   r)   r#   `      r#   c                   @  ro   )	rl   rp   r   r"   rq   c                 C  rr   rs   )rt   r   Zasync_to_raw_response_wrapperrP   ra   ru   r(   r(   r)   rv   q  rw   z"AsyncStepsWithRawResponse.__init__Nrp   r   r"   rq   ry   r(   r(   r(   r)   rl   p  rz   rl   c                   @  ro   )	r,   rp   r   r"   rq   c                 C  "   || _ t|j| _t|j| _d S rs   )rt   r   rP   ra   ru   r(   r(   r)   rv        z#StepsWithStreamingResponse.__init__Nrx   ry   r(   r(   r(   r)   r,     rz   r,   c                   @  ro   )	rm   rp   r   r"   rq   c                 C  r|   rs   )rt   r   rP   ra   ru   r(   r(   r)   rv     r}   z(AsyncStepsWithStreamingResponse.__init__Nr{   ry   r(   r(   r(   r)   rm     rz   rm   )1
__future__r   ri   typingr   r   Zhttpx r   _typesr   r   r	   r
   r   r   r   Z_utilsr   r   r   Z_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#   rl   r,   rm   r(   r(   r(   r)   <module>   s2   $ $ $