langchain.js
    Preparing search index...
    • Manually push a message to a message stream.

      This is useful when you need to push a manually created message before the node has finished executing.

      When a message is pushed, it will be automatically persisted to the state after the node has finished executing. To disable persisting, set options.stateKey to null.

      Parameters

      • message: BaseMessage<MessageStructure, MessageType> | BaseMessageLike

        The message to push. The message must have an ID set, otherwise an error will be thrown.

      • Optionaloptions: RunnableConfig<Record<string, any>> & { stateKey?: null | string }

        RunnableConfig / Runtime coming from node context.

        • OptionalstateKey?: null | string

          The key of the state to push the message to. Set to null to avoid persisting.

          "messages"
          

      Returns BaseMessage<MessageStructure, MessageType>