§
    šŠtj¦½  ã                  ó&  — d dl mZ d dlZd dlmZmZmZ d dlmZ d dl	m
Z
mZmZmZ d dlmZ d dlZd dlmZ d dl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! d dl"m#Z#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. d dl/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7 d dl8m9Z9m:Z: d dl;m<Z<m=Z= d dl>m?Z?m@Z@ d dlAmBZBm'Z'mCZCmDZDmEZEmFZFm)Z)mGZG  ejH        eI¦  «        ZJdZK eLe2e1e3e5f¦  «        ZM eLddh¦  «        ZNd$d„ZO G d„ deP¦  «        ZQ G d „ d!e?¦  «        ZRd%d#„ZSdS )&é    )ÚannotationsN)ÚAsyncIteratorÚIteratorÚSequence)Úasdict)ÚAnyÚLiteralÚcastÚoverload)ÚUUID)ÚRunnableConfig)ÚEdge)ÚGraph)ÚNode)ÚCheckpointMetadata)ÚLangGraphClientÚSyncLangGraphClientÚ
get_clientÚget_sync_client)Ú
CheckpointÚContextÚQueryParamTypesÚThreadState)ÚCommand)Ú
StreamMode)ÚSelf)Úmerge_configs)ÚCONFÚCONFIG_KEY_CHECKPOINT_IDÚCONFIG_KEY_CHECKPOINT_MAPÚCONFIG_KEY_CHECKPOINT_NSÚCONFIG_KEY_STREAMÚCONFIG_KEY_TASK_IDÚ	INTERRUPTÚNS_SEP)ÚGraphInterruptÚParentCommand)Ú_AsyncRemoteGraphRunStreamÚ_RemoteGraphRunStream)ÚPregelProtocolÚStreamProtocol)ÚAllr   ÚGraphOutputÚ	InterruptÚ
PregelTaskÚStateSnapshotr   Ú
StreamPart)ÚRemoteGraphÚRemoteExceptionÚmetadataÚheadersÚvr   Úreturnc                ó¸  — t          | t          t          t          t          t
          f¦  «        r| S t          | t          ¦  «        rIi }|                      ¦   «         D ]0\  }}t          |t          ¦  «        rt          |¦  «        }|�|||<   Œ1|S t          | t          t          f¦  «        r/g }| D ](}t          |¦  «        }|�|                     |¦  «         Œ)|S dS )zJRecursively sanitize a config value to ensure it contains only primitives.N)Ú
isinstanceÚstrÚintÚfloatÚboolr   ÚdictÚitemsÚ_sanitize_config_valueÚlistÚtupleÚappend)r6   Úsanitized_dictÚkÚvalÚsanitized_valueÚsanitized_listÚitemÚsanitized_items           úU/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/langgraph/pregel/remote.pyr@   r@   Z   sé   € å�!•c�3¥¥t­TÐ2Ñ3Ô3ð ØˆÝ	�A•tÑ	Ô	ð ØˆØ—g’g‘i”ið 	8ð 	8‰FˆAˆsÝ˜!�SÑ!Ô!ð 8Ý"8¸Ñ"=Ô"=�Ø"Ð.Ø(7�N 1Ñ%øØÐÝ	�A��e�}Ñ	%Ô	%ð ØˆØð 	6ð 	6ˆDÝ3°DÑ9Ô9ˆNØÐ)Ø×%Ò% nÑ5Ô5Ð5øØÐØˆ4ó    c                  ó   — e Zd ZdZdS )r3   z:Exception raised when an error occurs in the remote graph.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© rL   rK   r3   r3   p   s   € € € € € ØDÐDà€DrL   r3   c                  óx  ‡ — e Zd ZU dZded<   ded<   dddddddddœd„d„Zd…d„Zd†d„Zd‡d#„Zdˆd&„Z	d‰dŠd(„Z
d‹d,„Z	 d‰dddd-œdŒd3„Z	 d‰dddd-œdŒd4„Zd�d8„ZdŽd:„Zd�d>„Zd�d?„Zdddd@œd‘dB„Zdddd@œd‘dC„ZddddddDœd’dK„ZddddddDœd“dM„Zd”dP„Zd”dQ„Z	 d‰dddRœd•dV„Z	 d‰dddRœd•dW„Z	 d–d—d]„Ze	 d‰dddddddd^œd˜dg„¦   «         Ze	 d‰ddddddddhdiœd™dl„¦   «         Z	 d‰ddddddddmdiœdšdo„Ze	 d‰dddddddd^œd›dq„¦   «         Ze	 d‰ddddddddhdiœdœds„¦   «         Z	 d‰ddddddddmdiœd�dt„Z	 d‰duddddddvœdžˆ fdy„Z	 d‰duddddddvœdždz„Ze	 d‰dddddd{œdŸd}„¦   «         Z e	 d‰ddddddhd~œd d„¦   «         Z 	 d‰ddddddmd~œd¡d€„Z e	 d‰dddddd{œdŸd�„¦   «         Z!e	 d‰ddddddhd~œd d‚„¦   «         Z!	 d‰ddddddmd~œd¡dƒ„Z!ˆ xZ"S )¢r2   ak  The `RemoteGraph` class is a client implementation for calling remote
    APIs that implement the LangGraph Server API specification.

    For example, the `RemoteGraph` class can be used to call APIs from deployments
    on LangSmith Deployment.

    `RemoteGraph` behaves the same way as a `Graph` and can be used directly as
    a node in another `Graph`.
    r:   Úassistant_idú
str | NoneÚnameNF)ÚurlÚapi_keyr5   ÚclientÚsync_clientÚconfigrV   Údistributed_tracingrW   rX   r5   údict[str, str] | NonerY   úLangGraphClient | NonerZ   úSyncLangGraphClient | Noner[   úRunnableConfig | Noner\   r=   c              óÆ   — || _         |€|| _        n|| _        || _        |	| _        |€|�t	          |||¬¦  «        }|| _        |€|�t          |||¬¦  «        }|| _        dS )ak  Specify `url`, `api_key`, and/or `headers` to create default sync and async clients.

        If `client` or `sync_client` are provided, they will be used instead of the default clients.
        See `LangGraphClient` and `SyncLangGraphClient` for details on the default clients. At least
        one of `url`, `client`, or `sync_client` must be provided.

        Args:
            assistant_id: The assistant ID or graph name of the remote graph to use.
            url: The URL of the remote API.
            api_key: The API key to use for authentication. If not provided, it will be read from the environment (`LANGGRAPH_API_KEY`, `LANGSMITH_API_KEY`, or `LANGCHAIN_API_KEY`).
            headers: Additional headers to include in the requests.
            client: A `LangGraphClient` instance to use instead of creating a default client.
            sync_client: A `SyncLangGraphClient` instance to use instead of creating a default client.
            config: An optional `RunnableConfig` instance with additional configuration.
            name: Human-readable name to attach to the RemoteGraph instance.
                This is useful for adding `RemoteGraph` as a subgraph via `graph.add_node(remote_graph)`.
                If not provided, defaults to the assistant ID.
            distributed_tracing: Whether to enable sending LangSmith distributed tracing headers.
        N)rW   rX   r5   )rT   rV   r[   r\   r   rY   r   rZ   )
ÚselfrT   rW   rX   r5   rY   rZ   r[   rV   r\   s
             rK   Ú__init__zRemoteGraph.__init__„   s�   € ðB )ˆÔØˆ<Ø$ˆDŒIˆIàˆDŒIØˆŒØ#6ˆÔ àˆ>˜c˜oÝ C°À'ÐJÑJÔJˆFØˆŒàÐ 3 ?Ý)¨c¸7ÈGÐTÑTÔTˆKØ&ˆÔÐÐrL   r7   r   c                ó<   — | j         €t          d¦  «        ‚| j         S )NzbAsync client is not initialized: please provide `url` or `client` when initializing `RemoteGraph`.)rY   Ú
