Home / Function/ _import_numpy() — langchain Function Reference

_import_numpy() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  2163fd61_abcf_056d_29f3_39e929c900ae["_import_numpy()"]
  8d2afa68_e16d_c06a_fbe2_08321c12e529["base.py"]
  2163fd61_abcf_056d_29f3_39e929c900ae -->|defined in| 8d2afa68_e16d_c06a_fbe2_08321c12e529
  bf9f9f67_f5f8_2571_2dc1_e266897e01a4["_cosine_distance()"]
  bf9f9f67_f5f8_2571_2dc1_e266897e01a4 -->|calls| 2163fd61_abcf_056d_29f3_39e929c900ae
  8f42f345_74a7_4765_d518_3075171577d4["_manhattan_distance()"]
  8f42f345_74a7_4765_d518_3075171577d4 -->|calls| 2163fd61_abcf_056d_29f3_39e929c900ae
  36454c4e_837d_a1ca_590c_c73bc834adbc["_chebyshev_distance()"]
  36454c4e_837d_a1ca_590c_c73bc834adbc -->|calls| 2163fd61_abcf_056d_29f3_39e929c900ae
  370159a8_cf10_9186_6262_ecc8f7c4d513["_hamming_distance()"]
  370159a8_cf10_9186_6262_ecc8f7c4d513 -->|calls| 2163fd61_abcf_056d_29f3_39e929c900ae
  282ac4a4_c95a_f131_7afb_31fcb1b30fcd["_compute_score()"]
  282ac4a4_c95a_f131_7afb_31fcb1b30fcd -->|calls| 2163fd61_abcf_056d_29f3_39e929c900ae
  12e9b250_b454_000c_4858_a49730fa7a3e["_call()"]
  12e9b250_b454_000c_4858_a49730fa7a3e -->|calls| 2163fd61_abcf_056d_29f3_39e929c900ae
  3d33cf76_6e72_55ec_9bae_9f4a88f05b68["_acall()"]
  3d33cf76_6e72_55ec_9bae_9f4a88f05b68 -->|calls| 2163fd61_abcf_056d_29f3_39e929c900ae
  e21806c4_6820_c652_e4ce_f2bc96e657ee["_call()"]
  e21806c4_6820_c652_e4ce_f2bc96e657ee -->|calls| 2163fd61_abcf_056d_29f3_39e929c900ae
  b604caa2_896d_d94d_72c9_18f743888738["_acall()"]
  b604caa2_896d_d94d_72c9_18f743888738 -->|calls| 2163fd61_abcf_056d_29f3_39e929c900ae
  style 2163fd61_abcf_056d_29f3_39e929c900ae fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/evaluation/embedding_distance/base.py lines 24–30

def _import_numpy() -> Any:
    try:
        import numpy as np
    except ImportError as e:
        msg = "Could not import numpy, please install with `pip install numpy`."
        raise ImportError(msg) from e
    return np

Subdomains

Frequently Asked Questions

What does _import_numpy() do?
_import_numpy() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/evaluation/embedding_distance/base.py.
Where is _import_numpy() defined?
_import_numpy() is defined in libs/langchain/langchain_classic/evaluation/embedding_distance/base.py at line 24.
What calls _import_numpy()?
_import_numpy() is called by 9 function(s): _acall, _acall, _call, _call, _chebyshev_distance, _compute_score, _cosine_distance, _hamming_distance, and 1 more.

Analyze Your Own Codebase

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

Try Supermodel Free