§
    ™ŠtjÕl  ã                  óÄ   — d Z ddlmZ ddlZddlmZmZmZ ddlm	Z	m
Z
mZ ddlmZ ddlmZ ddlmZ dd	lmZmZmZmZmZmZmZmZmZmZmZmZmZm Z   G d
„ d¦  «        Z!dS )z5Synchronous client for managing threads in LangGraph.é    )ÚannotationsN)ÚIteratorÚMappingÚSequence)ÚAnyÚLiteralÚoverload)Ú_quote_path_param)ÚSyncHttpClient)ÚSyncThreadStream)Ú
CheckpointÚJsonÚOnConflictBehaviorÚPruneStrategyÚQueryParamTypesÚ	SortOrderÚ
StreamPartÚThreadÚThreadSelectFieldÚThreadSortByÚThreadStateÚThreadStatusÚThreadStreamModeÚThreadUpdateStateResponsec                  ó   — e Zd ZdZdod„Zddddœdpd„Zdddddddddœdqd„Zeddddd œdrd$„¦   «         Zedddd%œdsd'„¦   «         Zedddd%œdtd*„¦   «         Zddddd œdtd+„Zddd,œdud-„Z	ddddd.d/ddddddd0œdvdA„Z
ddddddBœdwdC„Zddd,œdudD„ZdEdddFœdxdL„Z	 	 dyddddMœdzdS„ZddddddTœd{dX„Zd.ddddddYœd|d^„Z	 d}ddd_d`œd~dg„Zdhddddiœddn„ZdS )€ÚSyncThreadsClienta}  Synchronous client for managing threads in LangGraph.

    This class provides methods to create, retrieve, and manage threads,
    which represent conversations or stateful interactions.

    ???+ example "Example"

        ```python
        client = get_sync_client(url="http://localhost:2024")
        thread = client.threads.create(metadata={"user_id": "123"})
        ```
    Úhttpr   ÚreturnÚNonec                ó   — || _         d S ©N)r   )Úselfr   s     úY/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/langgraph_sdk/_sync/threads.pyÚ__init__zSyncThreadsClient.__init__,   s   € ØˆŒ	ˆ	ˆ	ó    N)ÚincludeÚheadersÚparamsÚ	thread_idÚstrr&   úSequence[str] | Noner'   úMapping[str, str] | Noner(   úQueryParamTypes | Noner   c               óÆ   — i }|rd                      |¦  «        |d<   |r|                     |¦  «         | j                             dt	          |¦  «        › �||pd¬¦  «        S )a  Get a thread by ID.

        Args:
            thread_id: The ID of the thread to get.
            include: Additional fields to include in the response.
                Supported values: `"ttl"`.
            headers: Optional custom headers to include with the request.
            params: Optional query parameters to include with the request.

        Returns:
            `Thread` object.

        ???+ example "Example Usage"

            ```python
            client = get_sync_client(url="http://localhost:2024")
            thread = client.threads.get(
                thread_id="my_thread_id"
            )
            print(thread)
            ```
            ```shell
            -----------------------------------------------------

            {
                'thread_id': 'my_thread_id',
                'created_at': '2024-07-18T18:35:15.540834+00:00',
                'updated_at': '2024-07-18T18:35:15.540834+00:00',
                'metadata': {'graph_id': 'agent'}
            }
            ```

        ú,r&   ú	/threads/N©r'   r(   )ÚjoinÚupdater   Úgetr
   )r"   r)   r&   r'   r(   Úquery_paramss         r#   r4   zSyncThreadsClient.get/   s€   € ðR (*ˆØð 	8Ø&)§h¢h¨wÑ&7Ô&7ˆL˜Ñ#Øð 	(Ø×Ò Ñ'Ô'Ð'ØŒy�}Š}Ø6Õ)¨)Ñ4Ô4Ð6Ð6ØØÐ' 4ð ñ 
ô 
ð 	
r%   )Úmetadatar)   Ú	if_existsÚ
superstepsÚgraph_idÚttlr'   r(   r6   r   ú
str | Noner7   úOnConflictBehavior | Noner8   ú4Sequence[dict[str, Sequence[dict[str, Any]]]] | Noner9   r:   úint | Mapping[str, Any] | Nonec               ó  — i }	|r||	d<   |s|ri |pi ¥|rd|ini ¥|	d<   |r||	d<   |rd„ |D ¦   «         |	d<   |�*t          |t          t          f¦  «        r	|dd	œ|	d
<   n||	d
<   | j                             d|	||¬¦  «        S )aR  Create a new thread.

        Args:
            metadata: Metadata to add to thread.
            thread_id: ID of thread.
                If `None`, ID will be a randomly generated UUID.
            if_exists: How to handle duplicate creation. Defaults to 'raise' under the hood.
                Must be either 'raise' (raise error if duplicate), or 'do_nothing' (return existing thread).
            supersteps: Apply a list of supersteps when creating a thread, each containing a sequence of updates.
                Each update has `values` or `command` and `as_node`. Used for copying a thread between deployments.
            graph_id: Optional graph ID to associate with the thread.
            ttl: Optional time-to-live in minutes for the thread. You can pass an
                integer (minutes) or a mapping with keys `ttl` and optional
                `strategy` (defaults to "delete").
            headers: Optional custom headers to include with the request.

        Returns:
            The created `Thread`.

        ???+ example "Example Usage"

            ```python
            client = get_sync_client(url="http://localhost:2024")
            thread = client.threads.create(
                metadata={"number":1},
                thread_id="my-thread-id",
                if_exists="raise"
            )
            ```
            )
        r)   r9   r6   r7   c                ó6   — g | ]}d d„ |d          D ¦   «         i‘ŒS )Úupdatesc                óX   — g | ]'}|d          |                      d¦  «        |d         dœ‘Œ(S )ÚvaluesÚcommandÚas_node)rC   rD   rE   )r4   )Ú.0Úus     r#   ú
<listcomp>z7SyncThreadsClient.create.<locals>.<listcomp>.<listcomp>›   sN   € ð  ð  ð  ð ð	 '(¨¤kØ'(§u¢u¨YÑ'7Ô'7Ø'(¨¤|ðð ð ð  ð  r%   © )rF   Úss     r#   rH   z,SyncThreadsClient.create.<locals>.<listcomp>™   sQ   € ð %ð %ð %ð ð ð  ð  ð "# 9¤ð ñ  ô  ð	ð%ð %ð %r%   r8   NÚdelete©r:   Ústrategyr:   z/threads©Újsonr'   r(   )Ú
isinstanceÚintÚfloatr   Úpost)
r"   r6   r)   r7   r8   r9   r:   r'   r(   Úpayloads
             r#   ÚcreatezSyncThreadsClient.createc   sñ   € ðV #%ˆØð 	-Ø#,ˆG�KÑ Øð 	�xð 	ð#Ø�>˜rð#à-5Ð=�J Ð)Ð)¸2ð#ˆG�JÑð ð 	-Ø#,ˆG�KÑ Øð 	ð%ð %ð $ð%ñ %ô %ˆG�LÑ!ð ˆ?Ý˜#¥¥U˜|Ñ,Ô,ð %Ø),¸(Ð!CÐ!C�˜‘�à!$�˜‘àŒy�~Š~˜j¨wÀÐPVˆ~ÑWÔWÐWr%   F)r:   Úreturn_minimalr'   r(   úMapping[str, Any]rV   úLiteral[False]c               ó   — d S r!   rI   ©r"   r)   r6   r:   rV   r'   r(   s          r#   r3   zSyncThreadsClient.update®   s	   € ð �r%   )r:   r'   r(   úLiteral[True]c               ó   — d S r!   rI   rZ   s          r#   r3   zSyncThreadsClient.updateº   s	   € ð ˆsr%   ÚboolúThread | Nonec               ó   — d S r!   rI   rZ   s          r#   r3   zSyncThreadsClient.updateÆ   s	   € ð ˜r%   c               óò   — d|i}|�*t          |t          t          f¦  «        r	|ddœ|d<   n||d<   t          |pi ¦  «        }|rd|d<   | j                             dt          |¦  «        › �||pd|¬	¦  «        S )
aà  Update a thread.

        Args:
            thread_id: ID of thread to update.
            metadata: Metadata to merge with existing thread metadata.
            ttl: Optional time-to-live in minutes for the thread. You can pass an
                integer (minutes) or a mapping with keys `ttl` and optional
                `strategy` (defaults to "delete").
            return_minimal: If `True`, request a 204 response with no body.
            headers: Optional custom headers to include with the request.
            params: Optional query parameters to include with the request.

        Returns:
            The updated `Thread`, or `None` when `return_minimal=True`.

        ???+ example "Example Usage"

            ```python
            client = get_sync_client(url="http://localhost:2024")
            thread = client.threads.update(
                thread_id="my-thread-id",
                metadata={"number":1},
                ttl=43_200,
            )
            ```
        r6   NrK   rL   r:   zreturn=minimalÚPreferr0   rN   )rP   rQ   rR   Údictr   Úpatchr
   )	r"   r)   r6   r:   rV   r'   r(   rT   Úrequest_headerss	            r#   r3   zSyncThreadsClient.updateÒ   s¨   € ðH $.¨xÐ"8ˆØˆ?Ý˜#¥¥U˜|Ñ,Ô,ð %Ø),¸(Ð!CÐ!C�˜‘�à!$�˜‘Ý˜w˜}¨"Ñ-Ô-ˆØð 	9Ø(8ˆO˜HÑ%ØŒy�ŠØ6Õ)¨)Ñ4Ô4Ð6Ð6ØØ#Ð+ tØð	 ñ 
ô 
ð 	
r%   r1   c               ó`   — | j                              dt          |¦  «        › �||¬¦  «         dS )aÁ  Delete a thread.

        Args:
            thread_id: The ID of the thread to delete.
            headers: Optional custom headers to include with the request.
            params: Optional query parameters to include with the request.

        Returns:
            `None`

        ???+ example "Example Usage"

            ```python
            client.threads.delete(
                thread_id="my_thread_id"
            )
            ```

        r0   r1   N)r   rK   r
   ©r"   r)   r'   r(   s       r#   rK   zSyncThreadsClient.delete  sF   € ð4 	Œ	×ÒØ6Õ)¨)Ñ4Ô4Ð6Ð6ÀÐPVð 	ñ 	