ValueError©rb   s    rK   Ú_validate_clientzRemoteGraph._validate_clientµ   s)   € ØŒ;ÐÝØtñô ð ð Œ{ÐrL   r   c                ó<   — | j         €t          d¦  «        ‚| j         S )NzfSync client is not initialized: please provide `url` or `sync_client` when initializing `RemoteGraph`.)rZ   re   rf   s    rK   Ú_validate_sync_clientz!RemoteGraph._validate_sync_client¼   s+   € ØÔÐ#ÝØxñô ð ð ÔÐrL   Úcontrolr   ÚtransformersÚinterrupt_beforeÚinterrupt_afterÚextra_kwargsúdict[str, Any]ÚNonec               óô   — d|fd|fd|fd|ffD ]\  }}|rt          d|› d�¦  «        ‚Œt          |¦  «        t          z
  }|r5t          dt          |¦  «        ›dt          t          ¦  «        ›d	�¦  «        ‚d
S )zJRaise NotImplementedError for kwargs unsupported by the v3 streaming path.rj   rk   rl   rm   z:RemoteGraph.stream_events(version='v3') does not support `z=`.zORemoteGraph.stream_events(version='v3') does not support the following kwargs: z. Supported: ú.N)ÚNotImplementedErrorÚsetÚ_V3_SUPPORTED_KWARGSÚsorted)	rb   rj   rk   rl   rm   rn   rV   ÚvalueÚunknowns	            rK   Ú_reject_v3_unsupportedz"RemoteGraph._reject_v3_unsupportedÃ   sÜ   € ð ˜Ð Ø˜\Ð*ØÐ!1Ð2Ø Ð0ð	
ð 		ð 		‰KˆD�%ð ð Ý)ØZÐQUÐZÐZÐZñô ð ðõ �lÑ#Ô#Õ&:Ñ:ˆØð 	Ý%ð@Ý)/°©¬ð@ð @å$Õ%9Ñ:Ô:ð@ð @ð @ñô ð ð	ð 	rL   Úupdater   c                óZ   — i | j         ¥|¥} | j        |                     d¦  «        fi |¤ŽS )NrT   )Ú__dict__Ú	__class__Úpop)rb   rz   Úattrss      rK   ÚcopyzRemoteGraph.copyß   s9   € Ø+�4”=Ð+ FÐ+ˆØˆtŒ~˜eŸiši¨Ñ7Ô7ÐAÐA¸5ÐAÐAÐArL   Úkwargsc                ó~   — |                       dt          | j        |t          t          |¦  «        ¦  «        i¦  «        S )Nr[   )r€   r   r[   r
   r   )rb   r[   r�   s      rK   Úwith_configzRemoteGraph.with_configã   s8   € Ø�yŠyØ•} T¤[°&½$½~ÈvÑ:VÔ:VÑWÔWÐXñ
ô 
ð 	
rL   Úgraphúdict[str, list[dict[str, Any]]]údict[str, DrawableNode]c           	     óR  — i }|d         D ]›}t          |d         ¦  «        }|                     di ¦  «        }|                     d¦  «        }|€.t          |t          ¦  «        r|                     d|¦  «        }n|}t	          ||||                     d¦  «        ¬¦  «        ||<   Œœ|S )NÚnodesÚidÚdatarV   r4   )r‰   rV   rŠ   r4   )r:   Úgetr9   r>   ÚDrawableNode)rb   r„   rˆ   ÚnodeÚnode_idÚ	node_dataÚ	node_names          rK   Ú_get_drawable_nodeszRemoteGraph._get_drawable_nodesè   s¼   € ð ˆØ˜'”Nð 	ð 	ˆDÝ˜$˜tœ*‘o”oˆGØŸš ¨Ñ,Ô,ˆIð Ÿš Ñ(Ô(ˆIØÐ Ý˜i­Ñ.Ô.ð (Ø )§¢¨f°gÑ >Ô >�I�Ià '�Iå)ØØØØŸš *Ñ-Ô-ð	ñ ô ˆE�'‰NˆNð ˆrL   )Úxrayr5   Úparamsr’   ú
int | boolr“   úQueryParamTypes | NoneÚDrawableGraphc               óØ   — |                       ¦   «         }|j                             | j        |||¬¦  «        }t	          |                      |¦  «        d„ |d         D ¦   «         ¬¦  «        S )áÅ  Get graph by graph name.

        This method calls `GET /assistants/{assistant_id}/graph`.

        Args:
            config: This parameter is not used.
            xray: Include graph representation of subgraphs. If an integer
                value is provided, only subgraphs with a depth less than or
                equal to the value will be included.

        Returns:
            The graph information for the assistant in JSON format.
        ©rT   r’   r5   r“   c                ó&   — g | ]}t          d i |¤Ž‘ŒS ©rR   ©ÚDrawableEdge©Ú.0Úedges     rK   ú
<listcomp>z)RemoteGraph.get_graph.<locals>.<listcomp>  ó&   € ÐCÐCÐC¨D•<Ð'Ð' $Ð'Ð'ÐCÐCÐCrL   Úedges©rˆ   r£   )ri   Ú
assistantsÚ	get_graphrT   r–   r‘   )rb   r[   r’   r5   r“   rZ   r„   s          rK   r¦   zRemoteGraph.get_graph   s€   € ð* ×0Ò0Ñ2Ô2ˆØÔ&×0Ò0ØÔ*ØØØð	 1ñ 
ô 
ˆõ Ø×*Ò*¨5Ñ1Ô1ØCÐC°E¸'´NÐCÑCÔCð
ñ 
ô 
ð 	
rL   c             ƒ  óè   K  — |                       ¦   «         }|j                             | j        |||¬¦  «        ƒ d{V —†}t	          |                      |¦  «        d„ |d         D ¦   «         ¬¦  «        S )r˜   r™   Nc                ó&   — g | ]}t          d i |¤Ž‘ŒS r›   rœ   rž   s     rK   r¡   z*RemoteGraph.aget_graph.<locals>.<listcomp>?  r¢   rL   r£   r¤   )rg   r¥   r¦   rT   r–   r‘   )rb   r[   r’   r5   r“   rY   r„   s          rK   Ú
aget_graphzRemoteGraph.aget_graph!  s¢   è è € ð* ×&Ò&Ñ(Ô(ˆØÔ'×1Ò1ØÔ*ØØØð	 2ñ 
ô 
ð 
ð 
ð 
ð 
ð 
ð 
ˆõ Ø×*Ò*¨5Ñ1Ô1ØCÐC°E¸'´NÐCÑCÔCð
ñ 
ô 
ð 	
rL   Ústater   r0   c                óô  — g }|d         D ]Ú}t          d„ |d         D ¦   «         ¦  «        }|                     t          |d         |d         t          ¦   «         |d         rt          |d         ¦  «        nd ||d         r|                      |d         ¦  «        n&|d         rt          t          d	|d         i¦  «        nd |                     d
¦  «        ¬¦  «        ¦  «         ŒÛt          |d         |d         rt          |d         ¦  «        nt          ¦   «         d	|d         d         |d         d         |d         d         |d                              di ¦  «        dœit          di |d         ¤Ž|d         |d         rGd	|d         d         |d         d         |d         d         |d                              di ¦  «        dœind t          |¦  «        t          d„ |D ¦   «         ¦  «        ¬¦  «        S )NÚtasksc              3  ó.   K  — | ]}t          di |¤ŽV — Œd S ©NrR   ©r.   )rŸ   Ú	interrupts     rK   ú	<genexpr>z5RemoteGraph._create_state_snapshot.<locals>.<genexpr>E  sA   è è € ð ð Ø+4•	Ð&Ð&˜IÐ&Ð&ðð ð ð ð ð rL   Ú
interruptsr‰   rV   Úerrorrª   Ú
checkpointÚconfigurableÚresult)r‰   rV   Úpathr³   r²   rª   r¶   ÚvaluesÚnextÚ	thread_idÚcheckpoint_nsÚcheckpoint_idÚcheckpoint_map©rº   r»   r¼   r½   r4   Ú
created_atÚparent_checkpointc                ó&   — g | ]}|j         D ]}|‘ŒŒS rR   )r²   )rŸ   ÚtaskÚis      rK   r¡   z6RemoteGraph._create_state_snapshot.<locals>.<listcomp>y  s'   € ÐKÐKÐK D¸4¼?ÐKÐK°a˜aÐKÐKÐKÐKrL   )r¸   r¹   r[   r4   r¿   Úparent_configr¬   r²   rR   )
rB   rC   r/   Ú	ExceptionÚ_create_state_snapshotr
   r   r‹   r0   r   )rb   rª   r¬   rÂ   r²   s        rK   rÆ   z"RemoteGraph._create_state_snapshotB  sZ  € Ø"$ˆØ˜'”Nð 	ð 	ˆDÝð ð Ø8<¸\Ô8Jðñ ô ñ ô ˆJð �LŠLÝØ˜D”zØ˜fœÝ™œØ6:¸7´mÐM�) D¨¤MÑ2Ô2Ð2ÈØ)ð   œ=ð˜×3Ò3°D¸´MÑBÔBÐBð  $ LÔ1ð&�D¥°.À$À|ÔBTÐ1UÑVÔVÐVà!%ð  Ÿ8š8 HÑ-Ô-ðñ ô ñô ð ð õ( Ø˜”?Ø).¨v¬ÐC•�u˜V”}Ñ%Ô%Ð%½E¹G¼GàØ!& |Ô!4°[Ô!AØ%*¨<Ô%8¸Ô%IØ%*¨<Ô%8¸Ô%IØ&+¨LÔ&9×&=Ò&=Ð>NÐPRÑ&SÔ&Sð	!ð !ðõ (Ð<Ð<¨%°
