From 4b1d6d2aebb84b8ed439b877681bfc5d9717ae1a Mon Sep 17 00:00:00 2001 From: Tat Dat Duong Date: Mon, 10 Mar 2025 19:22:10 +0100 Subject: [PATCH] Rename to StateUpdate --- libs/langgraph/langgraph/pregel/__init__.py | 10 +++++----- libs/langgraph/langgraph/pregel/protocol.py | 6 +++--- libs/langgraph/langgraph/pregel/types.py | 4 ++-- libs/langgraph/langgraph/types.py | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libs/langgraph/langgraph/pregel/__init__.py b/libs/langgraph/langgraph/pregel/__init__.py index e9b92ac37..7ce7eeebb 100644 --- a/libs/langgraph/langgraph/pregel/__init__.py +++ b/libs/langgraph/langgraph/pregel/__init__.py @@ -106,10 +106,10 @@ from langgraph.pregel.write import ChannelWrite, ChannelWriteEntry from langgraph.store.base import BaseStore from langgraph.types import ( All, - BulkUpdate, Checkpointer, LoopProtocol, StateSnapshot, + StateUpdate, StreamChunk, StreamMode, ) @@ -1166,7 +1166,7 @@ class Pregel(PregelProtocol): def bulk_update_state( self, config: RunnableConfig, - updates: list[BulkUpdate], + updates: list[StateUpdate], ) -> RunnableConfig: """Apply updates to the graph state in bulk. Requires a checkpointer to be set.""" @@ -1500,7 +1500,7 @@ class Pregel(PregelProtocol): async def abulk_update_state( self, config: RunnableConfig, - updates: list[BulkUpdate], + updates: list[StateUpdate], ) -> RunnableConfig: """Apply updates to the graph state in bulk. Requires a checkpointer to be set.""" @@ -1845,7 +1845,7 @@ class Pregel(PregelProtocol): node `as_node`. If `as_node` is not provided, it will be set to the last node that updated the state, if not ambiguous. """ - return self.bulk_update_state(config, [BulkUpdate(values, as_node)]) + return self.bulk_update_state(config, [StateUpdate(values, as_node)]) async def aupdate_state( self, @@ -1857,7 +1857,7 @@ class Pregel(PregelProtocol): node `as_node`. If `as_node` is not provided, it will be set to the last node that updated the state, if not ambiguous. """ - return await self.abulk_update_state(config, [BulkUpdate(values, as_node)]) + return await self.abulk_update_state(config, [StateUpdate(values, as_node)]) def _defaults( self, diff --git a/libs/langgraph/langgraph/pregel/protocol.py b/libs/langgraph/langgraph/pregel/protocol.py index 43dd55652..9a5f56b76 100644 --- a/libs/langgraph/langgraph/pregel/protocol.py +++ b/libs/langgraph/langgraph/pregel/protocol.py @@ -12,7 +12,7 @@ from langchain_core.runnables import Runnable, RunnableConfig from langchain_core.runnables.graph import Graph as DrawableGraph from typing_extensions import Self -from langgraph.pregel.types import All, BulkUpdate, StateSnapshot, StreamMode +from langgraph.pregel.types import All, StateSnapshot, StateUpdate, StreamMode class PregelProtocol( @@ -73,14 +73,14 @@ class PregelProtocol( def bulk_update_state( self, config: RunnableConfig, - updates: Sequence[BulkUpdate], + updates: Sequence[StateUpdate], ) -> RunnableConfig: ... @abstractmethod async def abulk_update_state( self, config: RunnableConfig, - updates: Sequence[BulkUpdate], + updates: Sequence[StateUpdate], ) -> RunnableConfig: ... @abstractmethod diff --git a/libs/langgraph/langgraph/pregel/types.py b/libs/langgraph/langgraph/pregel/types.py index 251d59034..212c0c4af 100644 --- a/libs/langgraph/langgraph/pregel/types.py +++ b/libs/langgraph/langgraph/pregel/types.py @@ -2,12 +2,12 @@ from langgraph.types import ( All, - BulkUpdate, CachePolicy, PregelExecutableTask, PregelTask, RetryPolicy, StateSnapshot, + StateUpdate, StreamMode, StreamWriter, default_retry_on, @@ -15,7 +15,7 @@ from langgraph.types import ( __all__ = [ "All", - "BulkUpdate", + "StateUpdate", "CachePolicy", "PregelExecutableTask", "PregelTask", diff --git a/libs/langgraph/langgraph/types.py b/libs/langgraph/langgraph/types.py index 7861ab482..00339119d 100644 --- a/libs/langgraph/langgraph/types.py +++ b/libs/langgraph/langgraph/types.py @@ -133,7 +133,7 @@ class Interrupt: when: Literal["during"] = dataclasses.field(default="during", repr=False) -class BulkUpdate(NamedTuple): +class StateUpdate(NamedTuple): values: Optional[dict[str, Any]] as_node: Optional[str] = None