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-coremessagesbaseBaseMessageChunk
    Class●Since v0.1

    BaseMessageChunk

    Message chunk, which can be concatenated with other Message chunks.

    Copy
    BaseMessageChunk(
      self,
      content: str | list[str | dict] | None = None,
      content_blocks: list[types.ContentBlock] | None = None,
      **kwargs: Any = {}
    )

    Bases

    BaseMessage

    Inherited fromBaseMessage

    Attributes

    Acontent: str | list[str | dict]
    —

    The contents of the message.

    Aadditional_kwargs: dict
    —

    Reserved for additional payload data associated with the message.

    Aresponse_metadata: dict
    —

    Examples: response headers, logprobs, token counts, model name.

    Atype: str
    —

    The type of the message. Must be a string that is unique to the message type.

    Aname: str | None
    —

    An optional name for the message.

    Aid: str | None
    —

    An optional unique identifier for the message.

    Amodel_configAcontent_blocks: list[types.ContentBlock]
    —

    Load content blocks from the message content.

    Atext: TextAccessor
    —

    Get the text content of the message as a string.

    Methods

    Mis_lc_serializable
    —

    BaseMessage is serializable.

    Mget_lc_namespace
    —

    Get the namespace of the LangChain object.

    Mpretty_repr
    —

    Get a pretty representation of the message.

    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
    —

    Is this class 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
    —

    Serialize the object to JSON.

    Mto_json_not_implemented
    —

    Serialize a "not implemented" object.

    View source on GitHub