as_import_path() — langchain Function Reference
Architecture documentation for the as_import_path() function in path.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD ae4c470b_6a78_cf1e_bc0e_91bb094a921e["as_import_path()"] 4bb957a1_a6a7_9d55_e08d_eca787aa72ef["path.py"] ae4c470b_6a78_cf1e_bc0e_91bb094a921e -->|defined in| 4bb957a1_a6a7_9d55_e08d_eca787aa72ef bb6ebc4e_1ab9_415b_6404_65ee2a0b9aaa["get_relative_path()"] ae4c470b_6a78_cf1e_bc0e_91bb094a921e -->|calls| bb6ebc4e_1ab9_415b_6404_65ee2a0b9aaa style ae4c470b_6a78_cf1e_bc0e_91bb094a921e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/_api/path.py lines 26–50
def as_import_path(
file: Path | str,
*,
suffix: str | None = None,
relative_to: Path = PACKAGE_DIR,
) -> str:
"""Path of the file as a LangChain import exclude langchain top namespace.
Args:
file: The file path to convert.
suffix: An optional suffix to append to the import path.
relative_to: The base path to make the file path relative to.
Returns:
The import path as a string.
"""
if isinstance(file, str):
file = Path(file)
path = get_relative_path(file, relative_to=relative_to)
if file.is_file():
path = path[: -len(file.suffix)]
import_path = path.replace(SEPARATOR, ".")
if suffix:
import_path += "." + suffix
return import_path
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does as_import_path() do?
as_import_path() is a function in the langchain codebase, defined in libs/core/langchain_core/_api/path.py.
Where is as_import_path() defined?
as_import_path() is defined in libs/core/langchain_core/_api/path.py at line 26.
What does as_import_path() call?
as_import_path() calls 1 function(s): get_relative_path.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free