ô 	
ð 	
ð 	
ð 	
r%   é
   r   )r6   rC   ÚidsÚstatusÚlimitÚoffsetÚsort_byÚ
sort_orderÚselectÚextractr'   r(   rC   rh   ri   úThreadStatus | Nonerj   rQ   rk   rl   úThreadSortBy | Nonerm   úSortOrder | Nonern   úlist[ThreadSelectField] | Nonero   údict[str, str] | Noneúlist[Thread]c               ó¸   — ||dœ}|r||d<   |r||d<   |r||d<   |r||d<   |r||d<   |r||d<   |	r|	|d<   |
r|
|d	<   | j                              d
|||¬¦  «        S )aù  Search for threads.

        Args:
            metadata: Thread metadata to filter on.
            values: State values to filter on.
            ids: List of thread IDs to filter by.
            status: Thread status to filter on.
                Must be one of 'idle', 'busy', 'interrupted' or 'error'.
            limit: Limit on number of threads to return.
            offset: Offset in threads table to start search from.
            sort_by: Sort by field.
            sort_order: Sort order.
            select: List of fields to include in the response.
            extract: Dictionary mapping aliases to JSONB paths to extract
                from thread data. Paths use dot notation for nested keys and
                bracket notation for array indices (e.g.,
                `{"last_msg": "values.messages[-1]"}`). Extracted values are
                returned in an `extracted` field on each thread. Maximum 10
                paths per request.
            headers: Optional custom headers to include with the request.
            params: Optional query parameters to include with the request.

        Returns:
            List of the threads matching the search parameters.

        ???+ example "Example Usage"

            ```python
            client = get_sync_client(url="http://localhost:2024")
            threads = client.threads.search(
                metadata={"number":1},
                status="interrupted",
                limit=15,
                offset=5
            )
            ```
        )rj   rk   r6   rC   rh   ri   rl   rm   rn   ro   z/threads/searchrN   ©r   rS   )r"   r6   rC   rh   ri   rj   rk   rl   rm   rn   ro   r'   r(   rT   s                 r#   ÚsearchzSyncThreadsClient.search$  sÎ   € ðl Øð#