Ô*;Ð<Ð<Ø˜\Ô*ð Ð,Ô-ðØ"Ø%*Ð+>Ô%?ÀÔ%LØ).Ð/BÔ)CÀOÔ)TØ).Ð/BÔ)CÀOÔ)TØ*/Ð0CÔ*D×*HÒ*HØ,¨bñ+ô +ð	%ð %ð	ð 	ð å˜‘,”,ÝÐKÐK¨EÐKÑKÔKÑLÔLð9
ñ 
ô 
ð 	
rL   úCheckpoint | Nonec                óò   — |€d S i }d|d         v r|d         d         |d<   d|d         v r|d         d         |d<   d|d         v r|d         d         |d<   d|d         v r|d         d         |d<   |r|nd S )Nrº   rµ   r»   r¼   r½   rR   )rb   r[   r´   s      rK   Ú_get_checkpointzRemoteGraph._get_checkpoint|  s²   € Øˆ>Ø�4àˆ
à˜& Ô0Ð0Ð0Ø&,¨^Ô&<¸[Ô&IˆJ�{Ñ#Ø˜f ^Ô4Ð4Ð4Ø*0°Ô*@ÀÔ*QˆJ�Ñ'Ø˜f ^Ô4Ð4Ð4Ø*0°Ô*@ÀÔ*QˆJ�Ñ'Ø˜v nÔ5Ð5Ð5Ø+1°.Ô+AÐBRÔ+SˆJÐ'Ñ(à'Ð1ˆzˆz¨TÐ1rL   r´   r   r   c                ó`   — d|d         |d         |d         |                      di ¦  «        dœiS )Nrµ   rº   r»   r¼   r½   r¾   )r‹   )rb   r´   s     rK   Ú_get_configzRemoteGraph._get_config�  sC   € àØ'¨Ô4Ø!+¨OÔ!<Ø!+¨OÔ!<Ø",§.¢.Ð1AÀ2Ñ"FÔ"Fð	ð ð
ð 	
rL   c                óÔ  — i }d|v r|d         |d<   d|v rd„ |d         D ¦   «         |d<   d|v rVi |d<   |d                               ¦   «         D ]6\  }}t          |t          ¦  «        rt          |¦  «        x}�||d         |<   Œ7d|v r_i |d<   |d                               ¦   «         D ]?\  }}t          |t          ¦  «        r%|t          vrt          |¦  «        x}�||d         |<   Œ@|S )z6Sanitize the config to remove non-serializable fields.Úrecursion_limitÚtagsc                ó<   — g | ]}t          |t          ¦  «        ¯|‘ŒS rR   )r9   r:   )rŸ   Útags     rK   r¡   z0RemoteGraph._sanitize_config.<locals>.<listcomp>�  s(   € Ð WÐ WÐ W¨Å*ÈSÕRUÑBVÔBVÐ W Ð WÐ WÐ WrL   r4   Nrµ   )r?   r9   r:   r@   Ú_CONF_DROPLIST)rb   r[   Ú	sanitizedrE   r6   rG   s         rK   Ú_sanitize_configzRemoteGraph._sanitize_config—  s:  € à$&ˆ	Ø Ð&Ð&Ø+1Ð2CÔ+DˆIÐ'Ñ(Ø�VÐÐØ WÐ W°°v´Ð WÑ WÔ WˆI�fÑà˜ÐÐØ$&ˆI�jÑ!Ø˜zÔ*×0Ò0Ñ2Ô2ð ?ð ?‘��1å˜q¥#Ñ&Ô&ð?å,BÀ1Ñ,EÔ,EÐE˜ÐRà/>�I˜jÔ)¨!Ñ,øà˜VÐ#Ð#Ø(*ˆI�nÑ%Ø˜~Ô.×4Ò4Ñ6Ô6ð Cð C‘��1å˜q¥#Ñ&Ô&ðCà¥Ð/Ð/Ý,BÀ1Ñ,EÔ,EÐE˜ÐRà3B�I˜nÔ-¨aÑ0øàÐrL   )Ú	subgraphsr5   r“   rÔ   c               óú   — |                       ¦   «         }t          | j        |¦  «        }|j                             |d         d         |                      |¦  «        |||¬¦  «        }|                      |¦  «        S )áp  Get the state of a thread.

        This method calls `POST /threads/{thread_id}/state/checkpoint` if a
        checkpoint is specified in the config or `GET /threads/{thread_id}/state`
        if no checkpoint is specified.

        Args:
            config: A `RunnableConfig` that includes `thread_id` in the
                `configurable` field.
            subgraphs: Include subgraphs in the state.
            headers: Optional custom headers to include with the request.
            params: Optional query parameters to include with the request.

        Returns:
            The latest state of the thread.
        rµ   rº   ©rº   r´   rÔ   r5   r“   )ri   r   r[   ÚthreadsÚ	get_staterÉ   rÆ   )rb   r[   rÔ   r5   r“   rZ   Úmerged_configrª   s           rK   rÙ   zRemoteGraph.get_state´  s€   € ð0 ×0Ò0Ñ2Ô2ˆÝ% d¤k°6Ñ:Ô:ˆàÔ#×-Ò-Ø# NÔ3°KÔ@Ø×+Ò+¨MÑ:Ô:ØØØð .ñ 
ô 
ˆð ×*Ò*¨5Ñ1Ô1Ð1rL   c             ƒ  ó
  K  — |                       ¦   «         }t          | j        |¦  «        }|j                             |d         d         |                      |¦  «        |||¬¦  «        ƒ d{V —†}|                      |¦  «        S )rÖ   rµ   rº   r×   N)rg   r   r[   rØ   rÙ   rÉ   rÆ   )rb   r[   rÔ   r5   r“   rY   rÚ   rª   s           rK   Ú
aget_statezRemoteGraph.aget_stateØ  s¡   è è € ð0 ×&Ò&Ñ(Ô(ˆÝ% d¤k°6Ñ:Ô:ˆà”n×.Ò.Ø# NÔ3°KÔ@Ø×+Ò+¨MÑ:Ô:ØØØð /ñ 
ô 
ð 
ð 
ð 
ð 
ð 
ð 
ˆð ×*Ò*¨5Ñ1Ô1Ð1rL   )ÚfilterÚbeforeÚlimitr5   r“   rÝ   údict[str, Any] | NonerÞ   rß   ú
int | NoneúIterator[StateSnapshot]c          	   #  óB  K  — |                       ¦   «         }t          | j        |¦  «        }|j                             |d         d         |r|nd|                      |¦  «        ||                      |¦  «        ||¬¦  «        }	|	D ]}
|                      |
¦  «        V — ŒdS )aÄ  Get the state history of a thread.

        This method calls `POST /threads/{thread_id}/history`.

        Args:
            config: A `RunnableConfig` that includes `thread_id` in the
                `configurable` field.
            filter: Metadata to filter on.
            before: A `RunnableConfig` that includes checkpoint metadata.
            limit: Max number of states to return.

        Returns:
            States of the thread.
        rµ   rº   é
   ©rº   rß   rÞ   r4   r´   r5   r“   N)ri   r   r[   rØ   Úget_historyrÉ   rÆ   )rb   r[   rÝ   rÞ   rß   r5   r“   rZ   rÚ   Ústatesrª   s              rK   Úget_state_historyzRemoteGraph.get_state_historyü  sÃ   è è € ð0 ×0Ò0Ñ2Ô2ˆÝ% d¤k°6Ñ:Ô:ˆàÔ$×0Ò0Ø# NÔ3°KÔ@Ø Ð(�%�% bØ×'Ò'¨Ñ/Ô/ØØ×+Ò+¨MÑ:Ô:ØØð 1ñ 
ô 
ˆð ð 	5ð 	5ˆEØ×-Ò-¨eÑ4Ô4Ð4Ð4Ð4Ð4ð	5ð 	5rL   úAsyncIterator[StateSnapshot]c          	    óP  K  — |                       ¦   «         }t          | j        |¦  «        }|j                             |d         d         |r|nd|                      |¦  «        ||                      |¦  «        ||¬¦  «        ƒ d{V —†}	|	D ]}
|                      |
¦  «        W V — ŒdS )aY  Get the state history of a thread.

        This method calls `POST /threads/{thread_id}/history`.

        Args:
            config: A `RunnableConfig` that includes `thread_id` in the
                `configurable` field.
            filter: Metadata to filter on.
            before: A `RunnableConfig` that includes checkpoint metadata.
            limit: Max number of states to return.
            headers: Optional custom headers to include with the request.
            params: Optional query parameters to include with the request.

        Returns:
            States of the thread.
        rµ   rº   rä   rå   N)rg   r   r[   rØ   ræ   rÉ   rÆ   )rb   r[   rÝ   rÞ   rß   r5   r“   rY   rÚ   rç   rª   s              rK   Úaget_state_historyzRemoteGraph.aget_state_history#  sã   è è € ð4 ×&Ò&Ñ(Ô(ˆÝ% d¤k°6Ñ:Ô:ˆà”~×1Ò1Ø# NÔ3°KÔ@Ø Ð(�%�% bØ×'Ò'¨Ñ/Ô/ØØ×+Ò+¨MÑ:Ô:ØØð 2ñ 
ô 
ð 
ð 
ð 
ð 
ð 
ð 
ˆð ð 	5ð 	5ˆEØ×-Ò-¨eÑ4Ô4Ð4Ð4Ð4Ð4Ð4ð	5ð 	5rL   Úupdatesú.list[tuple[dict[str, Any] | None, str | None]]c                ó   — t           ‚©N©rs   ©rb   r[   rì   s      rK   Úbulk_update_statezRemoteGraph.bulk_update_stateL  s
   € õ
 "Ð!rL   c              ƒ  ó   K  — t           ‚rï   rð   rñ   s      rK   Úabulk_update_statezRemoteGraph.abulk_update_stateS  s   è è € õ
 "Ð!rL   )r5   r“   r¸   údict[str, Any] | Any | NoneÚas_nodec               ó  — |                       ¦   «         }t          | j        |¦  «        }|j                             |d         d         |||                      |¦  «        ||¬¦  «        }|                      |d         ¦  «        S )á¤  Update the state of a thread.

        This method calls `POST /threads/{thread_id}/state`.

        Args:
            config: A `RunnableConfig` that includes `thread_id` in the
                `configurable` field.
            values: Values to update to the state.
            as_node: Update the state as if this node had just executed.

        Returns:
            `RunnableConfig` for the updated thread.
        rµ   rº   ©rº   r¸   rö   r´   r5   r“   r´   )ri   r   r[   rØ   Úupdate_staterÉ   rË   )	rb   r[   r¸   rö   r5   r“   rZ   rÚ   Úresponses	            rK   rú   zRemoteGraph.update_stateZ  sˆ   € ð, ×0Ò0Ñ2Ô2ˆÝ% d¤k°6Ñ:Ô:ˆà$Ô,×9Ò9Ø# NÔ3°KÔ@ØØØ×+Ò+¨MÑ:Ô:ØØð :ñ 
ô 
ˆð ×Ò ¨Ô 6Ñ7Ô7Ð7rL   c             ƒ  ó  K  — |                       ¦   «         }t          | j        |¦  «        }|j                             |d         d         |||                      |¦  «        ||¬¦  «        ƒ d{V —†}|                      |d         ¦  «        S )rø   rµ   rº   rù   Nr´   )rg   r   r[   rØ   rú   rÉ   rË   )	rb   r[   r¸   rö   r5   r“   rY   rÚ   rû   s	            rK   Úaupdate_statezRemoteGraph.aupdate_state}  s©   è è € ð, ×&Ò&Ñ(Ô(ˆÝ% d¤k°6Ñ:Ô:ˆà%œ~×:Ò:Ø# NÔ3°KÔ@ØØØ×+Ò+¨MÑ:Ô:ØØð  ;ñ  
ô  
ð 
ð 
ð 
ð 
ð 
ð 
ˆð ×Ò ¨Ô 6Ñ7Ô7Ð7rL   Ústream_modeú$StreamMode | list[StreamMode] | NoneÚdefaultr   úLtuple[list[StreamModeSDK], list[StreamModeSDK], bool, StreamProtocol | None]c                ó°  — g }d}|rCt          |t          ¦  «        r|                     |¦  «         n-d}|                     |¦  «         n|                     |¦  «         |                     ¦   «         }|pi                      t          i ¦  «                             t          ¦  «        }|r|                     |j        ¦  «         d|v r*| 	                    d¦  «         |                     d¦  «         d|v r*| 	                    d¦  «         |                     d¦  «         d|vr|                     d¦  «         d|v r| 	                    d¦  «         ||||fS )aH  Return a tuple of the final list of stream modes sent to the
        remote graph and a boolean flag indicating if stream mode 'updates'
        was present in the original list of stream modes.

        'updates' mode is added to the list of stream modes so that interrupts
        can be detected in the remote graph.
        TFÚmessageszmessages-tuplerì   Úevents)
