LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-coremessagesmodifierRemoveMessage
    Class●Since v0.2

    RemoveMessage

    Message responsible for deleting other messages.

    Copy
    RemoveMessage(
        self,
        id: str,
        **kwargs: Any = {},
    )

    Bases

    BaseMessage

    Used in Docs

    • Short-term memory

    Parameters

    NameTypeDescription
    id*str

    The ID of the message to remove.

    **kwargsAny
    Default:{}

    Additional fields to pass to the message.

    Constructors

    constructor
    __init__
    NameType
    idstr

    Attributes

    attribute
    type: Literal['remove']

    The type of the message (used for serialization).

    Inherited fromBaseMessage

    Attributes

    Acontent: str | list[str | dict]
    —

    The contents of the message.

    Aadditional_kwargs: dict
    —

    Currently inherited from BaseMessage, but not used.

    Aresponse_metadata: dict
    —

    Currently inherited from BaseMessage, but not used.

    Aname: str
    —

    The name of the function.

    Aid: str
    —

    The unique identifier of the node.

    Amodel_configAcontent_blocks: list[types.ContentBlock]
    —

    Return standard, typed ContentBlock dicts from the message.

    Atext: str
    —

    Prompt text.

    Methods

    Mis_lc_serializable
    —

    Return True as this class is serializable.

    Mget_lc_namespace
    —

    Get the namespace of the LangChain object.

    Mpretty_repr
    —

    Return a pretty representation of the message for display.

    Mpretty_print
    —

    Print a pretty representation of the message.

    Inherited fromSerializable

    Attributes

    Alc_secrets: dict[str, str]
    —

    A map of constructor argument names to secret ids.

    Alc_attributes: dict
    —

    List of attribute names that should be included in the serialized kwargs.

    Amodel_config

    Methods

    Mis_lc_serializable
    —

    Return True as this class is serializable.

    Mget_lc_namespace
    —

    Get the namespace of the LangChain object.

    Mlc_id
    —

    Return a unique identifier for this class for serialization purposes.

    Mto_json
    —

    Convert the graph to a JSON-serializable format.

    Mto_json_not_implemented
    —

    Serialize a "not implemented" object.

    View source on GitHub