ð #
ˆð ð 	+Ø"*ˆG�JÑØð 	'Ø &ˆG�HÑØð 	!Ø ˆG�E‰NØð 	'Ø &ˆG�HÑØð 	)Ø!(ˆG�IÑØð 	/Ø$.ˆG�LÑ!Øð 	'Ø &ˆG�HÑØð 	)Ø!(ˆG�IÑØŒy�~Š~Ø G°WÀVð ñ 
ô 
ð 	
r%   )r6   rC   ri   r'   r(   c               ól   — i }|r||d<   |r||d<   |r||d<   | j                              d|||¬¦  «        S )a«  Count threads matching filters.

        Args:
            metadata: Thread metadata to filter on.
            values: State values to filter on.
            status: Thread status to filter on.
            headers: Optional custom headers to include with the request.
            params: Optional query parameters to include with the request.

        Returns:
            int: Number of threads matching the criteria.
        r6   rC   ri   z/threads/countrN   rw   )r"   r6   rC   ri   r'   r(   rT   s          r#   ÚcountzSyncThreadsClient.countq  se   € ð* #%ˆØð 	+Ø"*ˆG�JÑØð 	'Ø &ˆG�HÑØð 	'Ø &ˆG�HÑØŒy�~Š~Ø 7°GÀFð ñ 