r9   r:   rC   Úextendr€   r‹   r   r"   ÚmodesÚremove)rb   rþ   r[   r   Úupdated_stream_modesÚ
req_singleÚrequested_stream_modesÚstreams           rK   Ú_get_stream_modeszRemoteGraph._get_stream_modes   s�  € ð 57ÐØˆ
àð 	1Ý˜+¥sÑ+Ô+ð 9Ø$×+Ò+¨KÑ8Ô8Ð8Ð8à"�
Ø$×+Ò+¨KÑ8Ô8Ð8Ð8à ×'Ò'¨Ñ0Ô0Ð0Ø!5×!:Ò!:Ñ!<Ô!<Ðð ˆ\�r×Ò�t RÑ(Ô(×,Ò,Õ->Ñ?Ô?ð 	ð ð 	6Ø ×'Ò'¨¬Ñ5Ô5Ð5àÐ-Ð-Ð-Ø ×'Ò'¨
Ñ3Ô3Ð3Ø ×'Ò'Ð(8Ñ9Ô9Ð9ð Ð5Ð5Ð5Ø"×)Ò)Ð*:Ñ;Ô;Ð;Ø"×)Ò)¨*Ñ5Ô5Ð5ð Ð0Ð0Ð0Ø ×'Ò'¨	Ñ2Ô2Ð2ð Ð+Ð+Ð+Ø ×'Ò'¨Ñ1Ô1Ð1Ø$Ð&<¸jÈ&ÐQÐQrL   )Úcontextrþ   rl   rm   rÔ   r5   r“   Úinputúdict[str, Any] | Anyr  úContext | NoneúAll | Sequence[str] | NoneÚversionúLiteral['v2']úIterator[StreamPart]c               ó   — d S rï   rR   ©rb   r  r[   r  rþ   rl   rm   rÔ   r5   r“   r  r�   s               rK   r  zRemoteGraph.streamÓ  s	   € ð  #˜srL   .)r  rþ   rl   rm   rÔ   r5   r“   r  úLiteral['v1']úIterator[dict[str, Any] | Any]c               ó   — d S rï   rR   r  s               rK   r  zRemoteGraph.streamä  s	   € ð *-¨rL   Úv1úLiteral['v1', 'v2']c             +  ó8  K  — |                       ¦   «         }t          | j        |¦  «        }|                      |¦  «        }|                      ||¦  «        \  }}}}t          |t          ¦  «        r%t          t          t          |¦  «        ¦  «        }d}nd}| 
                    di ¦  «                             dd¦  «        } |j        j        d|| j        ||||||||p|dud| j        rt!          |¦  «        n||	dœ|¤ŽD �]}t"          |j        v rK|j                             t"          d¦  «        \  }}t)          |                     t"          ¦  «        ¦  «        }n	|j        d}}|dk    rF|j         
                    d	¦  «        t          j        k    rt/          t          di |j        ¤Ž¦  «        ‚|pi  
                    t0          i ¦  «         
                    t2          ¦  «        x}r,t)          |                     t"          ¦  «        ¦  «        }||z   }|�||j        v r ||||j        f¦  «         |j                             d
