mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-31 12:19:58 +02:00
Rename to StateUpdate
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,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",
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user