ô 
ð 	
r%   c               ó`   — | j                              dt          |¦  «        › d�d||¬¦  «        S )aý  Copy a thread.

        Args:
            thread_id: The ID of the thread to copy.
            headers: Optional custom headers to include with the request.
            params: Optional query parameters to include with the request.

        Returns:
            `None`

        ???+ example "Example Usage"

            ```python
            client = get_sync_client(url="http://localhost:2024")
            client.threads.copy(
                thread_id="my_thread_id"
            )
            ```

        r0   z/copyNrN   ©r   rS   r
   rf   s       r#   ÚcopyzSyncThreadsClient.copy‘  sA   € ð6 Œy�~Š~Ø;Õ)¨)Ñ4Ô4Ð;Ð;Ð;ØØØð	 ñ 
ô 
ð 	
r%   rK   )rM   r'   r(   Ú
thread_idsúSequence[str]rM   r   údict[str, Any]c               ó\   — d|i}|dk    r||d<   | j                              d|||¬¦  «        S )aX  Prune threads by ID.

        Args:
            thread_ids: List of thread IDs to prune.
            strategy: The prune strategy. `"delete"` removes threads entirely.
                `"keep_latest"` prunes old checkpoints but keeps threads and their
                latest state. Defaults to `"delete"`.
            headers: Optional custom headers to include with the request.
            params: Optional query parameters to include with the request.

        Returns:
            A dict containing `pruned_count` (number of threads pruned).

        ???+ example "Example Usage"

            ```python
            client = get_sync_client(url="http://localhost:2024")
            result = client.threads.prune(
                thread_ids=["thread_1", "thread_2"],
            )
            print(result)  # {'pruned_count': 2}
            ```

        r~   rK   rM   z/threads/prunerN   rw   )r"   r~   rM   r'   r(   rT   s         r#   ÚprunezSyncThreadsClient.prune³  sN   € ðB ˜*ð#
ˆð �xÒÐØ"*ˆG�JÑØŒy�~Š~Ø 7°GÀFð ñ 
ô 
ð 	
r%   )Ú	subgraphsr'   r(   Ú
checkpointúCheckpoint | NoneÚcheckpoint_idrƒ   r   c               ó¨  — |r2| j                              dt          |¦  «        › d�||dœ||¬¦  «        S |rVd|i}|ri |¥t          |¦  «        ¥}| j                              dt          |¦  «        › dt          |¦  «        › �||¬¦  «        S d|i}|ri |¥t          |¦  «        ¥}| j                              dt          |¦  «        › d�||¬¦  «        S )	ab  Get the state of a thread.

        Args:
            thread_id: The ID of the thread to get the state of.
            checkpoint: The checkpoint to get the state of.
            subgraphs: Include subgraphs states.
            headers: Optional custom headers to include with the request.

        Returns:
            The thread of the state.

        ???+ example "Example Usage"

            ```python
            client = get_sync_client(url="http://localhost:2024")
            thread_state = client.threads.get_state(
                thread_id="my_thread_id",
                checkpoint_id="my_checkpoint_id"
            )
            print(thread_state)
            ```

            ```shell
            ----------------------------------------------------------------------------------------------------------------------------------------------------------------------

            {
                'values': {
                    'messages': [
                        {
                            'content': 'how are you?',
                            'additional_kwargs': {},
                            'response_metadata': {},
                            'type': 'human',
                            'name': None,
                            'id': 'fe0a5778-cfe9-42ee-b807-0adaa1873c10',
                            'example': False
                        },
                        {
                            'content': "I'm doing well, thanks for asking! I'm an AI assistant created by Anthropic to be helpful, honest, and harmless.",
                            'additional_kwargs': {},
                            'response_metadata': {},
                            'type': 'ai',
                            'name': None,
                            'id': 'run-159b782c-b679-4830-83c6-cef87798fe8b',
                            'example': False,
                            'tool_calls': [],
                            'invalid_tool_calls': [],
                            'usage_metadata': None
                        }
                    ]
                },
                'next': [],
                'checkpoint':
                    {
                        'thread_id': 'e2496803-ecd5-4e0c-a779-3226296181c2',
                        'checkpoint_ns': '',
                        'checkpoint_id': '1ef4a9b8-e6fb-67b1-8001-abd5184439d1'
                    }
                'metadata':
                    {
                        'step': 1,
                        'run_id': '1ef4a9b8-d7da-679a-a45a-872054341df2',
                        'source': 'loop',
                        'writes':
                            {
                                'agent':
                                    {
                                        'messages': [
                                            {
                                                'id': 'run-159b782c-b679-4830-83c6-cef87798fe8b',
                                                'name': None,
                                                'type': 'ai',
                                                'content': "I'm doing well, thanks for asking! I'm an AI assistant created by Anthropic to be helpful, honest, and harmless.",
                                                'example': False,
                                                'tool_calls': [],
                                                'usage_metadata': None,
                                                'additional_kwargs': {},
                                                'response_metadata': {},
                                                'invalid_tool_calls': []
                                            }
                                        ]
                                    }
                            },
                'user_id': None,
                'graph_id': 'agent',
                'thread_id': 'e2496803-ecd5-4e0c-a779-3226296181c2',
                'created_by': 'system',
                'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca'},
                'created_at': '2024-07-25T15:35:44.184703+00:00',
                'parent_config':
                    {
                        'thread_id': 'e2496803-ecd5-4e0c-a779-3226296181c2',
                        'checkpoint_ns': '',
                        'checkpoint_id': '1ef4a9b8-d80d-6fa7-8000-9300467fad0f'
                    }
            }
            ```

        r0   z/state/checkpoint)r„   rƒ   rN   rƒ   z/state/)r(   r'   ú/state)r   rS   r
   rb   r4   )r"   r)   r„   r†   rƒ   r'   r(   Ú
get_paramss           r#   Ú	get_statezSyncThreadsClient.get_stateÜ  s/  € ðZ ð 	Ø”9—>’>ØKÕ-¨iÑ8Ô8ÐKÐKÐKØ$.¸YÐGÐGØØð	 "ñ ô ð ð ð 	Ø% yÐ1ˆJØð <Ø; 
Ð;­d°6©l¬lÐ;�
Ø”9—=’=ØcÕ-¨iÑ8Ô8ÐcÐcÕARÐS`ÑAaÔAaÐcÐcØ!Øð !ñ ô ð ð & yÐ1ˆJØð <Ø; 
Ð;­d°6©l¬lÐ;�
Ø”9—=’=Ø@Õ-¨iÑ8Ô8Ð@Ð@Ð@Ø!Øð !ñ ô ð r%   )rE   r„   r†   r'   r(   ú&dict[str, Any] | Sequence[dict] | NonerE   r   c               ó’   — d|i}|r||d<   |r||d<   |r||d<   | j                              dt          |¦  «        › d�|||¬¦  «        S )a÷  Update the state of a thread.

        Args:
            thread_id: The ID of the thread to update.
            values: The values to update the state with.
            as_node: Update the state as if this node had just executed.
            checkpoint: The checkpoint to update the state of.
            headers: Optional custom headers to include with the request.

        Returns:
            Response after updating a thread's state.

        ???+ example "Example Usage"

            ```python

            response = await client.threads.update_state(
                thread_id="my_thread_id",
                values={"messages":[{"role": "user", "content": "hello!"}]},
                as_node="my_node",
            )
            print(response)

            ----------------------------------------------------------------------------------------------------------------------------------------------------------------------

            {
                'checkpoint': {
                    'thread_id': 'e2496803-ecd5-4e0c-a779-3226296181c2',
                    'checkpoint_ns': '',
                    'checkpoint_id': '1ef4a9b8-e6fb-67b1-8001-abd5184439d1',
                    'checkpoint_map': {}
                }
            }
            ```

        rC   r†   r„   rE   r0   rˆ   rN   r|   )	r"   r)   rC   rE   r„   r†   r'   r(   rT   s	            r#   Úupdate_statezSyncThreadsClient.update_statec  s†   € ð` �fð#