¦  «        rTt          |j        t8          ¦  «        r9t:          |j        v r+|r)t=          d„ |j        t:                   D ¦   «         ¦  «        ‚n.|j                             d¦  «        rt?          |j        ¦  «        ‚||vr�ŒÔ|j                             d¦  «        r(|                      t)          |j        ¦  «        ¬¦  «        }|
dk    rid}|dk    rQt          |j        t8          ¦  «        r7t)          d„ |j                             t:          d¦  «        D ¦   «         ¦  «        }|||j        |dœV — �Œ…|rt"          |j        v rK|j                             t"          d¦  «        \  }}t)          |                     t"          ¦  «        ¦  «        }n	|j        d}}|r||j        fV — �Œø|||j        fV — �Œ|r|j        V — �Œ|V — �ŒdS )á  Create a run and stream the results.

        This method calls `POST /threads/{thread_id}/runs/stream` if a `thread_id`
        is specified in the `configurable` field of the config or
        `POST /runs/stream` otherwise.

        Args:
            input: Input to the graph.
            config: A `RunnableConfig` for graph invocation.
            stream_mode: Stream mode(s) to use.
            interrupt_before: Interrupt the graph before these nodes.
            interrupt_after: Interrupt the graph after these nodes.
            subgraphs: Stream from subgraphs.
            headers: Additional headers to pass to the request.
            **kwargs: Additional params to pass to client.runs.stream.

        Yields:
            The output of the graph.
        Nrµ   rº   Úcreate©rº   rT   r  Úcommandr[   r  rþ   rl   rm   Ústream_subgraphsÚif_not_existsr5   r“   é   rR   r   r„   rì   c                ó&   — g | ]}t          d i |¤Ž‘ŒS r›   r¯   ©rŸ   rÃ   s     rK   r¡   z&RemoteGraph.stream.<locals>.<listcomp>K  ó"   € ÐKÐKÐK°�Y˜^˜^¨˜^˜^ÐKÐKÐKrL   r³   r  ©rŠ   Úv2r¸   c              3  ó\   K  — | ]'}t          |t          ¦  «        rt          di |¤Žn|V — Œ(d S r®   ©r9   r>   r.   r%  s     rK   r±   z%RemoteGraph.stream.<locals>.<genexpr>Z  óS   è è € ð !ð !àõ +5°Q½Ñ*=Ô*=ÐD�	˜˜ A˜˜˜À1ð!ð !ð !ð !ð !ð !rL   ©ÚtypeÚnsrŠ   r²   )!ri   r   r[   rÓ   r  r9   r   r
   Ú
CommandSDKr   r‹   r~   Úrunsr  rT   r\   Ú_merge_tracing_headersr%   ÚeventÚsplitrB   rŠ   ÚPARENTr'   r   r!   r  Ú
startswithr>   r$   r&   r3   Ú_replace)rb   r  r[   r  rþ   rl   rm   rÔ   r5   r“   r  r�   rZ   rÚ   Úsanitized_configÚstream_modesÚ	requestedr	  r  r   rº   ÚchunkÚmodeÚns_r.  Ú	caller_nsÚintss                              rK   r  zRemoteGraph.streamõ  si  è è € ðD ×0Ò0Ñ2Ô2ˆÝ% d¤k°6Ñ:Ô:ˆØ×0Ò0°Ñ?Ô?ÐØ6:×6LÒ6LØ˜ñ7
ô 7
Ñ3ˆ�i ¨Võ �e�WÑ%Ô%ð 	Ý)-­j½&À¹-¼-Ñ)HÔ)HˆGØˆEˆEàˆGØ$×(Ò(¨¸Ñ<Ô<×@Ò@ÀÈdÑSÔSˆ	à,�[Ô%Ô,ð 
ØØÔ*ØØØ#ØØ$Ø-Ø+Ø&Ð<¨&¸Ð*<Ø"à37Ô3KÐXÕ& wÑ/Ô/Ð/ÐQXàð
ð 
ð  ð!
ð 
ð H	ñ H	ˆEõ& ˜œÐ$Ð$Ø!œK×-Ò-­f°aÑ8Ô8‘	��cÝ˜3Ÿ9š9¥VÑ,Ô,Ñ-Ô-��à œ;¨�b�à�yÒ Ð  U¤Z§^¢^°GÑ%<Ô%<ÅÄÒ%NÐ%NÝ#¥GÐ$9Ð$9¨e¬jÐ$9Ð$9Ñ:Ô:Ð:à#˜\ r×.Ò.­t°RÑ8Ô8×<Ò<Õ=UÑVÔVÐVˆyð $Ý! )§/¢/µ&Ñ"9Ô"9Ñ:Ô:�	Ø ‘^�àÐ! d¨f¬lÐ&:Ð&:Ø�˜˜D %¤*Ð-Ñ.Ô.Ð.àŒ{×%Ò% iÑ0Ô0ð 2Ý˜eœj­$Ñ/Ô/ð µIÀÄÐ4KÐ4KØ ð Ý,ØKÐK°U´ZÅ	Ô5JÐKÑKÔKñô ð øð ”×'Ò'¨Ñ0Ô0ð 2Ý% e¤jÑ1Ô1Ð1à˜9Ð$Ð$ÙàŒ{×%Ò% jÑ1Ô1ð ?ØŸš­E°%´*Ñ,=Ô,=˜Ñ>Ô>�ð ˜$ŠˆØ.0�Ø˜8Ò#Ð#­
°5´:½tÑ(DÔ(DÐ#Ý ð !ð !à!&¤§¢µ	¸2Ñ!>Ô!>ð!ñ !ô !ñ ô �Dð  $¨2°u´zÐQUÐVÐVÐVÐVÐVÑVØð Ý˜Uœ[Ð(Ð(Ø %¤× 1Ò 1µ&¸!Ñ <Ô <‘I�D˜#Ý˜sŸyšy­Ñ0Ô0Ñ1Ô1�B�Bà$œ{¨B˜"�DØð /Ø˜eœj˜.Ð(Ð(Ð(Ñ(à˜d E¤JÐ.Ð.Ð.Ð.Ñ.Øð Ø”jÐ Ð Ð Ñ à���‘ðQH	ð H	rL   úAsyncIterator[StreamPart]c               ó   — d S rï   rR   r  s               rK   ÚastreamzRemoteGraph.astreamn  s	   € ð %( CrL   ú#AsyncIterator[dict[str, Any] | Any]c               ó   — d S rï   rR   r  s               rK   rA  zRemoteGraph.astream  s	   € ð /2¨crL   c              óL  K  — |                       ¦   «         }t          | j        |¦  «        }|                      |¦  «        }|                      ||¦  «        \  }}}}t          |t          ¦  «        r%t          t          t          |¦  «        ¦  «        }d}nd}| 
                    di ¦  «                             dd¦  «        } |j        j        d|| j        ||||||||p|dud| j        rt!          |¦  «        n||	dœ|¤Ž2 3 d{V —†}t"          |j        v rK|j                             t"          d¦  «        \  }}t)          |                     t"          ¦  «        ¦  «        }n	|j        d}}|dk    rF|j         
                    d	¦  «        t          j        k    rt/          t          di |j        ¤Ž¦  «        ‚|pi  
                    t0          i ¦  «         
                    t2          ¦  «        x}r,t)          |                     t"          ¦  «        ¦  «        }||z   }|�||j        v r ||||j        f¦  «         |j                             d
