
    ilD                    t   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e      Z+ G d de      Z, G d d      Z- G d d      Z. G d d      Z/ G d d      Z0y)    )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                     e Zd ZdZed
d       Zedd       Z ej                  d      e	ddde
d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd       Z ej                  d      e	e	e	e	e	ddde
d		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	       Zy)r   4Build Assistants that can call models and use tools.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
        )StepsWithRawResponseselfs    y/Users/manta/Documents/Projects/TheRoad-I1/.venv/lib/python3.12/site-packages/openai/resources/beta/threads/runs/steps.pywith_raw_responsezSteps.with_raw_response   s     $D))    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
        )StepsWithStreamingResponser&   s    r(   with_streaming_responsezSteps.with_streaming_response'   s     *$//r*   >The Assistants API is deprecated in favor of the Responses APINincludeextra_headersextra_query
extra_bodytimeoutc                  |st        d|      |st        d|      |st        d|      ddi|xs i }| j                  t        d|||      t        ||||t	        d|it
        j                        	      t        
      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}	thread_idrun_idstep_idr1   r2   r3   r4   r5   queryoptionscast_to)
ValueError_getr   r   r   r   StepRetrieveParamsr   	r'   rA   r?   r@   r1   r2   r3   r4   r5   s	            r(   retrievezSteps.retrieve0   s    F WXaWdeffTU[T^_``UV]U`abb&QM<ORQyyD#	 )+'%%y'&:<P<c<cd   
 	
r*   	afterbeforer1   limitorderr2   r3   r4   r5   c       
           |st        d|      |st        d|      ddi|xs i }| j                  t        d||      t        t           t        ||	|
|t        |||||dt        j                              t        	      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
        r8   r9   r;   r<   z(/threads/{thread_id}/runs/{run_id}/steps)r?   r@   )rM   rN   r1   rO   rP   rB   )pagerE   model)	rG   _get_api_listr   r   r   r   r   r   StepListParamsr'   r@   r?   rM   rN   r1   rO   rP   r2   r3   r4   r5   s               r(   listz
Steps.listk   s    l WXaWdeffTU[T^_``&QM<ORQ!!DPYbhi((+'%%!&"(#*!&!& %33	  ' " 
 	
r*   )returnr%   )rY   r-   rA   strr?   r[   r@   r[   r1   List[RunStepInclude] | Omitr2   Headers | Noner3   Query | Noner4   Body | Noner5   'float | httpx.Timeout | None | NotGivenrY   r   )r@   r[   r?   r[   rM   
str | OmitrN   ra   r1   r\   rO   
int | OmitrP   Literal['asc', 'desc'] | Omitr2   r]   r3   r^   r4   r_   r5   r`   rY   zSyncCursorPage[RunStep]__name__
__module____qualname____doc__r   r)   r.   typing_extensions
deprecatedr   r   rK   rX    r*   r(   r   r      s   >* * 0 0 "!!"bc 04 )-$("&;D8
8
 	8

 8
 -8
 &8
 "8
  8
 98
 
8
 d8
t "!!"bc !!/3 /3 )-$("&;DN
N
 	N

 N
 N
 -N
 N
 -N
 &N
 "N
  N
 9N
  
!!N
 dN
r*   c                     e Zd ZdZed
d       Zedd       Z ej                  d      e	ddde
d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd       Z ej                  d      e	e	e	e	e	ddde
d		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	       Zy)r    r"   c                    t        |       S r$   )AsyncStepsWithRawResponser&   s    r(   r)   zAsyncSteps.with_raw_response   s     )..r*   c                    t        |       S r,   )AsyncStepsWithStreamingResponser&   s    r(   r.   z"AsyncSteps.with_streaming_response   s     /t44r*   r/   Nr0   c               @  K   |st        d|      |st        d|      |st        d|      ddi|xs i }| j                  t        d|||      t        ||||t	        d|it
        j                         d	{   
      t               d	{   S 7 7 w)r7   r8   r9   r:   r;   r<   r=   r>   r1   NrB   rD   )rG   rH   r   r   r   r   rI   r   rJ   s	            r(   rK   zAsyncSteps.retrieve   s     F WXaWdeffTU[T^_``UV]U`abb&QM<ORQYYD#	 )+'%19g2FH\HoHopp   
 
 	
 q
s$   A<B>B?BBBBrL   c       
           |st        d|      |st        d|      ddi|xs i }| j                  t        d||      t        t           t        ||	|
|t        |||||dt        j                              t        	      S rR   )	rG   rU   r   r   r   r   r   r   rV   rW   s               r(   rX   zAsyncSteps.list  s    l WXaWdeffTU[T^_``&QM<ORQ!!DPYbhi )(+'%%!&"(#*!&!& %33	  ' " 
 	
r*   )rY   rn   )rY   rp   rZ   )r@   r[   r?   r[   rM   ra   rN   ra   r1   r\   rO   rb   rP   rc   r2   r]   r3   r^   r4   r_   r5   r`   rY   z1AsyncPaginator[RunStep, AsyncCursorPage[RunStep]]rd   rk   r*   r(   r    r       s   >/ / 5 5 "!!"bc 04 )-$("&;D8
8
 	8

 8
 -8
 &8
 "8
  8
 98
 
8
 d8
t "!!"bc !!/3 /3 )-$("&;DN
N
 	N

 N
 N
 -N
 N
 -N
 &N
 "N
  N
 9N
  
;!N
 dN
r*   c                      e Zd ZddZy)r%   c                    || _         t        j                  |j                        | _        t        j                  |j                        | _        y N)_stepsr   to_raw_response_wrapperrK   rX   r'   stepss     r(   __init__zStepsWithRawResponse.__init__a  sE     44 	 44

 		r*   Nry   r   rY   Nonere   rf   rg   rz   rk   r*   r(   r%   r%   `      
r*   r%   c                      e Zd ZddZy)rn   c                    || _         t        j                  |j                        | _        t        j                  |j                        | _        y ru   )rv   r   async_to_raw_response_wrapperrK   rX   rx   s     r(   rz   z"AsyncStepsWithRawResponse.__init__q  sE     :: 	 ::

 		r*   Nry   r    rY   r|   r}   rk   r*   r(   rn   rn   p  r~   r*   rn   c                      e Zd ZddZy)r-   c                z    || _         t        |j                        | _        t        |j                        | _        y ru   )rv   r   rK   rX   rx   s     r(   rz   z#StepsWithStreamingResponse.__init__  s9     ) 	 )

 		r*   Nr{   r}   rk   r*   r(   r-   r-     r~   r*   r-   c                      e Zd ZddZy)rp   c                z    || _         t        |j                        | _        t        |j                        | _        y ru   )rv   r   rK   rX   rx   s     r(   rz   z(AsyncStepsWithStreamingResponse.__init__  s9     / 	 /

 		r*   Nr   r}   rk   r*   r(   rp   rp     r~   r*   rp   )1
__future__r   ri   typingr   r   httpx r   _typesr   r	   r
   r   r   r   r   _utilsr   r   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   _base_clientr   r   types.beta.threads.runsr   r    types.beta.threads.runs.run_stepr   (types.beta.threads.runs.run_step_includer   __all__r   r    r%   rn   r-   rp   rk   r*   r(   <module>r      s    #   %  " M M M M M ( < [ ; B O 9 HL
!`
O `
F`
! `
F
 
 
 
 
 
 
 
r*   