ˆð ð 	5Ø'4ˆG�OÑ$Øð 	/Ø$.ˆG�LÑ!Øð 	)Ø!(ˆG�IÑØŒy�~Š~Ø<Õ)¨)Ñ4Ô4Ð<Ð<Ð<ØØØð	 ñ 
ô 
ð 	
r%   )rj   Úbeforer6   r„   r'   r(   rŽ   ústr | Checkpoint | NoneúMapping[str, Any] | Noneúlist[ThreadState]c               ó’   — d|i}|r||d<   |r||d<   |r||d<   | j                              dt          |¦  «        › d�|||¬¦  «        S )aC  Get the state history of a thread.

        Args:
            thread_id: The ID of the thread to get the state history for.
            checkpoint: Return states for this subgraph. If empty defaults to root.
            limit: The maximum number of states to return.
            before: Return states before this checkpoint.
            metadata: Filter states by metadata key-value pairs.
            headers: Optional custom headers to include with the request.

        Returns:
            The state history of the `Thread`.

        ???+ example "Example Usage"

            ```python

            thread_state = client.threads.get_history(
                thread_id="my_thread_id",
                limit=5,
                before="my_timestamp",
                metadata={"name":"my_name"}
            )
            ```

        rj   rŽ   r6   r„   r0   z/historyrN   r|   )	r"   r)   rj   rŽ   r6   r„   r'   r(   rT   s	            r#   Úget_historyzSyncThreadsClient.get_history¢  s†   € ðL �Uð#
