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-coremessagesbaseBaseMessagetext
    Attribute●Since v0.3

    text

    Get the text content of the message as a string.

    Can be used as both property (message.text) and method (message.text()).

    Handles both string and list content types (e.g. for content blocks). Only extracts blocks with type: 'text'; other block types are ignored.

    Deprecated

    As of langchain-core 1.0.0, calling .text() as a method is deprecated. Use .text as a property instead. This method will be removed in 2.0.0.

    Copy
    text: TextAccessor
    View source on GitHub