¦  «        rTt          |j        t8          ¦  «        r9t:          |j        v r+|r)t=          d„ |j        t:                   D ¦   «         ¦  «        ‚n.|j                             d¦  «        rt?          |j        ¦  «        ‚||vr�ŒØ|j                             d¦  «        r(|                      t)          |j        ¦  «        ¬¦  «        }|
dk    rjd}|dk    rQt          |j        t8          ¦  «        r7t)          d„ |j                             t:          d¦  «        D ¦   «         ¦  «        }|||j        |dœW V — �ŒŠ|r�t"          |j        v rK|j                             t"          d¦  «        \  }}t)          |                     t"          ¦  «        ¦  «        }n	|j        d}}|r||j        fW V — �Œþ|||j        fW V — �Œ|r|j        W V — �Œ|W V — �Œ"6 dS )r  Nrµ   rº   r  r  r#  rR   r   r„   rì   c                ó&   — g | ]}t          d i |¤Ž‘ŒS r›   r¯   r%  s     rK   r¡   z'RemoteGraph.astream.<locals>.<listcomp>æ  r&  rL   r³   r  r'  r(  r¸   c              3  ó\   K  — | ]'}t          |t          ¦  «        rt          di |¤Žn|V — Œ(d S r®   r*  r%  s     rK   r±   z&RemoteGraph.astream.<locals>.<genexpr>õ  r+  rL   r,  )!rg   r   r[   rÓ   r  r9   r   r
   r/  r   r‹   r~   r0  r  rT   r\   r1  r%   r2  r3  rB   rŠ   r4  r'   r   r!   r  r5  r>   r$   r&   r3   r6  )rb   r  r[   r  rþ   rl   rm   rÔ   r5   r“   r  r�   rY   rÚ   r7  r8  r9  r	  r  r   rº   r:  r;  r<  r.  r=  r>  s                              rK   rA  zRemoteGraph.astream�  s—  è è € ðD ×&Ò&Ñ(Ô(ˆÝ% d¤k°6Ñ:Ô:ˆØ×0Ò0°Ñ?Ô?ÐØ6:×6LÒ6LØ˜ñ7
ô 7
Ñ3ˆ�i ¨Võ �e�WÑ%Ô%ð 	Ý)-­j½&À¹-¼-Ñ)HÔ)HˆGØˆEˆEàˆGØ$×(Ò(¨¸Ñ<Ô<×@Ò@ÀÈdÑSÔSˆ	à-˜6œ;Ô-ð 
ØØÔ*ØØØ#ØØ$Ø-Ø+Ø&Ð<¨&¸Ð*<Ø"à37Ô3KÐXÕ& wÑ/Ô/Ð/ÐQXàð
ð 
ð  ð!
ð 
ð H	ð H	ð H	ð H	ð H	ð H	ð H	�%õ& ˜œÐ$Ð$Ø!œK×-Ò-­f°aÑ8Ô8‘	��cÝ˜3Ÿ9š9¥VÑ,Ô,Ñ-Ô-��à œ;¨�b�à�yÒ Ð  U¤Z§^¢^°GÑ%<Ô%<ÅÄÒ%NÐ%NÝ#¥GÐ$9Ð$9¨e¬jÐ$9Ð$9Ñ:Ô:Ð:à#˜\ r×.Ò.­t°RÑ8Ô8×<Ò<Õ=UÑVÔVÐVˆyð $Ý! )§/¢/µ&Ñ"9Ô"9Ñ:Ô:�	Ø ‘^�àÐ! d¨f¬lÐ&:Ð&:Ø�˜˜D %¤*Ð-Ñ.Ô.Ð.àŒ{×%Ò% iÑ0Ô0ð 2Ý˜eœj­$Ñ/Ô/ð µIÀÄÐ4KÐ4KØ ð Ý,ØKÐK°U´ZÅ	Ô5JÐKÑKÔKñô ð øð ”×'Ò'¨Ñ0Ô0ð 2Ý% e¤jÑ1Ô1Ð1à˜9Ð$Ð$ÙàŒ{×%Ò% jÑ1Ô1ð ?ØŸš­E°%´*Ñ,=Ô,=˜Ñ>Ô>�ð ˜$ŠˆØ.0�Ø˜8Ò#Ð#­
°5´:½tÑ(DÔ(DÐ#Ý ð !ð !à!&¤§¢µ	¸2Ñ!>Ô!>ð!ñ !ô !ñ ô �Dð  $¨2°u´zÐQUÐVÐVÐVÐVÐVÐVÑVØð Ý˜Uœ[Ð(Ð(Ø %¤× 1Ò 1µ&¸!Ñ <Ô <‘I�D˜#Ý˜sŸyšy­Ñ0Ô0Ñ1Ô1�B�Bà$œ{¨B˜"�DØð /Ø˜eœj˜.Ð(Ð(Ð(Ð(Ñ(à˜d E¤JÐ.Ð.Ð.Ð.Ð.Ñ.Øð Ø”jÐ Ð Ð Ð Ñ à����‘ðQ
ð 
ð 
s   ÄP#r(  )r  rl   rm   rj   rk   r5   úLiteral['v1', 'v2', 'v3']úSequence[Any] | Nonec          	     ó  •— |dk    r t          ¦   «         j        ||fd|i|	¤ŽS |                      |||||	¬¦  «         |                      ¦   «         }
|                      t          | j        |¦  «        ¦  «        }|                     di ¦  «                             dd¦  «        }| j	        rt          |¦  «        n|}|
j                             || j        |¬¦  «        }t          |
||||	                     d¦  «        ¬	¦  «        S )
zêStream events from this remote graph.

        For `version="v3"`, returns a `_RemoteGraphRunStream` whose surface
        matches the local `GraphRunStream`. For other versions, delegates to
        `Runnable.stream_events`.
        Úv3r  ©rj   rk   rl   rm   rn   rµ   rº   N©rº   rT   r5   r4   )rZ   Ú
sdk_threadr  r[   r4   )ÚsuperÚstream_eventsry   ri   rÓ   r   r[   r‹   r~   r\   r1  rØ   r  rT   r)   )rb   r  r[   r  rl   rm   rj   rk   r5   r�   rZ   rÒ   rº   Úmerged_headersrM  r}   s                  €rK   rO  zRemoteGraph.stream_events	  s2  ø€ ð& �dŠ?ˆ?Ø(•5‘7”7Ô(¨°ÐRÐRÀÐRÈ6ÐRÐRÐRØ×#Ò#ØØ%Ø-Ø+Øð 	$ñ 	
ô 	
ð 	
ð ×0Ò0Ñ2Ô2ˆØ×)Ò)­-¸¼ÀVÑ*LÔ*LÑMÔMˆ	Ø—M’M .°"Ñ5Ô5×9Ò9¸+ÀtÑLÔLˆ	à/3Ô/GÐTÕ" 7Ñ+Ô+Ð+ÈWð 	ð !Ô(×/Ò/ØØÔ*Ø"ð 0ñ 
ô 
ˆ
õ
 %Ø#Ø!ØØØ—Z’Z 
Ñ+Ô+ð
ñ 
ô 
ð 	
rL   c          	   ‹  óú  K  — |dk    rt          d|›d�¦  «        ‚|                      |||||	¬¦  «         |                      ¦   «         }
|                      t	          | j        |¦  «        ¦  «        }|                     di ¦  «                             dd¦  «        }| j        rt          |¦  «        n|}|
j
                             || j        |¬¦  «        }t          |
