test_similarity_search.py — langchain Source File
Architecture documentation for test_similarity_search.py, a python file in the langchain codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 5cadf282_3dc9_2b4f_c94f_ca2e1347423e["test_similarity_search.py"] eea920d0_5f0d_7728_8367_275e1830e552["numpy"] 5cadf282_3dc9_2b4f_c94f_ca2e1347423e --> eea920d0_5f0d_7728_8367_275e1830e552 f69d6389_263d_68a4_7fbf_f14c0602a9ba["pytest"] 5cadf282_3dc9_2b4f_c94f_ca2e1347423e --> f69d6389_263d_68a4_7fbf_f14c0602a9ba 6a98b0a5_5607_0043_2e22_a46a464c2d62["langchain_core.documents"] 5cadf282_3dc9_2b4f_c94f_ca2e1347423e --> 6a98b0a5_5607_0043_2e22_a46a464c2d62 67883832_8f96_6ce0_6b88_0267f86654f8["langchain_qdrant"] 5cadf282_3dc9_2b4f_c94f_ca2e1347423e --> 67883832_8f96_6ce0_6b88_0267f86654f8 b499c7a8_2fb9_cfc0_4cf2_8686096d49bc["tests.integration_tests.common"] 5cadf282_3dc9_2b4f_c94f_ca2e1347423e --> b499c7a8_2fb9_cfc0_4cf2_8686096d49bc 85cb53ff_3599_0e5f_1446_bc1cd58ba408["tests.integration_tests.fixtures"] 5cadf282_3dc9_2b4f_c94f_ca2e1347423e --> 85cb53ff_3599_0e5f_1446_bc1cd58ba408 5e892d73_52fe_a9b9_7e5f_abb366ac08b8["qdrant_client.http"] 5cadf282_3dc9_2b4f_c94f_ca2e1347423e --> 5e892d73_52fe_a9b9_7e5f_abb366ac08b8 style 5cadf282_3dc9_2b4f_c94f_ca2e1347423e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from __future__ import annotations
import numpy as np
import pytest # type: ignore[import-not-found]
from langchain_core.documents import Document
from langchain_qdrant import Qdrant
from tests.integration_tests.common import (
ConsistentFakeEmbeddings,
assert_documents_equals,
)
from tests.integration_tests.fixtures import qdrant_locations
@pytest.mark.parametrize("batch_size", [1, 64])
@pytest.mark.parametrize("content_payload_key", [Qdrant.CONTENT_KEY, "foo"])
@pytest.mark.parametrize("metadata_payload_key", [Qdrant.METADATA_KEY, "bar"])
@pytest.mark.parametrize("vector_name", [None, "my-vector"])
@pytest.mark.parametrize("qdrant_location", qdrant_locations())
async def test_qdrant_similarity_search(
batch_size: int,
content_payload_key: str,
metadata_payload_key: str,
vector_name: str | None,
qdrant_location: str,
) -> None:
"""Test end to end construction and search."""
texts = ["foo", "bar", "baz"]
docsearch = Qdrant.from_texts(
texts,
ConsistentFakeEmbeddings(),
content_payload_key=content_payload_key,
metadata_payload_key=metadata_payload_key,
batch_size=batch_size,
vector_name=vector_name,
location=qdrant_location,
)
output = await docsearch.asimilarity_search("foo", k=1)
assert_documents_equals(output, [Document(page_content="foo")])
@pytest.mark.parametrize("batch_size", [1, 64])
@pytest.mark.parametrize("content_payload_key", [Qdrant.CONTENT_KEY, "foo"])
@pytest.mark.parametrize("metadata_payload_key", [Qdrant.METADATA_KEY, "bar"])
@pytest.mark.parametrize("vector_name", [None, "my-vector"])
@pytest.mark.parametrize("qdrant_location", qdrant_locations())
async def test_qdrant_similarity_search_by_vector(
batch_size: int,
content_payload_key: str,
metadata_payload_key: str,
vector_name: str | None,
qdrant_location: str,
) -> None:
"""Test end to end construction and search."""
texts = ["foo", "bar", "baz"]
docsearch = Qdrant.from_texts(
texts,
ConsistentFakeEmbeddings(),
content_payload_key=content_payload_key,
metadata_payload_key=metadata_payload_key,
// ... (246 more lines)
Domain
Subdomains
Functions
- test_qdrant_similarity_search()
- test_qdrant_similarity_search_by_vector()
- test_qdrant_similarity_search_filters()
- test_qdrant_similarity_search_filters_with_qdrant_filters()
- test_qdrant_similarity_search_with_relevance_score_no_threshold()
- test_qdrant_similarity_search_with_relevance_score_with_threshold()
- test_qdrant_similarity_search_with_relevance_scores()
- test_qdrant_similarity_search_with_score_by_vector()
- test_similarity_search_with_relevance_score_with_threshold_and_filter()
Dependencies
- langchain_core.documents
- langchain_qdrant
- numpy
- pytest
- qdrant_client.http
- tests.integration_tests.common
- tests.integration_tests.fixtures
Source
Frequently Asked Questions
What does test_similarity_search.py do?
test_similarity_search.py is a source file in the langchain codebase, written in python. It belongs to the LangChainCore domain, ApiManagement subdomain.
What functions are defined in test_similarity_search.py?
test_similarity_search.py defines 9 function(s): test_qdrant_similarity_search, test_qdrant_similarity_search_by_vector, test_qdrant_similarity_search_filters, test_qdrant_similarity_search_filters_with_qdrant_filters, test_qdrant_similarity_search_with_relevance_score_no_threshold, test_qdrant_similarity_search_with_relevance_score_with_threshold, test_qdrant_similarity_search_with_relevance_scores, test_qdrant_similarity_search_with_score_by_vector, test_similarity_search_with_relevance_score_with_threshold_and_filter.
What does test_similarity_search.py depend on?
test_similarity_search.py imports 7 module(s): langchain_core.documents, langchain_qdrant, numpy, pytest, qdrant_client.http, tests.integration_tests.common, tests.integration_tests.fixtures.
Where is test_similarity_search.py in the architecture?
test_similarity_search.py is located at libs/partners/qdrant/tests/integration_tests/async_api/test_similarity_search.py (domain: LangChainCore, subdomain: ApiManagement, directory: libs/partners/qdrant/tests/integration_tests/async_api).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free