
    h
B                   8   S SK Jr  S SKrS SKJrJrJrJr  S SKJ	r	  S SKJ
r
Jr  S SKrSSKJr  SS	KJrJrJrJrJrJr  SS
KJrJrJrJrJr  SSKJrJrJrJ r   SSK!J"r"  SSK#J$r$J%r%  SSK&J'r'J(r(  SSK)J*r*J+r+  SSK,J-r-J.r.  SSK/J0r0J1r1  SSK2J3r3J4r4J5r5J6r6J7r7J8r8  SSK9J:r:J;r;J<r<J=r=  SSK>J?r?  SSK@JArA  SSKBJCrC  SSKDJErE  SSKFJGrG  SSKHJIrI  SSKJJKrK  SSKLJMrM  SSKNJOrO  SS/rP " S S\$5      rQ " S  S\%5      rR " S! S"5      rS " S# S$5      rT " S% S&5      rU " S' S(5      rVg))    )annotationsN)ListUnionIterableOptional)partial)Literaloverload   )_legacy_response   )Steps
AsyncStepsStepsWithRawResponseAsyncStepsWithRawResponseStepsWithStreamingResponseAsyncStepsWithStreamingResponse)	NOT_GIVENBodyQueryHeadersNotGiven)is_givenrequired_argsmaybe_transformasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)StreamAsyncStream)SyncCursorPageAsyncCursorPage)AsyncPaginatormake_request_options)AssistantEventHandlerAssistantEventHandlerTAssistantStreamManagerAsyncAssistantEventHandlerAsyncAssistantEventHandlerTAsyncAssistantStreamManager)run_list_paramsrun_create_paramsrun_update_paramsrun_submit_tool_outputs_params)Run)	ChatModel)Metadata)ReasoningEffort)AssistantToolParam)AssistantStreamEvent)RunStepInclude)AssistantToolChoiceOptionParam)"AssistantResponseFormatOptionParamRuns	AsyncRunsc                  
   \ rS rSr\S1S j5       r\S2S j5       r\S3S j5       r\\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                               S4S
 jj5       r
\\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                               S5S jj5       r
\\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                               S6S jj5       r
\" S/SS	/5      \	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                               S7S jj5       r
SSS\	S.             S8S jjr\	SSS\	S.               S9S jjr\	\	\	\	SSS\	S.                   S:S jjrSSS\	S.             S8S jjr\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                               S;S jjr\\R$                  " S5      \	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                           S<S jj5       5       r\\R$                  " S5      \	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                             S=S jj5       5       r\R$                  " S5      \	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSSS\	S.                                             S>S jj5       rSSS\	\	4               S?S jjr\\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                             S@S jj5       r\\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                               SAS  jj5       r\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSSS\	S!.                                               SBS" jjr\\	SSS\	S#.                 SCS% jj5       r\SSS\	S.                 SDS& jj5       r\SSS\	S.                 SES' jj5       r\" SS$// S(Q5      \	SSS\	S#.                 SFS) jj5       r\	SSS\	S*.                 SGS+ jjr\SSS\	S.               SHS, jj5       r\SSS\	S.                 SIS- jj5       rSSSS\	S..                 SJS/ jjrS0rg)Kr;   =   c                ,    [        U R                  5      $ N)r   _clientselfs    Y/var/www/html/env/lib/python3.13/site-packages/openai/resources/beta/threads/runs/runs.pysteps
Runs.steps>   s    T\\""    c                    [        U 5      $ z
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
)RunsWithRawResponserB   s    rD   with_raw_responseRuns.with_raw_responseB   s     #4((rG   c                    [        U 5      $ 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
)RunsWithStreamingResponserB   s    rD   with_streaming_responseRuns.with_streaming_responseL   s     )..rG   Nincludeadditional_instructionsadditional_messagesinstructionsmax_completion_tokensmax_prompt_tokensmetadatamodelparallel_tool_callsreasoning_effortresponse_formatstreamtemperaturetool_choicetoolstop_ptruncation_strategyextra_headersextra_query
extra_bodytimeout	thread_idassistant_idr^   c                   ga  
Create a run.

