Home / Function/ get_relative_path() — langchain Function Reference

get_relative_path() — langchain Function Reference

Architecture documentation for the get_relative_path() function in path.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  bb6ebc4e_1ab9_415b_6404_65ee2a0b9aaa["get_relative_path()"]
  4bb957a1_a6a7_9d55_e08d_eca787aa72ef["path.py"]
  bb6ebc4e_1ab9_415b_6404_65ee2a0b9aaa -->|defined in| 4bb957a1_a6a7_9d55_e08d_eca787aa72ef
  ae4c470b_6a78_cf1e_bc0e_91bb094a921e["as_import_path()"]
  ae4c470b_6a78_cf1e_bc0e_91bb094a921e -->|calls| bb6ebc4e_1ab9_415b_6404_65ee2a0b9aaa
  style bb6ebc4e_1ab9_415b_6404_65ee2a0b9aaa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/_api/path.py lines 11–23

def get_relative_path(file: Path | str, *, relative_to: Path = PACKAGE_DIR) -> str:
    """Get the path of the file as a relative path to the package directory.

    Args:
        file: The file path to convert.
        relative_to: The base path to make the file path relative to.

    Returns:
        The relative path as a string.
    """
    if isinstance(file, str):
        file = Path(file)
    return str(file.relative_to(relative_to))

Domain

Subdomains

Called By

Frequently Asked Questions

What does get_relative_path() do?
get_relative_path() is a function in the langchain codebase, defined in libs/core/langchain_core/_api/path.py.
Where is get_relative_path() defined?
get_relative_path() is defined in libs/core/langchain_core/_api/path.py at line 11.
What calls get_relative_path()?
get_relative_path() is called by 1 function(s): as_import_path.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free