test_zero_vector() — langchain Function Reference
Architecture documentation for the test_zero_vector() function in test_utils.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 18e741d2_6267_db40_d968_52ab8125d86f["test_zero_vector()"] 43305d93_a58a_e7db_615b_b8a5a18284ab["TestCosineSimilarity"] 18e741d2_6267_db40_d968_52ab8125d86f -->|defined in| 43305d93_a58a_e7db_615b_b8a5a18284ab style 18e741d2_6267_db40_d968_52ab8125d86f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/vectorstores/test_utils.py lines 41–46
def test_zero_vector(self) -> None:
"""Test cosine similarity with zero vector."""
x: list[list[float]] = [[0, 0, 0]]
y: list[list[float]] = [[1, 2, 3]]
with pytest.raises(ValueError, match="NaN values found"):
_cosine_similarity(x, y)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_zero_vector() do?
test_zero_vector() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/vectorstores/test_utils.py.
Where is test_zero_vector() defined?
test_zero_vector() is defined in libs/core/tests/unit_tests/vectorstores/test_utils.py at line 41.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free