Args:
  assistant_id: The ID of the
      [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to
      execute this run.

  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.

  additional_instructions: Appends additional instructions at the end of the instructions for the run. This
      is useful for modifying the behavior on a per-run basis without overriding other
      instructions.

  additional_messages: Adds additional messages to the thread before creating the run.

  instructions: Overrides the
      [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant)
      of the assistant. This is useful for modifying the behavior on a per-run basis.

  max_completion_tokens: The maximum number of completion tokens that may be used over the course of the
      run. The run will make a best effort to use only the number of completion tokens
      specified, across multiple turns of the run. If the run exceeds the number of
      completion tokens specified, the run will end with status `incomplete`. See
      `incomplete_details` for more info.

  max_prompt_tokens: The maximum number of prompt tokens that may be used over the course of the run.
      The run will make a best effort to use only the number of prompt tokens
      specified, across multiple turns of the run. If the run exceeds the number of
      prompt tokens specified, the run will end with status `incomplete`. See
      `incomplete_details` for more info.

  metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
      for storing additional information about the object in a structured format, and
      querying for objects via API or the dashboard.

      Keys are strings with a maximum length of 64 characters. Values are strings with
      a maximum length of 512 characters.

  model: The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to
      be used to execute this run. If a value is provided here, it will override the
      model associated with the assistant. If not, the model associated with the
      assistant will be used.

  parallel_tool_calls: Whether to enable
      [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
      during tool use.

  reasoning_effort: **o-series models only**

      Constrains effort on reasoning for
      [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
      supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
      result in faster responses and fewer tokens used on reasoning in a response.

  response_format: Specifies the format that the model must output. Compatible with
      [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
      [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
      and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

      Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
      Outputs which ensures the model will match your supplied JSON schema. Learn more
      in the
      [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

      Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
      message the model generates is valid JSON.

      **Important:** when using JSON mode, you **must** also instruct the model to
      produce JSON yourself via a system or user message. Without this, the model may
      generate an unending stream of whitespace until the generation reaches the token
      limit, resulting in a long-running and seemingly "stuck" request. Also note that
      the message content may be partially cut off if `finish_reason="length"`, which
      indicates the generation exceeded `max_tokens` or the conversation exceeded the
      max context length.

  stream: If `true`, returns a stream of events that happen during the Run as server-sent
      events, terminating when the Run enters a terminal state with a `data: [DONE]`
      message.

  temperature: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
      make the output more random, while lower values like 0.2 will make it more
      focused and deterministic.

  tool_choice: Controls which (if any) tool is called by the model. `none` means the model will
      not call any tools and instead generates a message. `auto` is the default value
      and means the model can pick between generating a message or calling one or more
      tools. `required` means the model must call one or more tools before responding
      to the user. Specifying a particular tool like `{"type": "file_search"}` or
      `{"type": "function", "function": {"name": "my_function"}}` forces the model to
      call that tool.

  tools: Override the tools the assistant can use for this run. This is useful for
      modifying the behavior on a per-run basis.

  top_p: An alternative to sampling with temperature, called nucleus sampling, where the
      model considers the results of the tokens with top_p probability mass. So 0.1
      means only the tokens comprising the top 10% probability mass are considered.

      We generally recommend altering this or temperature but not both.

  truncation_strategy: Controls for how a thread will be truncated prior to the run. Use this to
      control the intial context window of the run.

  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
N rC   rh   ri   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   s                           rD   createRuns.createU       h 	rG   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r_   r`   ra   rb   rc   rd   re   rf   rg   c                   ga  
Create a run.

Args:
  assistant_id: The ID of the
      [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to
      execute this run.

  stream: If `true`, returns a stream of events that happen during the Run as server-sent
      events, terminating when the Run enters a terminal state with a `data: [DONE]`
      message.

  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.

  additional_instructions: Appends additional instructions at the end of the instructions for the run. This
      is useful for modifying the behavior on a per-run basis without overriding other
      instructions.

  additional_messages: Adds additional messages to the thread before creating the run.

  instructions: Overrides the
      [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant)
      of the assistant. This is useful for modifying the behavior on a per-run basis.

  max_completion_tokens: The maximum number of completion tokens that may be used over the course of the
      run. The run will make a best effort to use only the number of completion tokens
      specified, across multiple turns of the run. If the run exceeds the number of
      completion tokens specified, the run will end with status `incomplete`. See
      `incomplete_details` for more info.

  max_prompt_tokens: The maximum number of prompt tokens that may be used over the course of the run.
      The run will make a best effort to use only the number of prompt tokens
      specified, across multiple turns of the run. If the run exceeds the number of
      prompt tokens specified, the run will end with status `incomplete`. See
      `incomplete_details` for more info.

  metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
      for storing additional information about the object in a structured format, and
      querying for objects via API or the dashboard.

      Keys are strings with a maximum length of 64 characters. Values are strings with
      a maximum length of 512 characters.

  model: The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to
      be used to execute this run. If a value is provided here, it will override the
      model associated with the assistant. If not, the model associated with the
      assistant will be used.

  parallel_tool_calls: Whether to enable
      [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
      during tool use.

  reasoning_effort: **o-series models only**

      Constrains effort on reasoning for
      [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
      supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
      result in faster responses and fewer tokens used on reasoning in a response.

  response_format: Specifies the format that the model must output. Compatible with
      [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
      [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
      and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.

      Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
      Outputs which ensures the model will match your supplied JSON schema. Learn more
      in the
      [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).

      Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
      message the model generates is valid JSON.

      **Important:** when using JSON mode, you **must** also instruct the model to
      produce JSON yourself via a system or user message. Without this, the model may
      generate an unending stream of whitespace until the generation reaches the token
      limit, resulting in a long-running and seemingly "stuck" request. Also note that
      the message content may be partially cut off if `finish_reason="length"`, which
      indicates the generation exceeded `max_tokens` or the conversation exceeded the
      max context length.

  temperature: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
      make the output more random, while lower values like 0.2 will make it more
      focused and deterministic.

  tool_choice: Controls which (if any) tool is called by the model. `none` means the model will
      not call any tools and instead generates a message. `auto` is the default value
      and means the model can pick between generating a message or calling one or more
      tools. `required` means the model must call one or more tools before responding
      to the user. Specifying a particular tool like `{"type": "file_search"}` or
      `{"type": "function", "function": {"name": "my_function"}}` forces the model to
      call that tool.

  tools: Override the tools the assistant can use for this run. This is useful for
      modifying the behavior on a per-run basis.

  top_p: An alternative to sampling with temperature, called nucleus sampling, where the
      model considers the results of the tokens with top_p probability mass. So 0.1
      means only the tokens comprising the top 10% probability mass are considered.

      We generally recommend altering this or temperature but not both.

  truncation_strategy: Controls for how a thread will be truncated prior to the run. Use this to
      control the intial context window of the run.

  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
Nrl   rC   rh   ri   r^   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r_   r`   ra   rb   rc   rd   re   rf   rg   s                           rD   rn   ro      rp   rG   c                   grs   rl   rt   s                           rD   rn   ro     rp   rG   c                  U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        0 SU_SU_SU_S	U_S
U_SU_SU	_SU
_SU_SU_SU_SU_SU_SU_SU_SU_SU_U(       a  [        R                  O[        R
                  5      [        UUUU[        SU0[        R                  5      S9[        U=(       d    S[        [           S9$ N8Expected a non-empty value for `thread_id` but received OpenAI-Betaassistants=v2	/threads//runsri   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rS   rd   re   rf   rg   queryFbodyoptionscast_tor^   
stream_cls)
ValueError_postr   r/   RunCreateParamsStreamingRunCreateParamsNonStreamingr'   RunCreateParamsr2   r"   r7   rm   s                           rD   rn   ro     s   < WXaWdeff&QM<ORQzz	{%( "L-/F *+> #L	
 ,-B ():  U *+> '(8 & f "; "; U  U!" *+>#& ?E!::J[JwJw), )+'%%y'&:<M<]<]^ ?U23C  "
 "	
rG   rd   re   rf   rg   c          
         U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU SU 3[        X4XVS9[        S9$ )	  
Retrieves a run.

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
rx   5Expected a non-empty value for `run_id` but received ry   rz   r{   /runs/r   r   r   r   _getr'   r2   rC   run_idrh   rd   re   rf   rg   s          rD   retrieveRuns.retrieve\  s    0 WXaWdeffTU[T^_``&QM<ORQyy	{&1(+Q[   
 	
rG   rY   rd   re   rf   rg   c                   U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU SU 3[        SU0[        R                  5      [        XEXgS9[        S	9$ )
u  
Modifies a run.

Args:
  metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
      for storing additional information about the object in a structured format, and
      querying for objects via API or the dashboard.

      Keys are strings with a maximum length of 64 characters. Values are strings with
      a maximum length of 512 characters.

  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
rx   r   ry   rz   r{   r   rY   r   r   r   r   )r   r   r   r0   RunUpdateParamsr'   r2   rC   r   rh   rY   rd   re   rf   rg   s           rD   updateRuns.update  s    @ WXaWdeffTU[T^_``&QM<ORQzz	{&1 *h!79J9Z9Z[(+Q[   
 	
rG   afterbeforelimitorderrd   re   rf   rg   c                   U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        [           [	        UUUU	[        UUUUS.[        R                  5      S9[        S9$ 	a  
Returns a list of runs belonging to a thread.

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.

  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
rx   ry   rz   r{   r|   )r   r   r   r   r}   )pager   rZ   )r   _get_api_listr$   r2   r'   r   r.   RunListParams
rC   rh   r   r   r   r   rd   re   rf   rg   s
             rD   list	Runs.list  s    V WXaWdeff&QM<ORQ!!	{%($(+'%%!&"(!&!&	 $11 % " 
 	
rG   c          
         U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU SU S3[        X4XVS9[        S	9$ )
   
Cancels a run that is `in_progress`.

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
rx   r   ry   rz   r{   r   /cancelr   r   r   r   r'   r2   r   s          rD   cancelRuns.cancel  s    0 WXaWdeffTU[T^_``&QM<ORQzz	{&8(+Q[   
 	
rG   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r_   r`   ra   rb   rc   poll_interval_msrd   re   rf   rg   c                   U R                  UUUUUUUUUU	UUUU
USUUUUUUUS9nU R                  UR                  UUUUUUS9$ )
A helper to create a run an poll for a terminal state. More information on Run
lifecycles can be found here:
https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
Frh   ri   rS   rT   rU   rV   rW   rX   rY   rZ   r]   r_   r`   r[   r\   r^   ra   rc   rb   rd   re   rf   rg   rh   rd   re   rf   r   rg   rn   pollidrC   ri   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r_   r`   ra   rb   rc   r   rh   rd   re   rf   rg   runs                            rD   create_and_pollRuns.create_and_poll  s    D kk%$; 3%"7/+## 3- 3'#!1  
4 yyFF'#!-  
 	
rG   use `stream` insteadrT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r_   r`   ra   rb   rc   rd   re   rf   rg   c                   gCreate a Run streamNrl   rC   ri   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r_   r`   ra   rb   rc   rh   rd   re   rf   rg   s                         rD   create_and_streamRuns.create_and_stream]      < 	rG   c                   gr   rl   )rC   ri   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r_   r`   ra   rb   rc   rh   event_handlerrd   re   rf   rg   s                          rD   r   r   }      > 	rG   )rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r_   r`   ra   rb   rc   r   rd   re   rf   rg   c                  U(       d  [        SU< 35      eSSU(       a  SOSS.U=(       d    0 En[        U R                  SU S3[        0 S	U_S
U_SU_SU_SU_SU_SU_SU_SU_SU_SU_SS_SU_SU_SU	_SU
_SU_[        R
                  5      [        UUUUS9[        S[        [           S9n[        UU=(       d
    [        5       S9$ )r   rx   rz   threads.runs.create_and_streamtruefalsery   zX-Stainless-Stream-Helperz X-Stainless-Custom-Event-Handlerr{   r|   ri   rT   rU   rV   rW   rX   rY   rZ   r]   r_   r`   r^   Tra   rc   r[   r\   rb   r   r   r   r   r   r   r   r/   r   r'   r2   r"   r7   r*   r(   )rC   ri   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r_   r`   ra   rb   rc   rh   r   rd   re   rf   rg   make_requests                           rD   r   r     s   < WXaWdeff +)I:GW
 "	
 JJ	{%( "L-/F *+> #L	
 ,-B ():  U & "; "; d U *+> *+>  '(8!" U#& "11), )+Q[el 23=
@ &l-BjShSjkkrG   c           	        SS0U=(       d    0 En[        U5      (       a  [        U5      US'   1 Skn U R                  R                  UUUUUUS9n	U	R	                  5       n
U
R
                  U;   a  U
$ [        U5      (       d,  U	R                  R                  S5      nUb  [        U5      nOSnU R                  US-  5        M  )
A helper to poll a run status until it reaches a terminal state. More
information on Run lifecycles can be found here:
https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
X-Stainless-Poll-Helperr    X-Stainless-Custom-Poll-Interval>   failedexpired	cancelled	completed
incompleterequires_actionrh   r   rd   rf   re   rg   openai-poll-after-ms  
r   strrK   r   parsestatusheadersgetint_sleeprC   r   rh   rd   re   rf   rg   r   terminal_statesresponser   from_headers               rD   r   	Runs.poll  s     3FT}?RPRT$%%@CDT@UM<=j--66#+%' 7 H .."Czz_,
,--&..223IJ*'*;'7$'+$KK(4/0- rG   c                   gr   rl   )rC   ri   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r_   r`   ra   rb   rc   rh   rd   re   rf   rg   s                          rD   r^   Runs.stream  r   rG   c                   gr   rl   rC   ri   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r_   r`   ra   rb   rc   rh   r   rd   re   rf   rg   s                           rD   r^   r   4  r   rG   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r_   r`   ra   rb   rc   r   rd   re   rf   rg   c                  U(       d  [        SU< 35      eSSU(       a  SOSS.U=(       d    0 En[        U R                  SU S3[        0 S	U_S
U_SU_SU_SU_SU_SU_SU	_SU_SU_SU_SS_SU_SU
_SU_SU_SU_[        R
                  5      [        UUUU[        SU0[        R
                  5      S9[        S[        [           S9n[        UU=(       d
    [        5       S9$ r   rx   rz   r   r   r   r   r{   r|   ri   rT   rU   rV   rW   rX   rY   rZ   r]   r_   r`   r^   Tra   r[   r\   rc   rb   rS   r}   r   r   r   )rC   ri   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r_   r`   ra   rb   rc   rh   r   rd   re   rf   rg   r   s                            rD   r^   r   U  s   < WXaWdeff +)I:GW
 "	
 JJ	{%( "L-/F *+> #L	
 ,-B ():  U & "; "; d U *+> '(8  *+>!" U#& "11), )+'%%y'&:<M<]<]^ 23E#
H &l-BjShSjkkrG   r^   rd   re   rf   rg   tool_outputsc                   ga  
When a run has the `status: "requires_action"` and `required_action.type` is
`submit_tool_outputs`, this endpoint can be used to submit the outputs from the
tool calls once they're all completed. All outputs must be submitted in a single
request.

Args:
  tool_outputs: A list of tools for which the outputs are being submitted.

  stream: If `true`, returns a stream of events that happen during the Run as server-sent
      events, terminating when the Run enters a terminal state with a `data: [DONE]`
      message.

  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
Nrl   	rC   r   rh   r   r^   rd   re   rf   rg   s	            rD   submit_tool_outputsRuns.submit_tool_outputs      H 	rG   c                   ga  
When a run has the `status: "requires_action"` and `required_action.type` is
`submit_tool_outputs`, this endpoint can be used to submit the outputs from the
tool calls once they're all completed. All outputs must be submitted in a single
request.

Args:
  stream: If `true`, returns a stream of events that happen during the Run as server-sent
      events, terminating when the Run enters a terminal state with a `data: [DONE]`
      message.

  tool_outputs: A list of tools for which the outputs are being submitted.

  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
Nrl   	rC   r   rh   r^   r   rd   re   rf   rg   s	            rD   r   r     r   rG   c                   gr   rl   r   s	            rD   r   r     r   rG   rh   r^   r   c               R   U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU SU S3[        UUS.U(       a  [        R                  O[        R
                  5      [        XVXxS	9[        U=(       d    S
[        [           S9$ Nrx   r   ry   rz   r{   r   /submit_tool_outputsr   r^   r   Fr   )
r   r   r   r1   #RunSubmitToolOutputsParamsStreaming&RunSubmitToolOutputsParamsNonStreamingr'   r2   r"   r7   r   s	            rD   r   r     s     WXaWdeffTU[T^_``&QM<ORQzz	{&0DE $0$
  /RR3ZZ )+Q[ ?U23!  
 	
rG   r   rd   re   rf   rg   c               l    U R                  UUUSUUUUS9n	U R                  U	R                  UUUUUUS9$ )
A helper to submit a tool output to a run and poll for a terminal run state.
More information on Run lifecycles can be found here:
https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
Fr   rh   r   r^   rd   re   rf   rg   r   rh   rd   re   rf   rg   r   r   r   r   
rC   r   r   rh   r   rd   re   rf   rg   r   s
             rD   submit_tool_outputs_and_poll!Runs.submit_tool_outputs_and_poll;  sb    & &&%'#! ' 	
 yy66'#!-  
 	
rG   c                   g
Submit the tool outputs from a previous run and stream the run to a terminal
state. More information on Run lifecycles can be found here:
https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
Nrl   rC   r   r   rh   rd   re   rf   rg   s           rD   submit_tool_outputs_streamRuns.submit_tool_outputs_streamb      & 	rG   c                   gr  rl   	rC   r   r   rh   r   rd   re   rf   rg   s	            rD   r  r  w      ( 	rG   r   rd   re   rf   rg   c               f   U(       d  [        SU< 35      eU(       d  [        SU< 35      eSSU(       a  SOSS.U=(       d    0 En[        U R                  SU S	U S
3[        USS.[        R
                  5      [        XVXxS9[        S[        [           S9n	[        X=(       d
    [        5       S9$ r  r   rx   rz   z'threads.runs.submit_tool_outputs_streamr   r   r   r{   r   r  Tr  r   r   r   )r   r   r   r   r1   RunSubmitToolOutputsParamsr'   r2   r"   r7   r*   r(   
rC   r   r   rh   r   rd   re   rf   rg   requests
             rD   r  r    s    & TU[T^_``WXaWdeff +)R:GW
 "	
 JJ	{&0DE $0" /II )+Q[ 23
" &g=eNcNeffrG   rl   )returnr   )r  rJ   )r  rO   0rh   r   ri   r   rS   List[RunStepInclude] | NotGivenrT   Optional[str] | NotGivenrU   BOptional[Iterable[run_create_params.AdditionalMessage]] | NotGivenrV   r!  rW   Optional[int] | NotGivenrX   r#  rY   Optional[Metadata] | NotGivenrZ   &Union[str, ChatModel, None] | NotGivenr[   bool | NotGivenr\   $Optional[ReasoningEffort] | NotGivenr]   7Optional[AssistantResponseFormatOptionParam] | NotGivenr^   #Optional[Literal[False]] | NotGivenr_   Optional[float] | NotGivenr`   3Optional[AssistantToolChoiceOptionParam] | NotGivenra   1Optional[Iterable[AssistantToolParam]] | NotGivenrb   r*  rc   9Optional[run_create_params.TruncationStrategy] | NotGivenrd   Headers | Nonere   Query | Nonerf   Body | Nonerg   'float | httpx.Timeout | None | NotGivenr  r2   )0rh   r   ri   r   r^   Literal[True]rS   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r\   r'  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rd   r.  re   r/  rf   r0  rg   r1  r  Stream[AssistantStreamEvent])0rh   r   ri   r   r^   boolrS   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r\   r'  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rd   r.  re   r/  rf   r0  rg   r1  r  "Run | Stream[AssistantStreamEvent])0rh   r   ri   r   rS   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r\   r'  r]   r(  r^   3Optional[Literal[False]] | Literal[True] | NotGivenr_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rd   r.  re   r/  rf   r0  rg   r1  r  r5  r   r   rh   r   rd   r.  re   r/  rf   r0  rg   r1  r  r2   r   r   rh   r   rY   r$  rd   r.  re   r/  rf   r0  rg   r1  r  r2   )rh   r   r   str | NotGivenr   r9  r   int | NotGivenr   !Literal['asc', 'desc'] | NotGivenrd   r.  re   r/  rf   r0  rg   r1  r  zSyncCursorPage[Run]0ri   r   rS   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r\   r'  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  r   r:  rh   r   rd   r.  re   r/  rf   r0  rg   r1  r  r2   ),ri   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r\   r'  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rh   r   rd   r.  re   r/  rf   r0  rg   r1  r  -AssistantStreamManager[AssistantEventHandler]).ri   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r\   r'  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rh   r   r   r)   rd   r.  re   r/  rf   r0  rg   r1  r  .AssistantStreamManager[AssistantEventHandlerT]).ri   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r\   r'  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rh   r   r   AssistantEventHandlerT | Nonerd   r.  re   r/  rf   r0  rg   r1  r  ^AssistantStreamManager[AssistantEventHandler] | AssistantStreamManager[AssistantEventHandlerT]r   r   rh   r   rd   r.  re   r/  rf   r0  rg   r1  r   r:  r  r2   ).ri   r   rS   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r\   r'  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rh   r   rd   r.  re   r/  rf   r0  rg   r1  r  r=  )0ri   r   rS   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r\   r'  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rh   r   r   r)   rd   r.  re   r/  rf   r0  rg   r1  r  r>  )0ri   r   rS   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r\   r'  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rh   r   r   r?  rd   r.  re   r/  rf   r0  rg   r1  r  r@  r   r   rh   r   r   3Iterable[run_submit_tool_outputs_params.ToolOutput]r^   r)  rd   r.  re   r/  rf   r0  rg   r1  r  r2   )r   r   rh   r   r^   r2  r   rC  rd   r.  re   r/  rf   r0  rg   r1  r  r3  )r   r   rh   r   r^   r4  r   rC  rd   r.  re   r/  rf   r0  rg   r1  r  r5  )r   r   rh   r   r   rC  r^   r6  rd   r.  re   r/  rf   r0  rg   r1  r  r5  r   rC  r   r   rh   r   r   r:  rd   r.  re   r/  rf   r0  rg   r1  r  r2   )r   rC  r   r   rh   r   rd   r.  re   r/  rf   r0  rg   r1  r  r=  )r   rC  r   r   rh   r   r   r)   rd   r.  re   r/  rf   r0  rg   r1  r  r>  )r   rC  r   r   rh   r   r   r?  rd   r.  re   r/  rf   r0  rg   r1  r  r@  __name__
__module____qualname____firstlineno__r   rE   rK   rP   r
   r   rn   r   r   r   r   r   r   typing_extensions
deprecatedr   r   r^   r   r  r  __static_attributes__rl   rG   rD   r;   r;   =   sC   # # ) ) / /  4=<Ebk1::C6?2;8A/8AJS\6?2;KTCL,5Yb )-$("&;D7SS 	S
 1S ":S `S /S  8S 4S 0S 6S -S ?S QS  4!S" 0#S$ I%S& A'S( *)S* W+S0 &1S2 "3S4  5S6 97S8 
9S Sj  4=<Ebk1::C6?2;8A/8AJS\2;KTCL,5Yb )-$("&;D7SS 	S
 S 1S ":S `S /S  8S 4S 0S 6S -S ?S  Q!S" 0#S$ I%S& A'S( *)S* W+S0 &1S2 "3S4  5S6 97S8 
&9S Sj  4=<Ebk1::C6?2;8A/8AJS\2;KTCL,5Yb )-$("&;D7SS 	S
 S 1S ":S `S /S  8S 4S 0S 6S -S ?S  Q!S" 0#S$ I%S& A'S( *)S* W+S0 &1S2 "3S4  5S6 97S8 
,9S Sj N#nh%?@ 4=<Ebk1::C6?2;8A/8AJS\FO2;KTCL,5Yb )-$("&;D7B
B
 	B

 1B
 ":B
 `B
 /B
  8B
 4B
 0B
 6B
 -B
 ?B
 QB
  D!B
" 0#B
$ I%B
& A'B
( *)B
* W+B
0 &1B
2 "3B
4  5B
6 97B
8 
,9B
 AB
V )-$("&;D#
#
 	#
 &#
 "#
  #
 9#
 
#
T 3< )-$("&;D,
,
 	,

 0,
 &,
 ",
  ,
 9,
 
,
d !*!* )3< )-$("&;DA
A
 	A

 A
 A
 1A
 &A
 "A
  A
 9A
 
A
T )-$("&;D#
#
 	#
 &#
 "#
  #
 9#
 
#
R 4=<Ebk1::C6?2;8A/8AJS\2;KTCL,5Yb+4 )-$("&;D7D
 D
 1	D

 ":D
 `D
 /D
  8D
 4D
 0D
 6D
 -D
 ?D
 QD
 0D
  I!D
" A#D
$ *%D
& W'D
( ))D
* +D
0 &1D
2 "3D
4  5D
6 97D
8 
9D
L !!"89
 =Fbk1::C6?2;8A/8AJS\2;KTCL,5Yb )-$("&;D3  ":	
 ` /  8 4 0 6 - ? Q 0 I  A!" *#$ W%& ', &-. "/0  12 934 
75 : < !!"89
 =Fbk1::C6?2;8A/8AJS\2;KTCL,5Yb
 )-$("&;D5  ":	
 ` /  8 4 0 6 - ? Q 0 I  A!" *#$ W%& '( .). &/0 "12  34 956 
87 : > !!"89
 =Fbk1::C6?2;8A/8AJS\2;KTCL,5Yb7; )-$("&;D5Fl Fl ":	Fl
 `Fl /Fl  8Fl 4Fl 0Fl 6Fl -Fl ?Fl QFl 0Fl IFl  A!Fl" *#Fl$ W%Fl& 'Fl( 5)Fl. &/Fl0 "1Fl2  3Fl4 95Fl6 
h7Fl :FlX )-$("&;D+4+1+1 +1 &	+1
 "+1  +1 9+1 )+1 
+1Z 
 4=<Ebk1::C6?2;8A/8AJS\2;KTCL,5Yb )-$("&;D5  1	
 ": ` /  8 4 0 6 - ? Q 0  I!" A#$ *%& W'( ). &/0 "12  34 956 
77 > 
 4=<Ebk1::C6?2;8A/8AJS\2;KTCL,5Yb
 )-$("&;D7  1	
 ": ` /  8 4 0 6 - ? Q 0  I!" A#$ *%& W'( )* .+0 &12 "34  56 978 
89 H 4=<Ebk1::C6?2;8A/8AJS\2;KTCL,5Yb7; )-$("&;D7Kl Kl 1	Kl
 ":Kl `Kl /Kl  8Kl 4Kl 0Kl 6Kl -Kl ?Kl QKl 0Kl  I!Kl" A#Kl$ *%Kl& W'Kl( )Kl* 5+Kl0 &1Kl2 "3Kl4  5Kl6 97Kl8 
h9KlZ  7@ )-$("&;D## 	#
 J# 4# &# "#  # 9# 
# #J  )-$("&;D## 	#
 # J# &# "#  # 9# 
&# #J  )-$("&;D## 	#
 # J# &# "#  # 9# 
,# #J K02YZ GP )-$("&;D$
$
 	$

 J$
 D$
 &$
 "$
  $
 9$
 
,$
 [$
X ,5 )-$("&;D%
 J%
 	%

 %
 )%
 &%
 "%
  %
 9%
 
%
N  )-$("&;D J 	
  & "   9 
7 (  )-$("&;D J 	
  . & "   9 
8 6 8< )-$("&;D0g J0g 	0g
 0g 50g &0g "0g  0g 90g 
h0g 0grG   c                  
   \ rS rSr\S2S j5       r\S3S j5       r\S4S j5       r\\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                               S5S
 jj5       r
\\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                               S6S jj5       r
\\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                               S7S jj5       r
\" S/SS	/5      \	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                               S8S jj5       r
SSS\	S.             S9S jjr\	SSS\	S.               S:S jjr\	\	\	\	SSS\	S.                   S;S jjrSSS\	S.             S9S jjr\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                               S<S jjr\\R$                  " S5      \	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                         S=S jj5       5       r\\R$                  " S5      \	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                           S>S jj5       5       r\R$                  " S5      \	\	\	\	\	\	\	\	\	\	\	\	\	\	SSSS\	S.                                           S?S jj5       rSSS\	\	4               S@S jjr\\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                           SAS  jj5       r\\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                               SBS! jj5       r\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSSS\	S".                                               SCS# jjr\\	SSS\	S$.                 SDS& jj5       r\SSS\	S.                 SES' jj5       r\SSS\	S.                 SFS( jj5       r\" SS%// S)Q5      \	SSS\	S$.                 SGS* jj5       r\	SSS\	S+.                 SHS, jjr\SSS\	S.               SIS- jj5       r\SSS\	S.                 SJS. jj5       rSSSS\	S/.                 SKS0 jjrS1rg)Lr<   i  c                ,    [        U R                  5      $ r@   )r   rA   rB   s    rD   rE   AsyncRuns.steps  s    $,,''rG   c                    [        U 5      $ rI   )AsyncRunsWithRawResponserB   s    rD   rK   AsyncRuns.with_raw_response  s     (--rG   c                    [        U 5      $ rN   )AsyncRunsWithStreamingResponserB   s    rD   rP   !AsyncRuns.with_streaming_response  s     .d33rG   NrR   rh   ri   r^   c                  #    g7frk   rl   rm   s                           rD   rn   AsyncRuns.create       h 	   rq   c                  #    g7frs   rl   rt   s                           rD   rn   rW  n  rX  rY  c                  #    g7frs   rl   rt   s                           rD   rn   rW    rX  rY  c                 #    U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        0 SU_SU_SU_S	U_S
U_SU_SU	_SU
_SU_SU_SU_SU_SU_SU_SU_SU_SU_U(       a  [        R                  O[        R
                  5      I S h  vN [        UUUU[        SU0[        R                  5      I S h  vN S9[        U=(       d    S[        [           S9I S h  vN $  NW N- N7frw   )r   r   r   r/   r   r   r'   r   r2   r#   r7   rm   s                           rD   rn   rW    s    < WXaWdeff&QM<ORQZZ	{%(,"L-/F *+> #L	
 ,-B ():  U *+> '(8 & f "; "; U  U!" *+>#& ?E!::J[JwJw) , )+'%19g2FHYHiHijj ?U"#78C   "
 "
 "	
6 k;"
s6   BC=C7
 +C=C9&C=2C;3C=9C=;C=r   c          
        #    U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU SU 3[        X4XVS9[        S9I S	h  vN $  N7f)
r   rx   r   ry   rz   r{   r   r   r   Nr   r   s          rD   r   AsyncRuns.retrieve  s     0 WXaWdeffTU[T^_``&QM<ORQYY	{&1(+Q[   
 
 	
 
s   A"A+$A)%A+r   c               $  #    U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU SU 3[        SU0[        R                  5      I Sh  vN [        XEXgS	9[        S
9I Sh  vN $  N N7f)r   rx   r   ry   rz   r{   r   rY   Nr   r   )r   r   r   r0   r   r'   r2   r   s           rD   r   AsyncRuns.update  s     @ WXaWdeffTU[T^_``&QM<ORQZZ	{&1,j(-CEVEfEfgg(+Q[    
 
 	
g
s$   A-B/B
0BBBBr   c                   U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        [           [	        UUUU	[        UUUUS.[        R                  5      S9[        S9$ r   )r   r   r%   r2   r'   r   r.   r   r   s
             rD   r   AsyncRuns.list2  s    V WXaWdeff&QM<ORQ!!	{%( %(+'%%!&"(!&!&	 $11 % " 
 	
rG   c          
        #    U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU SU S3[        X4XVS9[        S	9I S
h  vN $  N7f)r   rx   r   ry   rz   r{   r   r   r   r   Nr   r   s          rD   r   AsyncRuns.cancelu  s     0 WXaWdeffTU[T^_``&QM<ORQZZ	{&8(+Q[    
 
 	
 
s   A#A,%A*&A,r   c                  #    U R                  UUUUUUUUUU	UUUU
USUUUUUUUS9I Sh  vN nU R                  UR                  UUUUUUS9I Sh  vN $  N+ N7f)r   Fr   Nr   r   r   s                            rD   r   AsyncRuns.create_and_poll  s     D KK%$; 3%"7/+## 3- 3'#!1   
 
4 YYFF'#!-  
 
 	
5
4
s!   )AA&AAAAr   )rT   rU   rV   rW   rX   rY   rZ   r[   r]   r_   r`   ra   rb   rc   rd   re   rf   rg   c                   gr   rl   )rC   ri   rT   rU   rV   rW   rX   rY   rZ   r[   r]   r_   r`   ra   rb   rc   rh   rd   re   rf   rg   s                        rD   r   AsyncRuns.create_and_stream      : 	rG   c                   gr   rl   )rC   ri   rT   rU   rV   rW   rX   rY   rZ   r[   r]   r_   r`   ra   rb   rc   rh   r   rd   re   rf   rg   s                         rD   r   rh    r   rG   )rT   rU   rV   rW   rX   rY   rZ   r[   r]   r_   r`   ra   rb   rc   r   rd   re   rf   rg   c                  U(       d  [        SU< 35      eSSU(       a  SOSS.U=(       d    0 EnU R                  SU S3[        0 S	U_S
U_SU_SU_SU_SU_SU_SU_SU
_SU_SU_SS_SU_SU_SU_SU	_[        R                  5      [        UUUUS9[        S[        [           S9n[        UU=(       d
    [        5       S9$ )r   rx   rz   r   r   r   r   r{   r|   ri   rT   rU   rV   rW   rX   rY   rZ   r]   r_   r`   r^   Tra   rc   rb   r[   r   r   r   r   r   r   r/   r   r'   r2   r#   r7   r-   r+   )rC   ri   rT   rU   rV   rW   rX   rY   rZ   r[   r]   r_   r`   ra   rb   rc   rh   r   rd   re   rf   rg   r  s                          rD   r   rh  	  s{   @ WXaWdeff +)I:GW
 "	
 **	{%( "L-/F *+> #L	
 ,-B ():  U & "; "; d U *+> U  *+>!$ "11'* )+Q[el "#789  
< +7-BoSmSopprG   c           	       #    SS0U=(       d    0 En[        U5      (       a  [        U5      US'   1 Skn U R                  R                  UUUUUUS9I Sh  vN n	U	R	                  5       n
U
R
                  U;   a  U
$ [        U5      (       d,  U	R                  R                  S5      nUb  [        U5      nOSnU R                  US-  5      I Sh  vN   M   N N7f)	r   r   r   r   >   r   r   r   r   r   r   r   Nr   r   r   r   s               rD   r   AsyncRuns.pollh	  s      3FT}?RPRT$%%@CDT@UM<=j!33<<#+%' =  H .."Czz_,
,--&..223IJ*'*;'7$'+$++.5666- * 7s%   ACCA9CCCCr   c                   gr   rl   r   s                         rD   r^   AsyncRuns.stream	  ri  rG   c                   gr   rl   r   s                           rD   r^   rp  	  r   rG   r   c                  U(       d  [        SU< 35      eSSU(       a  SOSS.U=(       d    0 EnU R                  SU S3[        0 S	U_S
U_SU_SU_SU_SU_SU_SU	_SU_SU_SU_SS_SU_SU
_SU_SU_SU_[        R                  5      [        UUUU[        SU0[        R                  5      S9[        S[        [           S9n[        UU=(       d
    [        5       S9$ r   rl  )rC   ri   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r_   r`   ra   rb   rc   rh   r   rd   re   rf   rg   r  s                            rD   r^   rp  	  s   B WXaWdeff +)I:GW
 "	
 **	{%( "L-/F *+> #L	
 ,-B ():  U & "; "; d U *+> '(8  *+>!" U#& "11), )+'%%y'&:<M<]<]^ "#78C  "
F +7-BoSmSopprG   r   r   c                  #    g7fr   rl   r   s	            rD   r   AsyncRuns.submit_tool_outputs$
       H 	rY  c                  #    g7fr   rl   r   s	            rD   r   rt  J
  ru  rY  c                  #    g7fr   rl   r   s	            rD   r   rt  p
  ru  rY  r   c                 #    U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU SU S3[        UUS.U(       a  [        R                  O[        R
                  5      I S h  vN [        XVXxS	9[        U=(       d    S
[        [           S9I S h  vN $  N2 N7fr   )
r   r   r   r1   r  r  r'   r2   r#   r7   r   s	            rD   r   rt  
  s      WXaWdeffTU[T^_``&QM<ORQZZ	{&0DE,$0$
  /RR3ZZ  )+Q[ ?U"#78!   
 
 	

s$   BB?B;
	-B?6B=7B?=B?r  c                  #    U R                  UUUSUUUUS9I Sh  vN n	U R                  U	R                  UUUUUUS9I Sh  vN $  N+ N7f)r  Fr  Nr	  r
  r  s
             rD   r  &AsyncRuns.submit_tool_outputs_and_poll
  sy     & ,,%'#! - 	
 	
 YY66'#!-  
 
 	
	

s!   AA&AA
A
Ac                   gr  rl   r  s           rD   r  $AsyncRuns.submit_tool_outputs_stream
  r  rG   c                   gr  rl   r  s	            rD   r  r|  
  r  rG   r  c               \   U(       d  [        SU< 35      eU(       d  [        SU< 35      eSSU(       a  SOSS.U=(       d    0 EnU R                  SU S	U S
3[        USS.[        R                  5      [        XVXxS9[        S[        [           S9n	[        X=(       d
    [        5       S9$ r  )r   r   r   r1   r  r'   r2   r#   r7   r-   r+   r  s
             rD   r  r|    s    , TU[T^_``WXaWdeff +)R:GW
 "	
 **	{&0DE $0" /II )+Q[ "#78  
  +7BoSmSopprG   rl   )r  r   )r  rQ  )r  rT  r  )0rh   r   ri   r   r^   r2  rS   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r\   r'  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rd   r.  re   r/  rf   r0  rg   r1  r  !AsyncStream[AssistantStreamEvent])0rh   r   ri   r   r^   r4  rS   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r\   r'  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rd   r.  re   r/  rf   r0  rg   r1  r  'Run | AsyncStream[AssistantStreamEvent])0rh   r   ri   r   rS   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r\   r'  r]   r(  r^   r6  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rd   r.  re   r/  rf   r0  rg   r1  r  r  r7  r8  )rh   r   r   r9  r   r9  r   r:  r   r;  rd   r.  re   r/  rf   r0  rg   r1  r  z)AsyncPaginator[Run, AsyncCursorPage[Run]]r<  )*ri   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rh   r   rd   r.  re   r/  rf   r0  rg   r1  r  7AsyncAssistantStreamManager[AsyncAssistantEventHandler]),ri   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rh   r   r   r,   rd   r.  re   r/  rf   r0  rg   r1  r  8AsyncAssistantStreamManager[AsyncAssistantEventHandlerT]),ri   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rh   r   r   "AsyncAssistantEventHandlerT | Nonerd   r.  re   r/  rf   r0  rg   r1  r  rAsyncAssistantStreamManager[AsyncAssistantEventHandler] | AsyncAssistantStreamManager[AsyncAssistantEventHandlerT]rA  ),ri   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r\   r'  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rh   r   rd   r.  re   r/  rf   r0  rg   r1  r  r  )0ri   r   rS   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r\   r'  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rh   r   r   r,   rd   r.  re   r/  rf   r0  rg   r1  r  r  )0ri   r   rS   r   rT   r!  rU   r"  rV   r!  rW   r#  rX   r#  rY   r$  rZ   r%  r[   r&  r\   r'  r]   r(  r_   r*  r`   r+  ra   r,  rb   r*  rc   r-  rh   r   r   r  rd   r.  re   r/  rf   r0  rg   r1  r  r  rB  )r   r   rh   r   r^   r2  r   rC  rd   r.  re   r/  rf   r0  rg   r1  r  r  )r   r   rh   r   r^   r4  r   rC  rd   r.  re   r/  rf   r0  rg   r1  r  r  )r   r   rh   r   r   rC  r^   r6  rd   r.  re   r/  rf   r0  rg   r1  r  r  rD  )r   rC  r   r   rh   r   rd   r.  re   r/  rf   r0  rg   r1  r  r  )r   rC  r   r   rh   r   r   r,   rd   r.  re   r/  rf   r0  rg   r1  r  r  )r   rC  r   r   rh   r   r   r  rd   r.  re   r/  rf   r0  rg   r1  r  r  rE  rl   rG   rD   r<   r<     s   ( ( . . 4 4  4=<Ebk1::C6?2;8A/8AJS\6?2;KTCL,5Yb )-$("&;D7SS 	S
 1S ":S `S /S  8S 4S 0S 6S -S ?S QS  4!S" 0#S$ I%S& A'S( *)S* W+S0 &1S2 "3S4  5S6 97S8 
9S Sj  4=<Ebk1::C6?2;8A/8AJS\2;KTCL,5Yb )-$("&;D7SS 	S
 S 1S ":S `S /S  8S 4S 0S 6S -S ?S  Q!S" 0#S$ I%S& A'S( *)S* W+S0 &1S2 "3S4  5S6 97S8 
+9S Sj  4=<Ebk1::C6?2;8A/8AJS\2;KTCL,5Yb )-$("&;D7SS 	S
 S 1S ":S `S /S  8S 4S 0S 6S -S ?S  Q!S" 0#S$ I%S& A'S( *)S* W+S0 &1S2 "3S4  5S6 97S8 
19S Sj N#nh%?@ 4=<Ebk1::C6?2;8A/8AJS\FO2;KTCL,5Yb )-$("&;D7B
B
 	B

 1B
 ":B
 `B
 /B
  8B
 4B
 0B
 6B
 -B
 ?B
 QB
  D!B
" 0#B
$ I%B
& A'B
( *)B
* W+B
0 &1B
2 "3B
4  5B
6 97B
8 
19B
 AB
V )-$("&;D#
#
 	#
 &#
 "#
  #
 9#
 
#
T 3< )-$("&;D,
,
 	,

 0,
 &,
 ",
  ,
 9,
 
,
d !*!* )3< )-$("&;DA
A
 	A

 A
 A
 1A
 &A
 "A
  A
 9A
 
3A
T )-$("&;D#
#
 	#
 &#
 "#
  #
 9#
 
#
R 4=<Ebk1::C6?2;8A/8AJS\2;KTCL,5Yb+4 )-$("&;D7D
 D
 1	D

 ":D
 `D
 /D
  8D
 4D
 0D
 6D
 -D
 ?D
 QD
 0D
  I!D
" A#D
$ *%D
& W'D
( ))D
* +D
0 &1D
2 "3D
4  5D
6 97D
8 
9D
L !!"89
 =Fbk1::C6?2;8A/8S\2;KTCL,5Yb )-$("&;D1  ":	
 ` /  8 4 0 6 - Q 0 I A  *!" W#$ %* &+, "-.  /0 912 
A3 : : !!"89
 =Fbk1::C6?2;8A/8S\2;KTCL,5Yb
 )-$("&;D3  ":	
 ` /  8 4 0 6 - Q 0 I A  *!" W#$ %& 3', &-. "/0  12 934 
B5 : < !!"89
 =Fbk1::C6?2;8A/8S\2;KTCL,5Yb<@ )-$("&;D3Fq Fq ":	Fq
 `Fq /Fq  8Fq 4Fq 0Fq 6Fq -Fq QFq 0Fq IFq AFq  *!Fq" W#Fq$ %Fq& :'Fq, &-Fq. "/Fq0  1Fq2 93Fq6	C7Fq :FqX )-$("&;D+4+7+7 +7 &	+7
 "+7  +7 9+7 )+7 
+7Z 
 =Fbk1::C6?2;8A/8AJS\2;KTCL,5Yb )-$("&;D3  ":	
 ` /  8 4 0 6 - ? Q 0 I  A!" *#$ W%& ', &-. "/0  12 934 
A5 < 
 4=<Ebk1::C6?2;8A/8AJS\2;KTCL,5Yb
 )-$("&;D7  1	
 ": ` /  8 4 0 6 - ? Q 0  I!" A#$ *%& W'( )* 3+0 &12 "34  56 978 
B9 H 4=<Ebk1::C6?2;8A/8AJS\2;KTCL,5Yb<@ )-$("&;D7Mq Mq 1	Mq
 ":Mq `Mq /Mq  8Mq 4Mq 0Mq 6Mq -Mq ?Mq QMq 0Mq  I!Mq" A#Mq$ *%Mq& W'Mq( )Mq* :+Mq0 &1Mq2 "3Mq4  5Mq6 97Mq:	C;Mq^  7@ )-$("&;D## 	#
 J# 4# &# "#  # 9# 
# #J  )-$("&;D## 	#
 # J# &# "#  # 9# 
+# #J  )-$("&;D## 	#
 # J# &# "#  # 9# 
1# #J K02YZ GP )-$("&;D$
$
 	$

 J$
 D$
 &$
 "$
  $
 9$
 
1$
 [$
X ,5 )-$("&;D%
 J%
 	%

 %
 )%
 &%
 "%
  %
 9%
 
%
N  )-$("&;D J 	
  & "   9 
A (  )-$("&;D J 	
  3 & "   9 
B 6 =A )-$("&;D2q J2q 	2q
 2q :2q &2q "2q  2q 92q	C2q 2qrG   c                  2    \ rS rSrSS jr\SS j5       rSrg)rJ   iD  c                   Xl         [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR
                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        g r@   )	_runsr   to_raw_response_wrapperrn   r   r   r   r   r   rC   runss     rD   __init__RunsWithRawResponse.__init__E  s    
&>>KK
 )@@MM
 '>>KK
 %<<II
	 '>>KK
 $4#K#K$$$
 rG   c                @    [        U R                  R                  5      $ r@   )r   r  rE   rB   s    rD   rE   RunsWithRawResponse.steps[  s    #DJJ$4$455rG   r  r   rn   r   r   r   r   Nr  r;   r  None)r  r   rF  rG  rH  rI  r  r   rE   rL  rl   rG   rD   rJ   rJ   D  s    
, 6 6rG   rJ   c                  2    \ rS rSrSS jr\SS j5       rSrg)rQ  i`  c                   Xl         [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR
                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        g r@   )	r  r   async_to_raw_response_wrapperrn   r   r   r   r   r   r  s     rD   r  !AsyncRunsWithRawResponse.__init__a  s    
&DDKK
 )FFMM
 'DDKK
 %BBII
	 'DDKK
 $4#Q#Q$$$
 rG   c                @    [        U R                  R                  5      $ r@   )r   r  rE   rB   s    rD   rE   AsyncRunsWithRawResponse.stepsw  s    ()9)9::rG   r  Nr  r<   r  r  )r  r   r  rl   rG   rD   rQ  rQ  `  s    
, ; ;rG   rQ  c                  2    \ rS rSrSS jr\SS j5       rSrg)rO   i|  c                H   Xl         [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        [        UR
                  5      U l        [        UR                  5      U l        [        UR                  5      U l        g r@   )r  r    rn   r   r   r   r   r   r  s     rD   r  "RunsWithStreamingResponse.__init__}  s    
2KK
 5MM
 3KK
 1II
	 3KK
 $@$$$
 rG   c                @    [        U R                  R                  5      $ r@   )r   r  rE   rB   s    rD   rE   RunsWithStreamingResponse.steps  s    )$***:*:;;rG   r  Nr  )r  r   r  rl   rG   rD   rO   rO   |  s    
, < <rG   rO   c                  2    \ rS rSrSS jr\SS j5       rSrg)rT  i  c                H   Xl         [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        [        UR
                  5      U l        [        UR                  5      U l        [        UR                  5      U l        g r@   )r  r!   rn   r   r   r   r   r   r  s     rD   r  'AsyncRunsWithStreamingResponse.__init__  s    
8KK
 ;MM
 9KK
 7II
	 9KK
 $F$$$
 rG   c                @    [        U R                  R                  5      $ r@   )r   r  rE   rB   s    rD   rE   $AsyncRunsWithStreamingResponse.steps  s    .tzz/?/?@@rG   r  Nr  )r  r   r  rl   rG   rD   rT  rT    s    
, A ArG   rT  )W
__future__r   rJ  typingr   r   r   r   	functoolsr   r	   r
   httpx r   rE   r   r   r   r   r   r   _typesr   r   r   r   r   _utilsr   r   r   r   _compatr   	_resourcer   r   	_responser    r!   
_streamingr"   r#   
paginationr$   r%   _base_clientr&   r'   lib.streamingr(   r)   r*   r+   r,   r-   types.beta.threadsr.   r/   r0   r1   types.beta.threads.runr2   types.shared.chat_modelr3   types.shared_params.metadatar4   types.shared.reasoning_effortr5   types.beta.assistant_tool_paramr6   !types.beta.assistant_stream_eventr7   (types.beta.threads.runs.run_step_includer8   -types.beta.assistant_tool_choice_option_paramr9   1types.beta.assistant_response_format_option_paramr:   __all__r;   r<   rJ   rQ  rO   rT  rl   rG   rD   <module>r     s    #  2 2  /  "  B A  ) < [ / ; B   , 2 6 > C G H ] e;
@g? @gF,Aq  AqH,6 68; ;8< <8A ArG   