LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • MCP Adapters
    Standard Tests
    Text Splitters
    • Overview
    • Agents
    • Callbacks
    • Chains
    • Chat models
    • Embeddings
    • Evaluation
    • Globals
    • Hub
    • Memory
    • Output parsers
    • Retrievers
    • Runnables
    • LangSmith
    • Storage
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    MCP Adapters
    Standard Tests
    Text Splitters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Language
    Theme
    Pythonlangchain-classic_apimodule_importcreate_importer
    Functionā—Since v1.0

    create_importer

    Copy
    create_importer(
      package: str,
      *,
      module_lookup: dict[str, str] | None
    View source on GitHub
    =
    None
    ,
    deprecated_lookups
    :
    dict
    [
    str
    ,
    str
    ]
    |
    None
    =
    None
    ,
    fallback_module
    :
    str
    |
    None
    =
    None
    )
    ->
    Callable
    [
    [
    str
    ]
    ,
    Any
    ]

    Parameters

    NameTypeDescription
    package*str

    Current package. Use __package__

    module_lookupdict[str, str] | None
    Default:None

    Maps name of object to the module where it is defined. e.g.,

    {
        "MyDocumentLoader": (
            "langchain_community.document_loaders.my_document_loader"
        )
    }
    deprecated_lookupsdict[str, str] | None
    Default:None
    fallback_modulestr | None
    Default:None

    Create a function that helps retrieve objects from their new locations.

    The goal of this function is to help users transition from deprecated imports to new imports.

    The function will raise deprecation warning on loops using deprecated_lookups or fallback_module.

    Module lookups will import without deprecation warnings (used to speed up imports from large namespaces like llms or chat models).

    This function should ideally only be used with deprecated imports not with existing imports that are valid, as in addition to raising deprecation warnings the dynamic imports can create other issues for developers (e.g., loss of type information, IDE support for going to definition etc).

    Same as module look up, but will raise deprecation warnings.

    Module to import from if the object is not found in module_lookup or if module_lookup is not provided.