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-coreloadserializableSerializableget_lc_namespace
    Method●Since v0.1

    get_lc_namespace

    Get the namespace of the LangChain object.

    The default implementation splits cls.__module__ on '.', e.g. langchain_openai.chat_models becomes ["langchain_openai", "chat_models"]. This value is used by lc_id to build the serialization identifier.

    New partner packages should not override this method. The default behavior is correct for any class whose module path already reflects its package name. Some older packages (e.g. langchain-openai, langchain-anthropic) override it to return a legacy-style namespace like ["langchain", "chat_models", "openai"], matching the module paths that existed before those integrations were split out of the main langchain package. Those overrides are kept for backwards-compatible deserialization; new packages should not copy them.

    Deserialization mapping is handled separately by SERIALIZABLE_MAPPING in langchain_core.load.mapping.

    Copy
    get_lc_namespace(
        cls,
    ) -> list[str]
    View source on GitHub