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
  a5eb1357_0d90_510f_8e72_385214be9195["_check_pkg()"]
  76380b72_77fe_25f0_4fc9_0d116ee2433c["base.py"]
  a5eb1357_0d90_510f_8e72_385214be9195 -->|defined in| 76380b72_77fe_25f0_4fc9_0d116ee2433c
  2954192c_8016_8ddf_9323_43285db4aa1b["init_embeddings()"]
  2954192c_8016_8ddf_9323_43285db4aa1b -->|calls| a5eb1357_0d90_510f_8e72_385214be9195
  style a5eb1357_0d90_510f_8e72_385214be9195 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/embeddings/base.py lines 118–125

def _check_pkg(pkg: str) -> None:
    """Check if a package is installed."""
    if not util.find_spec(pkg):
        msg = (
            f"Could not import {pkg} python package. "
            f"Please install it with `pip install {pkg}`"
        )
        raise ImportError(msg)

Domain

Subdomains

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free