||||	                     d	¦  «        ¬
¦  «        S )ah  Async-stream events from this remote graph.

        For `version="v3"`, awaits to an `_AsyncRemoteGraphRunStream`, matching
        the local `Pregel.astream_events(version="v3")` awaitable contract:
        `async with await rg.astream_events(..., version="v3") as run`. For
        `version="v1"`/`"v2"`, raises NotImplementedError (use `astream`).
        rJ  z#RemoteGraph.astream_events(version=zH) is not implemented; use astream() for v1/v2 streaming or version='v3'.rK  rµ   rº   NrL  r4   )rY   rM  r  r[   r4   )rs   ry   rg   rÓ   r   r[   r‹   r~   r\   r1  rØ   r  rT   r(   )rb   r  r[   r  rl   rm   rj   rk   r5   r�   rY   rÒ   rº   rP  rM  s                  rK   Úastream_eventszRemoteGraph.astream_events8  s8  è è € ð( �dŠ?ˆ?Ý%ð °gð  ð  ð  ñô ð ð
 	×#Ò#ØØ%Ø-Ø+Øð 	$ñ 	
ô 	
ð 	
ð ×&Ò&Ñ(Ô(ˆØ×)Ò)­-¸¼ÀVÑ*LÔ*LÑMÔMˆ	Ø—M’M .°"Ñ5Ô5×9Ò9¸+ÀtÑLÔLˆ	à/3Ô/GÐTÕ" 7Ñ+Ô+Ð+ÈWð 	ð ”^×*Ò*ØØÔ*Ø"ð +ñ 
ô 
ˆ
õ
 *ØØ!ØØØ—Z’Z 
