test_similarity_search_with_relevance_score_with_threshold_and_filter() — langchain Function Reference
Architecture documentation for the test_similarity_search_with_relevance_score_with_threshold_and_filter() function in test_similarity_search.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD c6da8c26_7e55_75ab_d659_656bf6606210["test_similarity_search_with_relevance_score_with_threshold_and_filter()"] 5cadf282_3dc9_2b4f_c94f_ca2e1347423e["test_similarity_search.py"] c6da8c26_7e55_75ab_d659_656bf6606210 -->|defined in| 5cadf282_3dc9_2b4f_c94f_ca2e1347423e style c6da8c26_7e55_75ab_d659_656bf6606210 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/qdrant/tests/integration_tests/async_api/test_similarity_search.py lines 195–225
async def test_similarity_search_with_relevance_score_with_threshold_and_filter(
vector_name: str | None,
qdrant_location: str,
) -> None:
"""Test end to end construction and search."""
texts = ["foo", "bar", "baz"]
metadatas = [
{"page": i, "metadata": {"page": i + 1, "pages": [i + 2, -1]}}
for i in range(len(texts))
]
docsearch = Qdrant.from_texts(
texts,
ConsistentFakeEmbeddings(),
metadatas=metadatas,
vector_name=vector_name,
location=qdrant_location,
)
score_threshold = 0.99 # for almost exact match
# test negative filter condition
negative_filter = {"page": 1, "metadata": {"page": 2, "pages": [3]}}
kwargs = {"filter": negative_filter, "score_threshold": score_threshold}
output = docsearch.similarity_search_with_relevance_scores("foo", k=3, **kwargs)
assert len(output) == 0
# test positive filter condition
positive_filter = {"page": 0, "metadata": {"page": 1, "pages": [2]}}
kwargs = {"filter": positive_filter, "score_threshold": score_threshold}
output = await docsearch.asimilarity_search_with_relevance_scores(
"foo", k=3, **kwargs
)
assert len(output) == 1
assert all(score >= score_threshold for _, score in output)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_similarity_search_with_relevance_score_with_threshold_and_filter() do?
test_similarity_search_with_relevance_score_with_threshold_and_filter() is a function in the langchain codebase, defined in libs/partners/qdrant/tests/integration_tests/async_api/test_similarity_search.py.
Where is test_similarity_search_with_relevance_score_with_threshold_and_filter() defined?
test_similarity_search_with_relevance_score_with_threshold_and_filter() is defined in libs/partners/qdrant/tests/integration_tests/async_api/test_similarity_search.py at line 195.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free