ˆð ð 	'Ø &ˆG�HÑØð 	+Ø"*ˆG�JÑØð 	/Ø$.ˆG�LÑ!ØŒy�~Š~Ø>Õ)¨)Ñ4Ô4Ð>Ð>Ð>ØØØð	 ñ 
ô 
ð 	
r%   Ússe)r'   Úrun_start_timeoutÚ	transportÚassistant_idr•   úfloat | Noner–   úLiteral['sse', 'websocket']r   c          	     ó¦   — |dvrt          d¦  «        ‚t          | j        |�|nt          t	          j        ¦   «         ¦  «        ||||du|¬¦  «        S )a  Open a v3 thread-centric streaming session.

        Args:
            thread_id: optional explicit thread identifier. Defaults to a
                fresh UUIDv4.
            assistant_id: assistant the run will use. Required.
            headers: optional headers forwarded on every command and SSE
                request for this stream session.
            transport: event transport to use, `"sse"` (default) or
                `"websocket"`.

        Returns:
            A `SyncThreadStream` to use as a context manager.
        )r”   Ú	websocketz'transport must be 'sse' or 'websocket'.N)r   r)   r—   r'   r•   Úexplicit_thread_idÚtransport_kind)Ú
ValueErrorr   r   r*   ÚuuidÚuuid4)r"   r)   r—   r'   r•   r–   s         r#   ÚstreamzSyncThreadsClient.stream×  si   € ð. Ð0Ð0Ð0ÝÐFÑGÔGÐGÝØ”Ø#,Ð#8�i�i½cÅ$Ä*Á,Ä,Ñ>OÔ>OØ%ØØ/Ø(°Ð4Ø$ð
ñ 
ô 
ð 	
r%   Ú	run_modes)Ústream_modeÚlast_event_idr'   r(   r£   ú-ThreadStreamMode | Sequence[ThreadStreamMode]r¤   úIterator[StreamPart]c               ó®   — d|i}|r|                      |¦  «         | j                             dt          |¦  «        › d�di |rd|ini ¥|pi ¥|¬¦  «        S )a»  Get a stream of events for a thread.

        Args:
            thread_id: The ID of the thread to get the stream for.
            last_event_id: The ID of the last event to get.
            headers: Optional custom headers to include with the request.
            params: Optional query parameters to include with the request.

        Returns:
            An iterator of stream parts.

        ???+ example "Example Usage"

            ```python

            for chunk in client.threads.join_stream(
                thread_id="my_thread_id",
                last_event_id="my_event_id",
                stream_mode="run_modes",
            ):
                print(chunk)
            ```

        r£   r0   z/streamÚGETzLast-Event-IDr1   )r3   r   r¡   r
   )r"   r)   r£   r¤   r'   r(   r5   s          r#   Újoin_streamzSyncThreadsClient.join_streamú  s•   € ðD ˜;ð
