
    hsv                   $   S SK Jr  S SK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  SSKJ r J!r!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/J0r0  SSK1J2r2J3r3J4r4  SSK5J6r6  SSK7J8r8J9r9J: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/rN " S S\)5      rO " S S\*5      rP " S  S!5      rQ " S" S#5      rR " S$ S%5      rS " S& S'5      rTg)(    )annotations)UnionIterableOptional)partial)LiteraloverloadN   )_legacy_response   )MessagesAsyncMessagesMessagesWithRawResponseAsyncMessagesWithRawResponseMessagesWithStreamingResponse"AsyncMessagesWithStreamingResponse)	NOT_GIVENBodyQueryHeadersNotGiven)required_argsmaybe_transformasync_maybe_transform)Runs	AsyncRunsRunsWithRawResponseAsyncRunsWithRawResponseRunsWithStreamingResponseAsyncRunsWithStreamingResponse)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)StreamAsyncStream)thread_create_paramsthread_update_paramsthread_create_and_run_params)make_request_options)AssistantEventHandlerAssistantEventHandlerTAssistantStreamManagerAsyncAssistantEventHandlerAsyncAssistantEventHandlerTAsyncAssistantStreamManager)Thread)Run)	ChatModel)ThreadDeleted)Metadata)AssistantStreamEvent)AssistantToolChoiceOptionParam)"AssistantResponseFormatOptionParamThreadsAsyncThreadsc                     \ rS rSr\SS j5       r\SS j5       r\SS j5       r\S S j5       r\	\	\	SSS\	S.               S!S 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	.           S$S jjr\\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                         S%S jj5       r\\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                         S&S jj5       r\\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                         S'S jj5       r\" S/SS/5      \	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                         S(S jj5       r\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                         S)S jjr\\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                       S*S jj5       r\\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                         S+S jj5       r\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSSS\	S.                                         S,S jjrSrg)-r:   @   c                ,    [        U R                  5      $ N)r   _clientselfs    W/var/www/html/env/lib/python3.13/site-packages/openai/resources/beta/threads/threads.pyrunsThreads.runsA   s    DLL!!    c                ,    [        U R                  5      $ r?   )r   r@   rA   s    rC   messagesThreads.messagesE   s    %%rF   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
)ThreadsWithRawResponserA   s    rC   with_raw_responseThreads.with_raw_responseI   s     &d++rF   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
)ThreadsWithStreamingResponserA   s    rC   with_streaming_responseThreads.with_streaming_responseS   s     ,D11rF   NrH   metadatatool_resourcesextra_headersextra_query
extra_bodytimeoutc                   SS0U=(       d    0 EnU R                  S[        UUUS.[        R                  5      [	        XEXgS9[
        S9$ )"  
Create a thread.

Args:
  messages: A list of [messages](https://platform.openai.com/docs/api-reference/messages) to
      start the thread with.

  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.

  tool_resources: A set of resources that are made available to the assistant's tools in this
      thread. The resources are specific to the type of tool. For example, the
      `code_interpreter` tool requires a list of file IDs, while the `file_search`
      tool requires a list of vector store IDs.

  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
OpenAI-Betaassistants=v2/threadsrH   rU   rV   rW   rX   rY   rZ   bodyoptionscast_to)_postr   r(   ThreadCreateParamsr+   r2   rB   rH   rU   rV   rW   rX   rY   rZ   s           rC   createThreads.create\   sh    P 'QM<ORQzz  ( (&4
 %77 )+Q[   
 	
rF   ra   c          
         U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU 3[        X#XES9[        S9$ )  
Retrieves a thread.

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
8Expected a non-empty value for `thread_id` but received r]   r^   	/threads/ra   rd   re   
ValueError_getr+   r2   rB   	thread_idrW   rX   rY   rZ   s         rC   retrieveThreads.retrieve   sc    . WXaWdeff&QM<ORQyy	{#(+Q[   
 	
rF   rU   rV   rW   rX   rY   rZ   c                   U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU 3[        UUS.[        R                  5      [        XEXgS9[        S9$ )  
Modifies a thread.

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.

  tool_resources: A set of resources that are made available to the assistant's tools in this
      thread. The resources are specific to the type of tool. For example, the
      `code_interpreter` tool requires a list of file IDs, while the `file_search`
      tool requires a list of vector store IDs.

  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
rm   r]   r^   rn   rU   rV   ra   rb   )rq   rf   r   r)   ThreadUpdateParamsr+   r2   rB   rt   rU   rV   rW   rX   rY   rZ   s           rC   updateThreads.update   s    J WXaWdeff&QM<ORQzz	{#  (&4 %77 )+Q[   
 	
rF   c          
         U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU 3[        X#XES9[        S9$ )  
Delete a thread.

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
rm   r]   r^   rn   ra   ro   rq   _deleter+   r5   rs   s         rC   deleteThreads.delete   sc    . WXaWdeff&QM<ORQ||	{#(+Q[ "  
 	
rF   instructionsmax_completion_tokensmax_prompt_tokensrU   modelparallel_tool_callsresponse_formatstreamtemperaturethreadtool_choicerV   toolstop_ptruncation_strategyrW   rX   rY   rZ   assistant_idr   c                   ga2  
Create a thread and run it in one request.

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

  instructions: Override the default system message 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.

  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.

  thread: Options to create a new thread. If no thread is provided when running a request,
      an empty thread will be created.

  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.

  tool_resources: A set of resources that are used by the assistant's tools. The resources are
      specific to the type of tool. For example, the `code_interpreter` tool requires
      a list of file IDs, while the `file_search` tool requires a list of vector store
      IDs.

  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 rB   r   r   r   r   rU   r   r   r   r   r   r   r   rV   r   r   r   rW   rX   rY   rZ   s                        rC   create_and_runThreads.create_and_run      F 	rF   r   r   r   rU   r   r   r   r   r   r   rV   r   r   r   rW   rX   rY   rZ   c                   ga2  
Create a thread and run it in one request.

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.

  instructions: Override the default system message 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.

  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.

  thread: Options to create a new thread. If no thread is provided when running a request,
      an empty thread will be created.

  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.

  tool_resources: A set of resources that are used by the assistant's tools. The resources are
      specific to the type of tool. For example, the `code_interpreter` tool requires
      a list of file IDs, while the `file_search` tool requires a list of vector store
      IDs.

  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
Nr   rB   r   r   r   r   r   rU   r   r   r   r   r   r   rV   r   r   r   rW   rX   rY   rZ   s                        rC   r   r     r   rF   c                   gr   r   r   s                        rC   r   r     r   rF   c               J   SS0U=(       d    0 EnU R                  S[        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_U	(       a  [        R                  O[        R                  5      [        UUUUS9[        U	=(       d    S[        [           S9$ Nr]   r^   /threads/runsr   r   r   r   rU   r   r   r   r   r   r   r   rV   r   r   r   ra   Frc   rd   re   r   
stream_cls)	rf   r   r*   !ThreadCreateAndRunParamsStreaming$ThreadCreateAndRunParamsNonStreamingr+   r3   r&   r7   r   s                        rC   r   r     sA   6 'QM<ORQzz "L"L ,-B ():	
  U *+> & f "; f "; %n U U  *+>!&  -NN1VV+. )+Q[el ?U23=  
 	
rF   r   r   r   rU   r   r   r   r   r   r   rV   r   r   r   poll_interval_msrW   rX   rY   rZ   c                   U R                  UUUUUUUUU	SU
UUUUUUUUUS9nU R                  R                  UR                  UR                  UUUUU5      $ )
A helper to create a thread, start a run and then 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r   r   r   r   rU   r   r   r   r   r   r   rV   r   r   r   r   rW   rX   rY   rZ   r   rD   pollidrt   rB   r   r   r   r   rU   r   r   r   r   r   r   rV   r   r   r   r   rW   rX   rY   rZ   runs                         rC   create_and_run_pollThreads.create_and_run_poll  s    > !!%%"7/ 3+#)# 3'#!) " 
, yy~~cffcmm]KQ[]dfvwwrF   c                   g'Create a thread and stream the run backNr   rB   r   r   r   r   rU   r   r   r   r   r   r   rV   r   r   r   rW   rX   rY   rZ   s                       rC   create_and_run_streamThreads.create_and_run_stream      6 	rF   c                   gr   r   rB   r   r   r   r   rU   r   r   r   r   r   r   rV   r   r   r   event_handlerrW   rX   rY   rZ   s                        rC   r   r   0      8 	rF   r   r   r   rU   r   r   r   r   r   r   rV   r   r   r   r   rW   rX   rY   rZ   c               `   SSU(       a  SOSS.U=(       d    0 En[        U R                  S[        0 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   r^   zthreads.create_and_run_streamtruefalse)r]   zX-Stainless-Stream-Helperz X-Stainless-Custom-Event-Handlerr   r   r   r   r   rU   r   r   r   r   r   r   Tr   r   rV   r   r   ra   r   )r   )r   rf   r   r*   ThreadCreateAndRunParamsr+   r3   r&   r7   r.   r,   )rB   r   r   r   r   rU   r   r   r   r   r   r   rV   r   r   r   r   rW   rX   rY   rZ   make_requests                         rC   r   r   N  sS   8 +)H:GW
 "	
 JJ "L"L ,-B ():	
  U *+> & "; "; d f U %n *+>  U!$ -EE'* )+Q[el 23;
> &l-BjShSjkkrF   r   )returnr   )r   r   )r   rL   )r   rQ   rH   z1Iterable[thread_create_params.Message] | NotGivenrU   Optional[Metadata] | NotGivenrV   z7Optional[thread_create_params.ToolResources] | NotGivenrW   Headers | NonerX   Query | NonerY   Body | NonerZ   'float | httpx.Timeout | None | NotGivenr   r2   rt   strrW   r   rX   r   rY   r   rZ   r   r   r2   rt   r   rU   r   rV   z7Optional[thread_update_params.ToolResources] | NotGivenrW   r   rX   r   rY   r   rZ   r   r   r2   rt   r   rW   r   rX   r   rY   r   rZ   r   r   r5   *r   r   r   Optional[str] | NotGivenr   Optional[int] | NotGivenr   r   rU   r   r   &Union[str, ChatModel, None] | NotGivenr   bool | NotGivenr   7Optional[AssistantResponseFormatOptionParam] | NotGivenr   z#Optional[Literal[False]] | NotGivenr   Optional[float] | NotGivenr   .thread_create_and_run_params.Thread | NotGivenr   3Optional[AssistantToolChoiceOptionParam] | NotGivenrV   ?Optional[thread_create_and_run_params.ToolResources] | NotGivenr   @Optional[Iterable[thread_create_and_run_params.Tool]] | NotGivenr   r   r   DOptional[thread_create_and_run_params.TruncationStrategy] | NotGivenrW   r   rX   r   rY   r   rZ   r   r   r3   )*r   r   r   Literal[True]r   r   r   r   r   r   rU   r   r   r   r   r   r   r   r   r   r   r   r   r   rV   r   r   r   r   r   r   r   rW   r   rX   r   rY   r   rZ   r   r   zStream[AssistantStreamEvent])*r   r   r   boolr   r   r   r   r   r   rU   r   r   r   r   r   r   r   r   r   r   r   r   r   rV   r   r   r   r   r   r   r   rW   r   rX   r   rY   r   rZ   r   r   "Run | Stream[AssistantStreamEvent])*r   r   r   r   r   r   r   r   rU   r   r   r   r   r   r   r   r   3Optional[Literal[False]] | Literal[True] | NotGivenr   r   r   r   r   r   rV   r   r   r   r   r   r   r   rW   r   rX   r   rY   r   rZ   r   r   r   *r   r   r   r   r   r   r   r   rU   r   r   r   r   r   r   r   r   r   r   r   r   r   rV   r   r   r   r   r   r   r   r   zint | NotGivenrW   r   rX   r   rY   r   rZ   r   r   r3   )(r   r   r   r   r   r   r   r   rU   r   r   r   r   r   r   r   r   r   r   r   r   r   rV   r   r   r   r   r   r   r   rW   r   rX   r   rY   r   rZ   r   r   z-AssistantStreamManager[AssistantEventHandler])*r   r   r   r   r   r   r   r   rU   r   r   r   r   r   r   r   r   r   r   r   r   r   rV   r   r   r   r   r   r   r   r   r-   rW   r   rX   r   rY   r   rZ   r   r   z.AssistantStreamManager[AssistantEventHandlerT])*r   r   r   r   r   r   r   r   rU   r   r   r   r   r   r   r   r   r   r   r   r   r   rV   r   r   r   r   r   r   r   r   zAssistantEventHandlerT | NonerW   r   rX   r   rY   r   rZ   r   r   z^AssistantStreamManager[AssistantEventHandler] | AssistantStreamManager[AssistantEventHandlerT]__name__
__module____qualname____firstlineno__r!   rD   rH   rM   rR   r   ri   ru   r}   r   r	   r   r   r   r   __static_attributes__r   rF   rC   r:   r:   @   s|   " " & & , , 2 2 GP2;R[ )-$("&;D7
 D7
 0	7

 P7
 &7
 "7
  7
 97
 
7
~ )-$("&;D 
 
 & 
 " 
   
 9 
 
 
L 3<R[ )-$("&;D5
5
 0	5

 P5
 &5
 "5
  5
 95
 
5
z )-$("&;D 
 
 & 
 " 
   
 9 
 
 
D 
 2;:C6?2;8A/8S\6?2;AJKTZcR[,5dm )-$("&;D1B B /	B
  8B 4B 0B 6B -B QB 4B 0B ?B IB XB  P!B" *#B$ b%B* &+B, "-B.  /B0 91B2 
3B BH  2;:C6?2;8A/8S\2;AJKTZcR[,5dm )-$("&;D1B B 	B
 /B  8B 4B 0B 6B -B QB 0B ?B IB XB  P!B" *#B$ b%B* &+B, "-B.  /B0 91B2 
&3B BH  2;:C6?2;8A/8S\2;AJKTZcR[,5dm )-$("&;D1B B 	B
 /B  8B 4B 0B 6B -B QB 0B ?B IB XB  P!B" *#B$ b%B* &+B, "-B.  /B0 91B2 
,3B BH N#nh%?@
 2;:C6?2;8A/8S\FO2;AJKTZcR[,5dm )-$("&;D1:
 :
 /	:

  8:
 4:
 0:
 6:
 -:
 Q:
 D:
 0:
 ?:
 I:
 X:
  P!:
" *#:
$ b%:
* &+:
, "-:
.  /:
0 91:
2 
,3:
 A:
@ 2;:C6?2;8A/8S\2;AJKTZcR[,5dm+4 )-$("&;D15x 5x /	5x
  85x 45x 05x 65x -5x Q5x 05x ?5x I5x X5x P5x  *!5x" b#5x$ )%5x* &+5x, "-5x.  /5x0 915x2 
35xn 
 2;:C6?2;8A/8S\2;AJKTZcR[,5dm )-$("&;D/  /	
  8 4 0 6 - Q 0 ? I X P  *!" b#( &)* "+,  -. 9/0 
71 8 
 2;:C6?2;8A/8S\2;AJKTZcR[,5dm )-$("&;D1  /	
  8 4 0 6 - Q 0 ? I X P  *!" b#$ .%* &+, "-.  /0 912 
83 B 2;:C6?2;8A/8S\2;AJKTZcR[,5dm7; )-$("&;D1@l @l /	@l
  8@l 4@l 0@l 6@l -@l Q@l 0@l ?@l I@l X@l P@l  *!@l" b#@l$ 5%@l* &+@l, "-@l.  /@l0 91@l2 
h3@l @lrF   c                     \ rS rSr\SS j5       r\SS j5       r\SS j5       r\S S j5       r\	\	\	SSS\	S.               S!S 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	.           S$S jjr\\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                         S%S jj5       r\\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                         S&S jj5       r\\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                         S'S jj5       r\" S/SS/5      \	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                         S(S jj5       r\	\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                         S)S jjr\\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                       S*S jj5       r\\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSS\	S.                                         S+S jj5       r\	\	\	\	\	\	\	\	\	\	\	\	\	\	SSSS\	S.                                         S,S jjrSrg)-r;   i  c                ,    [        U R                  5      $ r?   )r   r@   rA   s    rC   rD   AsyncThreads.runs  s    &&rF   c                ,    [        U R                  5      $ r?   )r   r@   rA   s    rC   rH   AsyncThreads.messages  s    T\\**rF   c                    [        U 5      $ rK   )AsyncThreadsWithRawResponserA   s    rC   rM   AsyncThreads.with_raw_response  s     +400rF   c                    [        U 5      $ rP   )!AsyncThreadsWithStreamingResponserA   s    rC   rR   $AsyncThreads.with_streaming_response  s     166rF   NrT   c                  #    SS0U=(       d    0 EnU R                  S[        UUUS.[        R                  5      I Sh  vN [	        XEXgS9[
        S9I Sh  vN $  N N7f)r\   r]   r^   r_   r`   Nra   rb   )rf   r   r(   rg   r+   r2   rh   s           rC   ri   AsyncThreads.create  s     P 'QM<ORQZZ, ( (&4
 %77  )+Q[    
 
 	

s"   =A A
 A AA A ra   c          
        #    U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU 3[        X#XES9[        S9I Sh  vN $  N7f)rl   rm   r]   r^   rn   ra   ro   Nrp   rs   s         rC   ru   AsyncThreads.retrieve  sp     . WXaWdeff&QM<ORQYY	{#(+Q[   
 
 	
 
   A	AAArw   c                  #    U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU 3[        UUS.[        R                  5      I Sh  vN [        XEXgS9[        S9I Sh  vN $  N N7f)	ry   rm   r]   r^   rn   rz   Nra   rb   )rq   rf   r   r)   r{   r+   r2   r|   s           rC   r}   AsyncThreads.update  s     J WXaWdeff&QM<ORQZZ	{#, (&4 %77  )+Q[    
 
 	

s$   AA8A4
A8/A60A86A8c          
        #    U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU 3[        X#XES9[        S9I Sh  vN $  N7f)r   rm   r]   r^   rn   ra   ro   Nr   rs   s         rC   r   AsyncThreads.delete?  sp     . WXaWdeff&QM<ORQ\\	{#(+Q[ " " 
 
 	
 
r   r   r   r   c                  #    g7fr   r   r   s                        rC   r   AsyncThreads.create_and_runa       F 	   r   c                  #    g7fr   r   r   s                        rC   r   r     r   r   c                  #    g7fr   r   r   s                        rC   r   r   k  r   r   c               z  #    SS0U=(       d    0 EnU R                  S[        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_U	(       a  [        R                  O[        R                  5      I S h  vN [        UUUUS9[        U	=(       d    S[        [           S9I S h  vN $  N4 N7fr   )	rf   r   r*   r   r   r+   r3   r'   r7   r   s                        rC   r   r     sX    6 'QM<ORQZZ,"L"L ,-B ():	
  U *+> & f "; f "; %n U U  *+>!&  -NN1VV+ . )+Q[el ?U"#78=   
 
 	

s$   B B;B7
/B;2B93B;9B;r   c                  #    U R                  UUUUUUUUU	SU
UUUUUUUUUS9I Sh  vN nU R                  R                  UR                  UR                  UUUUU5      I Sh  vN $  NA N7f)r   Fr   Nr   r   s                         rC   r    AsyncThreads.create_and_run_poll-  s     > ''%%"7/ 3+#)# 3'#!) ( 
 
, YY^^FFCMM=+z7Td
 
 	
-
,
s!   &A.A*<A.%A,&A.,A.c                   gr   r   r   s                       rC   r   "AsyncThreads.create_and_run_streamf  r   rF   c                   gr   r   r   s                        rC   r   r    r   rF   r   c               V   SSU(       a  SOSS.U=(       d    0 EnU R                  S[        0 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   )
rf   r   r*   r   r+   r3   r'   r7   r1   r/   )rB   r   r   r   r   rU   r   r   r   r   r   r   rV   r   r   r   r   rW   rX   rY   rZ   requests                         rC   r   r    sU   > +)H:GW
 "	
 ** "L"L ,-B ():	
  U *+> & "; "; d f U %n *+>  U!$ -EE'* )+Q[el "#789  
< +7-BoSmSopprF   r   )r   r   )r   r   )r   r   )r   r   r   r   r   r   r   )*r   r   r   r   r   r   r   r   r   r   rU   r   r   r   r   r   r   r   r   r   r   r   r   r   rV   r   r   r   r   r   r   r   rW   r   rX   r   rY   r   rZ   r   r   z!AsyncStream[AssistantStreamEvent])*r   r   r   r   r   r   r   r   r   r   rU   r   r   r   r   r   r   r   r   r   r   r   r   r   rV   r   r   r   r   r   r   r   rW   r   rX   r   rY   r   rZ   r   r   'Run | AsyncStream[AssistantStreamEvent])*r   r   r   r   r   r   r   r   rU   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rV   r   r   r   r   r   r   r   rW   r   rX   r   rY   r   rZ   r   r   r	  r   )(r   r   r   r   r   r   r   r   rU   r   r   r   r   r   r   r   r   r   r   r   r   r   rV   r   r   r   r   r   r   r   rW   r   rX   r   rY   r   rZ   r   r   z7AsyncAssistantStreamManager[AsyncAssistantEventHandler])*r   r   r   r   r   r   r   r   rU   r   r   r   r   r   r   r   r   r   r   r   r   r   rV   r   r   r   r   r   r   r   r   r0   rW   r   rX   r   rY   r   rZ   r   r   z8AsyncAssistantStreamManager[AsyncAssistantEventHandlerT])*r   r   r   r   r   r   r   r   rU   r   r   r   r   r   r   r   r   r   r   r   r   r   rV   r   r   r   r   r   r   r   r   z"AsyncAssistantEventHandlerT | NonerW   r   rX   r   rY   r   rZ   r   r   zrAsyncAssistantStreamManager[AsyncAssistantEventHandler] | AsyncAssistantStreamManager[AsyncAssistantEventHandlerT]r   r   rF   rC   r;   r;     sh   ' ' + + 1 1 7 7 GP2;R[ )-$("&;D7
 D7
 0	7

 P7
 &7
 "7
  7
 97
 
7
~ )-$("&;D 
 
 & 
 " 
   
 9 
 
 
L 3<R[ )-$("&;D5
5
 0	5

 P5
 &5
 "5
  5
 95
 
5
z )-$("&;D 
 
 & 
 " 
   
 9 
 
 
D 
 2;:C6?2;8A/8S\6?2;AJKTZcR[,5dm )-$("&;D1B B /	B
  8B 4B 0B 6B -B QB 4B 0B ?B IB XB  P!B" *#B$ b%B* &+B, "-B.  /B0 91B2 
3B BH  2;:C6?2;8A/8S\2;AJKTZcR[,5dm )-$("&;D1B B 	B
 /B  8B 4B 0B 6B -B QB 0B ?B IB XB  P!B" *#B$ b%B* &+B, "-B.  /B0 91B2 
+3B BH  2;:C6?2;8A/8S\2;AJKTZcR[,5dm )-$("&;D1B B 	B
 /B  8B 4B 0B 6B -B QB 0B ?B IB XB  P!B" *#B$ b%B* &+B, "-B.  /B0 91B2 
13B BH N#nh%?@
 2;:C6?2;8A/8S\FO2;AJKTZcR[,5dm )-$("&;D1:
 :
 /	:

  8:
 4:
 0:
 6:
 -:
 Q:
 D:
 0:
 ?:
 I:
 X:
  P!:
" *#:
$ b%:
* &+:
, "-:
.  /:
0 91:
2 
13:
 A:
@ 2;:C6?2;8A/8S\2;AJKTZcR[,5dm+4 )-$("&;D17
 7
 /	7

  87
 47
 07
 67
 -7
 Q7
 07
 ?7
 I7
 X7
 P7
  *!7
" b#7
$ )%7
* &+7
, "-7
.  /7
0 917
2 
37
r 
 2;:C6?2;8A/8S\2;AJKTZcR[,5dm )-$("&;D/  /	
  8 4 0 6 - Q 0 ? I X P  *!" b#( &)* "+,  -. 9/0 
A1 8 
 2;:C6?2;8A/8S\2;AJKTZcR[,5dm )-$("&;D1  /	
  8 4 0 6 - Q 0 ? I X P  *!" b#$ 3%* &+, "-.  /0 912 
B3 B 2;:C6?2;8A/8S\2;AJKTZcR[,5dm<@ )-$("&;D1Bq Bq /	Bq
  8Bq 4Bq 0Bq 6Bq -Bq QBq 0Bq ?Bq IBq XBq PBq  *!Bq" b#Bq$ :%Bq* &+Bq, "-Bq.  /Bq0 91Bq4	C5Bq BqrF   c                  F    \ rS rSrSS jr\SS j5       r\S	S j5       rSrg)
rL   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        g r?   )_threadsr   to_raw_response_wrapperri   ru   r}   r   r   rB   threadss     rC   __init__ThreadsWithRawResponse.__init__  s    &>>NN
 )@@
 '>>NN
 '>>NN
 /FF""
rF   c                @    [        U R                  R                  5      $ r?   )r   r  rD   rA   s    rC   rD   ThreadsWithRawResponse.runs  s    "4==#5#566rF   c                @    [        U R                  R                  5      $ r?   )r   r  rH   rA   s    rC   rH   ThreadsWithRawResponse.messages  s    &t}}'='=>>rF   r  ri   r   r   ru   r}   Nr  r:   r   None)r   r   )r   r   	r   r   r   r   r  r!   rD   rH   r   r   rF   rC   rL   rL     s/    
& 7 7 ? ?rF   rL   c                  F    \ rS rSrSS jr\SS j5       r\S	S j5       rSrg)
r   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        g r?   )r  r   async_to_raw_response_wrapperri   ru   r}   r   r   r  s     rC   r  $AsyncThreadsWithRawResponse.__init__  s    &DDNN
 )FF
 'DDNN
 'DDNN
 /LL""
rF   c                @    [        U R                  R                  5      $ r?   )r   r  rD   rA   s    rC   rD    AsyncThreadsWithRawResponse.runs  s    '(:(:;;rF   c                @    [        U R                  R                  5      $ r?   )r   r  rH   rA   s    rC   rH   $AsyncThreadsWithRawResponse.messages  s    +DMM,B,BCCrF   r  Nr  r;   r   r  )r   r   )r   r   r  r   rF   rC   r   r     s1    
& < < D DrF   r   c                  F    \ rS rSrSS jr\SS j5       r\S	S j5       rSrg)
rQ   i   c                   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        g r?   )r  r$   ri   ru   r}   r   r   r  s     rC   r  %ThreadsWithStreamingResponse.__init__!  ss    2NN
 5
 3NN
 3NN
 ;""
rF   c                @    [        U R                  R                  5      $ r?   )r   r  rD   rA   s    rC   rD   !ThreadsWithStreamingResponse.runs4  s    (););<<rF   c                @    [        U R                  R                  5      $ r?   )r   r  rH   rA   s    rC   rH   %ThreadsWithStreamingResponse.messages8  s    ,T]]-C-CDDrF   r  Nr  )r   r   )r   r   r  r   rF   rC   rQ   rQ      s1    
& = = E ErF   rQ   c                  F    \ rS rSrSS jr\SS j5       r\S	S j5       rSrg)
r   i=  c                   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        g r?   )r  r%   ri   ru   r}   r   r   r  s     rC   r  *AsyncThreadsWithStreamingResponse.__init__>  st    8NN
 ;
 9NN
 9NN
 A""
rF   c                @    [        U R                  R                  5      $ r?   )r    r  rD   rA   s    rC   rD   &AsyncThreadsWithStreamingResponse.runsQ  s    -dmm.@.@AArF   c                @    [        U R                  R                  5      $ r?   )r   r  rH   rA   s    rC   rH   *AsyncThreadsWithStreamingResponse.messagesU  s    1$--2H2HIIrF   r  Nr"  )r   r    )r   r   r  r   rF   rC   r   r   =  s3    
& B B J JrF   r   )U
__future__r   typingr   r   r   	functoolsr   typing_extensionsr   r	   httpx r   rH   r   r   r   r   r   r   _typesr   r   r   r   r   _utilsr   r   r   	runs.runsr   r   r   r   r   r    _compatr!   	_resourcer"   r#   	_responser$   r%   
_streamingr&   r'   
types.betar(   r)   r*   _base_clientr+   lib.streamingr,   r-   r.   r/   r0   r1   types.beta.threadr2   types.beta.threads.runr3   types.shared.chat_modelr4   types.beta.thread_deletedr5   types.shared_params.metadatar6   !types.beta.assistant_stream_eventr7   -types.beta.assistant_tool_choice_option_paramr8   1types.beta.assistant_response_format_option_paramr9   __all__r:   r;   rL   r   rQ   r   r   rF   rC   <module>rJ     s    # , ,  /  !  A @ 
  ( ; Z . 
 2  ) * 1 7 5 F \ dn
%Nlo NlbRq# Rqj? ?:D D:E E:J JrF   