Thanks to visit codestin.com
Credit goes to langchain-ai.github.io

LangGraph.js API Reference
    Preparing search index...

    Class Topic<Value>

    A configurable PubSub Topic.

    Type Parameters

    • Value
    Index

    Constructors

    • Type Parameters

      • Value

      Parameters

      • Optionalfields: { accumulate?: boolean; unique?: boolean }
        • Optionalaccumulate?: boolean

          Whether to accumulate values across steps. If false, the channel will be emptied after each step.

        • Optionalunique?: boolean

          Whether to only add unique values to the topic. If true, only unique values (using reference equality) will be added to the topic.

      Returns Topic<Value>

    Properties

    accumulate: boolean
    lc_graph_name: string

    The name of the channel.

    seen: Set<Value>
    unique: boolean
    UpdateType: Value | Value[]
    values: Value[]
    ValueType: Value[]

    Methods

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

      Returns [Value[], Value[]]

      if the channel is empty (never updated yet), or doesn't support checkpoints.

    • 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.

      Returns 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.

      Returns boolean

    • 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.

      Parameters

      Returns this

    • Return the current value of the channel.

      Returns Value[]

      if the channel is empty (never updated yet).

    • 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.

      Returns 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.

      Parameters

      Returns boolean

      if the sequence of updates is invalid.