Rename to StateUpdate

This commit is contained in:
Tat Dat Duong
2025-03-19 14:22:25 +01:00
parent 199ab46429
commit 4b1d6d2aeb
4 changed files with 11 additions and 11 deletions
+5 -5
View File
@@ -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,
+3 -3
View File
@@ -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
+2 -2
View File
@@ -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",
+1 -1
View File
@@ -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