Home / Function/ _load_augmentations() — langchain Function Reference

_load_augmentations() — langchain Function Reference

Architecture documentation for the _load_augmentations() function in cli.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  7135fdee_ad01_ad3e_8651_29e017d47837["_load_augmentations()"]
  74c7ffe0_0dd5_5e6a_45ab_950da26de248["cli.py"]
  7135fdee_ad01_ad3e_8651_29e017d47837 -->|defined in| 74c7ffe0_0dd5_5e6a_45ab_950da26de248
  2f2dc685_603e_b75d_c32f_a2fd813a683c["refresh()"]
  2f2dc685_603e_b75d_c32f_a2fd813a683c -->|calls| 7135fdee_ad01_ad3e_8651_29e017d47837
  style 7135fdee_ad01_ad3e_8651_29e017d47837 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/model-profiles/langchain_model_profiles/cli.py lines 57–98

def _load_augmentations(
    data_dir: Path,
) -> tuple[dict[str, Any], dict[str, dict[str, Any]]]:
    """Load augmentations from `profile_augmentations.toml`.

    Args:
        data_dir: Directory containing `profile_augmentations.toml`.

    Returns:
        Tuple of `(provider_augmentations, model_augmentations)`.
    """
    aug_file = data_dir / "profile_augmentations.toml"
    if not aug_file.exists():
        return {}, {}

    try:
        with aug_file.open("rb") as f:
            data = tomllib.load(f)
    except PermissionError:
        msg = f"Permission denied reading augmentations file: {aug_file}"
        print(f"❌ {msg}", file=sys.stderr)
        sys.exit(1)
    except tomllib.TOMLDecodeError as e:
        msg = f"Invalid TOML syntax in augmentations file: {e}"
        print(f"❌ {msg}", file=sys.stderr)
        sys.exit(1)
    except OSError as e:
        msg = f"Failed to read augmentations file: {e}"
        print(f"❌ {msg}", file=sys.stderr)
        sys.exit(1)

    overrides = data.get("overrides", {})
    provider_aug: dict[str, Any] = {}
    model_augs: dict[str, dict[str, Any]] = {}

    for key, value in overrides.items():
        if isinstance(value, dict):
            model_augs[key] = value
        else:
            provider_aug[key] = value

    return provider_aug, model_augs

Domain

Subdomains

Called By

Frequently Asked Questions

What does _load_augmentations() do?
_load_augmentations() is a function in the langchain codebase, defined in libs/model-profiles/langchain_model_profiles/cli.py.
Where is _load_augmentations() defined?
_load_augmentations() is defined in libs/model-profiles/langchain_model_profiles/cli.py at line 57.
What calls _load_augmentations()?
_load_augmentations() is called by 1 function(s): refresh.

Analyze Your Own Codebase

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

Try Supermodel Free