Home / Function/ _check_pkg() — langchain Function Reference

_check_pkg() — langchain Function Reference

Architecture documentation for the _check_pkg() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  598db547_be59_757f_1f1a_e1ba3ef6e690["_check_pkg()"]
  1391827b_23f8_70f5_0b4d_987b860931b3["base.py"]
  598db547_be59_757f_1f1a_e1ba3ef6e690 -->|defined in| 1391827b_23f8_70f5_0b4d_987b860931b3
  7e83c5c7_e60c_4905_0c8c_4645f8596e5b["_init_chat_model_helper()"]
  7e83c5c7_e60c_4905_0c8c_4645f8596e5b -->|calls| 598db547_be59_757f_1f1a_e1ba3ef6e690
  style 598db547_be59_757f_1f1a_e1ba3ef6e690 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chat_models/base.py lines 633–640

def _check_pkg(pkg: str, class_name: str, *, pkg_kebab: str | None = None) -> None:
    if not util.find_spec(pkg):
        pkg_kebab = pkg_kebab if pkg_kebab is not None else pkg.replace("_", "-")
        msg = (
            f"Initializing {class_name} requires the {pkg_kebab} package. "
            f"Please install it with `pip install {pkg_kebab}`"
        )
        raise ImportError(msg)

Domain

Subdomains

Frequently Asked Questions

What does _check_pkg() do?
_check_pkg() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chat_models/base.py.
Where is _check_pkg() defined?
_check_pkg() is defined in libs/langchain/langchain_classic/chat_models/base.py at line 633.
What calls _check_pkg()?
_check_pkg() is called by 1 function(s): _init_chat_model_helper.

Analyze Your Own Codebase

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

Try Supermodel Free