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-core_apipathas_import_path
    Function●Since v0.1

    as_import_path

    Path of the file as a LangChain import exclude langchain top namespace.

    Copy
    as_import_path(
      file: Path | str,
      *,
      suffix: str | None = None,
      relative_to: Path = PACKAGE_DIR
    ) -> str

    Parameters

    NameTypeDescription
    file*Path | str

    The file path to convert.

    suffixstr | None
    Default:None

    An optional suffix to append to the import path.

    relative_toPath
    Default:PACKAGE_DIR

    The base path to make the file path relative to.

    View source on GitHub