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-coremessagesblock_translatorsPROVIDER_TRANSLATORS
    Attribute●Since v1.0

    PROVIDER_TRANSLATORS

    Map model provider names to translator functions.

    The dictionary maps provider names (e.g. 'openai', 'anthropic') to another dictionary with two keys:

    • 'translate_content': Function to translate AIMessage content.
    • 'translate_content_chunk': Function to translate AIMessageChunk content.

    When calling content_blocks on an AIMessage or AIMessageChunk, if model_provider is set in response_metadata, the corresponding translator functions will be used to parse the content into blocks. Otherwise, best-effort parsing in BaseMessage will be used.

    Copy
    PROVIDER_TRANSLATORS: dict[str, dict[str, Callable[..., list[types.ContentBlock]]]] = {}
    View source on GitHub