test_opposite_vectors() — langchain Function Reference
Architecture documentation for the test_opposite_vectors() function in test_utils.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD be78d4f5_55ca_2145_5d59_3b90db1e3911["test_opposite_vectors()"] 43305d93_a58a_e7db_615b_b8a5a18284ab["TestCosineSimilarity"] be78d4f5_55ca_2145_5d59_3b90db1e3911 -->|defined in| 43305d93_a58a_e7db_615b_b8a5a18284ab style be78d4f5_55ca_2145_5d59_3b90db1e3911 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/vectorstores/test_utils.py lines 33–39
def test_opposite_vectors(self) -> None:
"""Test cosine similarity of opposite vectors."""
x: list[list[float]] = [[1, 2, 3]]
y: list[list[float]] = [[-1, -2, -3]]
result = _cosine_similarity(x, y)
expected = np.array([[-1.0]])
np.testing.assert_array_almost_equal(result, expected)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_opposite_vectors() do?
test_opposite_vectors() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/vectorstores/test_utils.py.
Where is test_opposite_vectors() defined?
test_opposite_vectors() is defined in libs/core/tests/unit_tests/vectorstores/test_utils.py at line 33.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free