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

    TextContentBlock

    Text output from a LLM.

    This typically represents the main text content of a message, such as the response from a language model or the text of a user message.

    Factory function

    create_text_block may also be used as a factory to create a TextContentBlock. Benefits include:

    • Automatic ID generation (when not provided)
    • Required arguments strictly validated at creation time
    Copy
    TextContentBlock()

    Bases

    TypedDict

    Constructors

    constructor
    __init__
    NameType
    typeLiteral['text']
    idNotRequired[str]
    textstr
    annotationsNotRequired[list[Annotation]]
    indexNotRequired[int | str]
    extrasNotRequired[dict[str, Any]]

    Attributes

    attribute
    type: Literal['text']

    Type of the content block. Used for discrimination.

    attribute
    id: NotRequired[str]

    Unique identifier for this content block.

    Either:

    • Generated by the provider
    • Generated by LangChain upon creation (UUID4 prefixed with 'lc_'))
    attribute
    text: str

    Block text.

    attribute
    annotations: NotRequired[list[Annotation]]

    Citations and other annotations.

    attribute
    index: NotRequired[int | str]

    Index of block in aggregate response. Used during streaming.

    attribute
    extras: NotRequired[dict[str, Any]]

    Provider-specific metadata.

    View source on GitHub