test_search.py — langchain Source File
Architecture documentation for test_search.py, a python file in the langchain codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR f6d0b2c4_7a87_1866_7122_ffbe04fe2109["test_search.py"] 120e2591_3e15_b895_72b6_cb26195e40a6["pytest"] f6d0b2c4_7a87_1866_7122_ffbe04fe2109 --> 120e2591_3e15_b895_72b6_cb26195e40a6 c554676d_b731_47b2_a98f_c1c2d537c0aa["langchain_core.documents"] f6d0b2c4_7a87_1866_7122_ffbe04fe2109 --> c554676d_b731_47b2_a98f_c1c2d537c0aa e9f800f2_8227_1095_42ef_324e02810451["qdrant_client"] f6d0b2c4_7a87_1866_7122_ffbe04fe2109 --> e9f800f2_8227_1095_42ef_324e02810451 77801658_6b3a_bc26_7e54_388e5c04807d["langchain_qdrant"] f6d0b2c4_7a87_1866_7122_ffbe04fe2109 --> 77801658_6b3a_bc26_7e54_388e5c04807d a50ef027_f19e_86a8_94ef_895b4566f94e["tests.integration_tests.common"] f6d0b2c4_7a87_1866_7122_ffbe04fe2109 --> a50ef027_f19e_86a8_94ef_895b4566f94e 513f2bf4_0acd_14e4_0a43_45f7716ce101["tests.integration_tests.fixtures"] f6d0b2c4_7a87_1866_7122_ffbe04fe2109 --> 513f2bf4_0acd_14e4_0a43_45f7716ce101 style f6d0b2c4_7a87_1866_7122_ffbe04fe2109 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import pytest
from langchain_core.documents import Document
from qdrant_client import models
from langchain_qdrant import QdrantVectorStore, RetrievalMode
from tests.integration_tests.common import (
ConsistentFakeEmbeddings,
ConsistentFakeSparseEmbeddings,
assert_documents_equals,
)
from tests.integration_tests.fixtures import qdrant_locations, retrieval_modes
@pytest.mark.parametrize("location", qdrant_locations())
@pytest.mark.parametrize("vector_name", ["", "my-vector"])
@pytest.mark.parametrize("retrieval_mode", retrieval_modes())
@pytest.mark.parametrize("batch_size", [1, 64])
def test_similarity_search(
location: str,
vector_name: str,
retrieval_mode: RetrievalMode,
batch_size: int,
) -> None:
"""Test end to end construction and search."""
texts = ["foo", "bar", "baz"]
docsearch = QdrantVectorStore.from_texts(
texts,
ConsistentFakeEmbeddings(),
location=location,
batch_size=batch_size,
vector_name=vector_name,
retrieval_mode=retrieval_mode,
sparse_embedding=ConsistentFakeSparseEmbeddings(),
)
output = docsearch.similarity_search("foo", k=1)
assert_documents_equals(actual=output, expected=[Document(page_content="foo")])
@pytest.mark.parametrize("location", qdrant_locations())
@pytest.mark.parametrize("content_payload_key", [QdrantVectorStore.CONTENT_KEY, "foo"])
@pytest.mark.parametrize(
"metadata_payload_key", [QdrantVectorStore.METADATA_KEY, "bar"]
)
@pytest.mark.parametrize("vector_name", ["", "my-vector"])
@pytest.mark.parametrize("batch_size", [1, 64])
def test_similarity_search_by_vector(
location: str,
content_payload_key: str,
metadata_payload_key: str,
vector_name: str,
batch_size: int,
) -> None:
"""Test end to end construction and search."""
texts = ["foo", "bar", "baz"]
docsearch = QdrantVectorStore.from_texts(
texts,
ConsistentFakeEmbeddings(),
location=location,
content_payload_key=content_payload_key,
metadata_payload_key=metadata_payload_key,
// ... (354 more lines)
Domain
Subdomains
Functions
- test_as_retriever_sparse_mode()
- test_as_retriever_sparse_mode_with_search_kwargs()
- test_embeddings_property_dense_mode()
- test_embeddings_property_sparse_mode()
- test_relevance_search_with_threshold()
- test_relevance_search_with_threshold_and_filter()
- test_similarity_relevance_search_no_threshold()
- test_similarity_search()
- test_similarity_search_by_vector()
- test_similarity_search_filters()
- test_similarity_search_filters_with_qdrant_filters()
- test_similarity_search_with_score_by_vector()
Dependencies
- langchain_core.documents
- langchain_qdrant
- pytest
- qdrant_client
- tests.integration_tests.common
- tests.integration_tests.fixtures
Source
Frequently Asked Questions
What does test_search.py do?
test_search.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, Serialization subdomain.
What functions are defined in test_search.py?
test_search.py defines 12 function(s): test_as_retriever_sparse_mode, test_as_retriever_sparse_mode_with_search_kwargs, test_embeddings_property_dense_mode, test_embeddings_property_sparse_mode, test_relevance_search_with_threshold, test_relevance_search_with_threshold_and_filter, test_similarity_relevance_search_no_threshold, test_similarity_search, test_similarity_search_by_vector, test_similarity_search_filters, and 2 more.
What does test_search.py depend on?
test_search.py imports 6 module(s): langchain_core.documents, langchain_qdrant, pytest, qdrant_client, tests.integration_tests.common, tests.integration_tests.fixtures.
Where is test_search.py in the architecture?
test_search.py is located at libs/partners/qdrant/tests/integration_tests/qdrant_vector_store/test_search.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/partners/qdrant/tests/integration_tests/qdrant_vector_store).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free