Ñ+Ô+ð
ñ 
ô 
ð 	
rL   )r  rl   rm   r5   r“   úGraphOutput[dict[str, Any]]c               ó   — d S rï   rR   ©
rb   r  r[   r  rl   rm   r5   r“   r  r�   s
             rK   ÚinvokezRemoteGraph.invokel  s	   € ð '* crL   )r  rl   rm   r5   r“   r  c               ó   — d S rï   rR   rU  s
             rK   rV  zRemoteGraph.invoke{  s	   € ð  #˜srL   c               ó  —  | j         |f|||||d||dœ|	¤ŽD ]}
Œ	 |dk    r8t          |
d         t          |
                     dd¦  «        ¦  «        ¬¦  «        S |
S # t          $ r t
                               d¦  «         Y d	S w xY w)
a¡  Create a run, wait until it finishes and return the final state.

        Args:
            input: Input to the graph.
            config: A `RunnableConfig` for graph invocation.
            interrupt_before: Interrupt the graph before these nodes.
            interrupt_after: Interrupt the graph after these nodes.
            headers: Additional headers to pass to the request.
            version: The streaming format version. `"v1"` (default) returns the
                traditional format, `"v2"` returns `StreamPart` typed dicts.
            **kwargs: Additional params to pass to RemoteGraph.stream.

        Returns:
            The output of the graph.
        r¸   ©r[   r  rl   rm   r5   rþ   r“   r  r(  rŠ   r²   rR   ©rw   r²   ú$No events received from remote graphN)r  r-   rB   r‹   ÚUnboundLocalErrorÚloggerÚwarning©rb   r  r[   r  rl   rm   r5   r“   r  r�   r:  s              rK   rV  zRemoteGraph.invokeŠ  sÖ   € ð8 !�T”[Øð
àØØ-Ø+ØØ ØØð
ð 
ð ð
ð 
ð 	ð 	ˆEð ð		Ø˜$ŠˆÝ"Ø œ-Ý$ U§Y¢Y¨|¸RÑ%@Ô%@ÑAÔAðñ ô ð ð ˆLøÝ ð 	ð 	ð 	Ý�NŠNÐAÑBÔBÐBØ�4�4ð	øøøs   œ=A ÁA Á$BÂBc             ‹  ó
   K  — d S rï   rR   rU  s
             rK   ÚainvokezRemoteGraph.ainvoke¾  s   è è € ð '* crL   c             ‹  ó
   K  — d S rï   rR   rU  s
             rK   ra  zRemoteGraph.ainvokeÍ  s   è è € ð  #˜srL   c             ‹  ó  K  —  | j         |f|||||d||dœ|	¤Ž2 3 d{V —†}
Œ6 	 |dk    r8t          |
d         t          |
                     dd¦  «        ¦  «        ¬¦  «        S |
S # t          $ r t
                               d	¦  «         Y dS w xY w)
a¢  Create a run, wait until it finishes and return the final state.

        Args:
            input: Input to the graph.
            config: A `RunnableConfig` for graph invocation.
            interrupt_before: Interrupt the graph before these nodes.
            interrupt_after: Interrupt the graph after these nodes.
            headers: Additional headers to pass to the request.
            version: The streaming format version. `"v1"` (default) returns the
                traditional format, `"v2"` returns `StreamPart` typed dicts.
            **kwargs: Additional params to pass to RemoteGraph.astream.

        Returns:
            The output of the graph.
        r¸   rY  Nr(  rŠ   r²   rR   rZ  r[  )rA  r-   rB   r‹   r\  r]  r^  r_  s              rK   ra  zRemoteGraph.ainvokeÜ  sø   è è € ð8 (˜4œ<Øð
àØØ-Ø+ØØ ØØð
ð 
ð ð
ð 
ð 	ð 	ð 	ð 	ð 	ð 	ð 	�%ð ð
ð		Ø˜$ŠˆÝ"Ø œ-Ý$ U§Y¢Y¨|¸RÑ%@Ô%@ÑAÔAðñ ô ð ð ˆLøÝ ð 	ð 	ð 	Ý�NŠNÐAÑBÔBÐBØ�4�4ð	øøøs   š"¤=A$ Á"A$ Á$$BÂB)rT   r:   rW   rU   rX   rU   r5   r]   rY   r^   rZ   r_   r[   r`   rV   rU   r\   r=   )r7   r   )r7   r   )rj   r   rk   r   rl   r   rm   r   rn   ro   r7   rp   )rz   ro   r7   r   rï   )r[   r`   r�   r   r7   r   )r„   r…   r7   r†   )
r[   r`   r’   r”   r5   r]   r“   r•   r7   r–   )rª   r   r7   r0   )r[   r`   r7   rÇ   )r´   r   r7   r   )r[   r   r7   r   )
r[   r   rÔ   r=   r5   r]   r“   r•   r7   r0   )r[   r   rÝ   rà   rÞ   r`   rß   rá   r5   r]   r“   r•   r7   râ   )r[   r   rÝ   rà   rÞ   r`   rß   rá   r5   r]   r“   r•   r7   ré   )r[   r   rì   rí   r7   r   )r[   r   r¸   rõ   rö   rU   r5   r]   r“   r•   r7   r   )rì   )rþ   rÿ   r[   r`   r   r   r7   r  )r  r  r[   r`   r  r  rþ   rÿ   rl   r  rm   r  rÔ   r=   r5   r]   r“   r•   r  r  r�   r   r7   r  )r  r  r[   r`   r  r  rþ   rÿ   rl   r  rm   r  rÔ   r=   r5   r]   r“   r•   r  r  r�   r   r7   r  )r  r  r[   r`   r  r  rþ   rÿ   rl   r  rm   r  rÔ   r=   r5   r]   r“   r•   r  r  r�   r   r7   r  )r  r  r[   r`   r  r  rþ   rÿ   rl   r  rm   r  rÔ   r=   r5   r]   r“   r•   r  r  r�   r   r7   r?  )r  r  r[   r`   r  r  rþ   rÿ   rl   r  rm   r  rÔ   r=   r5   r]   r“   r•   r  r  r�   r   r7   rB  )r  r  r[   r`   r  r  rþ   rÿ   rl   r  rm   r  rÔ   r=   r5   r]   r“   r•   r  r  r�   r   r7   rB  )r  r   r[   r`   r  rG  rl   r  rm   r  rj   r   rk   rH  r5   r]   r�   r   r7   r   )r  r  r[   r`   r  r  rl   r  rm   r  r5   r]   r“   r•   r  r  r�   r   r7   rS  )r  r  r[   r`   r  r  rl   r  rm   r  r5   r]   r“   r•   r  r  r�   r   r7   r  )r  r  r[   r`   r  r  rl   r  rm   r  r5   r]   r“   r•   r  r  r�   r   r7   r  )#rN   rO   rP   rQ   Ú__annotations__rc   rg   ri   ry   r€   rƒ   r‘   r¦   r©   rÆ   rÉ   rË   rÓ   rÙ   rÜ   rè   rë   rò   rô   rú   rý   r  r   r  rA  rO  rR  rV  ra  Ú__classcell__)r}   s   @rK   r2   r2   v   sø  ø€ € € € € € ðð ð ÐÐÑØÐÐÑð Ø"Ø)-Ø)-Ø26Ø(,ØØ$)ð/'ð /'ð /'ð /'ð /'ð /'ðbð ð ð ð ð  ð  ð  ðð ð ð ð8Bð Bð Bð Bð
ð 
ð 
ð 
ð 
ð
ð ð ð ð4 )-ð
ð !Ø)-Ø)-ð
ð 
ð 
ð 
ð 
ð 
ðF )-ð
ð !Ø)-Ø)-ð
ð 
ð 
ð 
ð 
ð 
ðB8
ð 8
ð 8
ð 8
ðt2ð 2ð 2ð 2ð"
ð 
ð 
ð 
ðð ð ð ðB  Ø)-Ø)-ð"2ð "2ð "2ð "2ð "2ð "2ðP  Ø)-Ø)-ð"2ð "2ð "2ð "2ð "2ð "2ðP )-Ø(,Ø Ø)-Ø)-ð%5ð %5ð %5ð %5ð %5ð %5ðV )-Ø(,Ø Ø)-Ø)-ð'5ð '5ð '5ð '5ð '5ð '5ðR"ð "ð "ð "ð"ð "ð "ð "ð #ð	!8ð *.Ø)-ð!8ð !8ð !8ð !8ð !8ð !8ðN #ð	!8ð *.Ø)-ð!8ð !8ð !8ð !8ð !8ð !8ðN (ð	1Rð 1Rð 1Rð 1Rð 1Rðf ð )-ð#ð
 #'Ø<@Ø7;Ø6:ØØ)-Ø)-ð#ð #ð #ð #ð #ñ „Xð#ð  ð )-ð-ð
 #'Ø<@Ø7;Ø6:ØØ)-Ø)-Ø!$ð-ð -ð -ð -ð -ñ „Xð-ð& )-ðwð
 #'Ø<@Ø7;Ø6:ØØ)-Ø)-Ø'+ðwð wð wð wð wð wðr ð )-ð(ð
 #'Ø<@Ø7;Ø6:ØØ)-Ø)-ð(ð (ð (ð (ð (ñ „Xð(ð  ð )-ð2ð
 #'Ø<@Ø7;Ø6:ØØ)-Ø)-Ø!$ð2ð 2ð 2ð 2ð 2ñ „Xð2ð& )-ðwð
 #'Ø<@Ø7;Ø6:ØØ)-Ø)-Ø'+ðwð wð wð wð wð wðx )-ð-
ð
 .2Ø7;Ø6:ØØ-1Ø)-ð-
ð -
ð -
ð -
ð -
ð -
ð -
ð -
ðd )-ð2
ð
 .2Ø7;Ø6:ØØ-1Ø)-ð2
ð 2
ð 2
ð 2
ð 2
ð 2
ðh ð )-ð*ð
 #'Ø7;Ø6:Ø)-Ø)-ð*ð *ð *ð *ð *ñ „Xð*ð ð )-ð#ð
 #'Ø7;Ø6:Ø)-Ø)-Ø!$ð#ð #ð #ð #ð #ñ „Xð#ð" )-ð2ð
 #'Ø7;Ø6:Ø)-Ø)-Ø'+ð2ð 2ð 2ð 2ð 2ð 2ðh ð )-ð*ð
 #'Ø7;Ø6:Ø)-Ø)-ð*ð *ð *ð *ð *ñ „Xð*ð ð )-ð#ð
 #'Ø7;Ø6:Ø)-Ø)-Ø!$ð#ð #ð #ð #ð #ñ „Xð#ð" )-ð2ð
 #'Ø7;Ø6:Ø)-Ø)-Ø'+ð2ð 2ð 2ð 2ð 2ð 2ð 2ð 2ð 2ð 2rL   r2   r]   c                óÀ   — t          j        ¦   «         x}rH|                     ¦   «         }| r0d| v r| d         › d|d         › �|d<   |                      |¦  «         n|} | S )NÚbaggageú,)ÚlsÚget_current_run_treeÚ
to_headersrz   )r5   ÚrtÚtracing_headerss      rK   r1  r1    s~   € ÝÔ$Ñ&Ô&Ð&€rð 	&ØŸ-š-™/œ/ˆØð 	&Ø˜GÐ#Ð#à˜yÔ)ÐHÐH¨O¸IÔ,FÐHÐHð   	Ñ*ð �NŠN˜?Ñ+Ô+Ð+Ð+à%ˆGØ€NrL   )r6   r   r7   r   )r5   r]   r7   r]   )TÚ
__future__r   ÚloggingÚcollections.abcr   r   r   Údataclassesr   Útypingr   r	   r
   r   Úuuidr   Ú	langsmithri  Úlangchain_core.runnablesr   Úlangchain_core.runnables.graphr   r�   r   r–   r   rŒ   Úlanggraph.checkpoint.baser   Úlanggraph_sdk.clientr   r   r   r   Úlanggraph_sdk.schemar   r   r   r   r   r/  r   ÚStreamModeSDKÚtyping_extensionsr   Úlanggraph._internal._configr   Úlanggraph._internal._constantsr   r   r    r!   r"   r#   r$   r%   Úlanggraph.errorsr&   r'   Ú#langgraph.pregel._remote_run_streamr(   r)   Úlanggraph.pregel.protocolr*   r+   Úlanggraph.typesr,   r-   r.   r/   r0   r1   Ú	getLoggerrN   r]  Ú__all__Ú	frozensetrÑ   ru   r@   rÅ   r3   r2   r1  rR   rL   rK   ú<module>r…     s  ðØ "Ð "Ð "Ð "Ð "Ð "à €€€Ø =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ø Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð ð ð Ð Ð Ð Ð Ð à Ð Ð Ð Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3ðð ð ð ð ð ðð ð ð ð ð ðð ð ð ð ð ð 9Ð 8Ð 8Ð 8Ð 8Ð 8ðð ð ð ð ð ð ð ð ð ð ð ðð ð ð ð ð ð ð ð ð ð ð ðð ð ð ð ð ðð ð ð ð ð ð #Ð "Ð "Ð "Ð "Ð "à 5Ð 5Ð 5Ð 5Ð 5Ð 5ð	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð ;Ð :Ð :Ð :Ð :Ð :Ð :Ð :ðð ð ð ð ð ð ð ð EÐ DÐ DÐ DÐ DÐ DÐ DÐ Dð	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 
ˆÔ	˜8Ñ	$Ô	$€à
,€à�à!Ø Ø Øð	ñô €ð !�y *¨iÐ!8Ñ9Ô9Ð ðð ð ð ð,	ð 	ð 	ð 	ð 	�iñ 	ô 	ð 	ðXð Xð Xð Xð X�.ñ Xô Xð Xðv$ð ð ð ð ð rL   