ˆð ð 	(Ø×Ò Ñ'Ô'Ð'ØŒy×ÒØ=Õ)¨)Ñ4Ô4Ð=Ð=Ð=ØðØ7DÐL�O ]Ð3Ð3È"ðà�=˜bðð  ð  ñ 
ô 
ð 	
r%   )r   r   r   r   )
r)   r*   r&   r+   r'   r,   r(   r-   r   r   )r6   r   r)   r;   r7   r<   r8   r=   r9   r;   r:   r>   r'   r,   r(   r-   r   r   )r)   r*   r6   rW   r:   r>   rV   rX   r'   r,   r(   r-   r   r   )r)   r*   r6   rW   r:   r>   rV   r[   r'   r,   r(   r-   r   r   )r)   r*   r6   rW   r:   r>   rV   r]   r'   r,   r(   r-   r   r^   )r)   r*   r'   r,   r(   r-   r   r   )r6   r   rC   r   rh   r+   ri   rp   rj   rQ   rk   rQ   rl   rq   rm   rr   rn   rs   ro   rt   r'   r,   r(   r-   r   ru   )r6   r   rC   r   ri   rp   r'   r,   r(   r-   r   rQ   )
r~   r   rM   r   r'   r,   r(   r-   r   r€   )NN)r)   r*   r„   r…   r†   r;   rƒ   r]   r'   r,   r(   r-   r   r   )r)   r*   rC   r‹   rE   r;   r„   r…   r†   r;   r'   r,   r(   r-   r   r   )r)   r*   rj   rQ   rŽ   r�   r6   r�   r„   r…   r'   r,   r(   r-   r   r‘   r!   )r)   r;   r—   r*   r'   r,   r•   r˜   r–   r™   r   r   )r)   r*   r£   r¥   r¤   r;   r'   r,   r(   r-   r   r¦   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r$   r4   rU   r	   r3   rK   rx   rz   r}   r‚   rŠ   r�   r“   r¡   r©   rI   r%   r#   r   r      sf  € € € € € ðð ðð ð ð ð )-Ø,0Ø)-ð2
ð 2
ð 2
ð 2
ð 2
ð 2
ðn Ø $Ø/3ØKOØ#Ø.2Ø,0Ø)-ðIXð IXð IXð IXð IXð IXðV ð /3Ø).Ø,0Ø)-ð	ð 	ð 	ð 	ð 	ñ „Xð	ð ð /3à,0Ø)-ð	ð 	ð 	ð 	ð 	ñ „Xð	ð ð /3à,0Ø)-ð	ð 	ð 	ð 	ð 	ñ „Xð	ð  /3Ø$Ø,0Ø)-ð2
ð 2
ð 2
ð 2
ð 2
ð 2
ðp -1Ø)-ð
ð 
ð 
ð 
ð 
ð 
ðB ØØ$(Ø&*ØØØ'+Ø'+Ø15Ø)-Ø,0Ø)-ðK
ð K
ð K
ð K
ð K
ð K
ð` ØØ&*Ø,0Ø)-ð
ð 
ð 
ð 
ð 
ð 
ðH -1Ø)-ð 
ð  
ð  
ð  
ð  
ð  
ðL #+Ø,0Ø)-ð'
ð '
ð '
ð '
ð '
ð '
ðX )-Ø$(ð	Eð  Ø,0Ø)-ðEð Eð Eð Eð Eð EðX #Ø(,Ø$(Ø,0Ø)-ð=
ð =
ð =
ð =
ð =
ð =
ðF Ø*.Ø-1Ø(,Ø,0Ø)-ð3
ð 3
ð 3
ð 3
ð 3
ð 3
ðn !%ð!
ð
 -1Ø*.Ø16ð!
ð !
ð !
ð !
ð !
ð !
ðN FQØ$(Ø,0Ø)-ð.
ð .
ð .
ð .
ð .
ð .
ð .
ð .
r%   r   )"r­   Ú
__future__r   rŸ   Úcollections.abcr   r   r   Útypingr   r   r	   Úlanggraph_sdk._shared.utilitiesr
   Úlanggraph_sdk._sync.httpr   Úlanggraph_sdk._sync.streamr   Úlanggraph_sdk.schemar   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rI   r%   r#   ú<module>rµ      st  ðØ ;Ð ;à "Ð "Ð "Ð "Ð "Ð "à €€€Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )à =Ð =Ð =Ð =Ð =Ð =Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð$J
ð J
ð J
ð J
ð J
ñ J
ô J
ð J
ð J
ð J
r%   