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-coremessagesbaseTextAccessor
    Class●Since v1.0

    TextAccessor

    Copy
    TextAccessor()

    Bases

    str
    View source on GitHub

    String-like object that supports both property and method access patterns.

    Exists to maintain backward compatibility while transitioning from method-based to property-based text access in message objects. In LangChain <v1.0, message text was accessed via .text() method calls. In v1.0=<, the preferred pattern is property access via .text.

    Rather than breaking existing code immediately, TextAccessor allows both patterns:

    • Modern property access: message.text (returns string directly)
    • Legacy method access: message.text() (callable, emits deprecation warning)