LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
LangGraph SDK
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Server
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
  • Store
LangGraph Checkpoint Redis
  • Shallow
  • Store
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
  • Cli
LangGraph API
LangGraph CLI
LangGraph CUA
  • Utils
LangGraph Supervisor
LangGraph Swarm
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangGraph
WebChannelsPregelPrebuiltRemote
LangGraph SDK
ClientAuthReactLoggingReact UiServer
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
Store
LangGraph Checkpoint Redis
ShallowStore
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
Cli
LangGraph API
LangGraph CLI
LangGraph CUA
Utils
LangGraph Supervisor
LangGraph Swarm
Language
Theme
JavaScript@langchain/langgraphindexBinaryOperatorAggregate
Class●Since v0.3

BinaryOperatorAggregate

Stores the result of applying a binary operator to the current value and each new value.

Copy
class BinaryOperatorAggregate

Used in Docs

  • Use the graph API

Constructors

constructor
constructor

Properties

property
initialValueFactory: () => ValueType
property
lc_graph_name: string

The name of the channel.

property
operator: BinaryOperator<ValueType, UpdateType>
property
UpdateType: UpdateType
property
value: ValueType | undefined
property
ValueType: ValueType

Methods

method
checkpoint→ [Value, boolean] | undefined

Return a string representation of the channel's current state.

method
consume→ boolean

Mark the current value of the channel as consumed. By default, no-op. A channel can use this method to modify its state, preventing the value from being consumed again.

Returns True if the channel was updated, False otherwise.

method
equals→ boolean

Compare this channel with another channel for equality. Used to determine if two channels with the same key are semantically equivalent. Subclasses should override this method to provide a meaningful comparison.

method
finish→ boolean

Notify the channel that the Pregel run is finishing. By default, no-op. A channel can use this method to modify its state, preventing finish.

Returns True if the channel was updated, False otherwise.

method
fromCheckpoint→ LastValueAfterFinish<Value>

Return a new identical channel, optionally initialized from a checkpoint. Can be thought of as a "restoration" from a checkpoint which is a "snapshot" of the channel's state.

method
get→ Value

Return the current value of the channel.

method
isAvailable→ boolean

Return True if the channel is available (not empty), False otherwise. Subclasses should override this method to provide a more efficient implementation than calling get() and catching EmptyChannelError.

method
update→ boolean

Update the channel's value with the given sequence of updates. The order of the updates in the sequence is arbitrary. This method is called by Pregel for all channels at the end of each step. If there are no updates, it is called with an empty sequence.

Raises InvalidUpdateError if the sequence of updates is invalid. Returns True if the channel was updated, False otherwise.

View source on GitHub