Submission checklist
Package (Required)
Related Issues / PRs
No response
Reproduction Steps / Example Code (Python)
from langchain_core.embeddings import FakeEmbeddings
from langchain_qdrant import Qdrant
texts = ["foo", "bar", "baz"]
# Under Euclid distance strategy:
# Perfect match distance is 0.0, relevance score should normalize to 1.0 (1.0 - distance/sqrt(2))
docsearch = Qdrant.from_texts(
texts,
FakeEmbeddings(size=10),
location=":memory:",
distance_func="Euclid",
)
results = docsearch.similarity_search_with_relevance_scores("foo", k=3)
print("Returned relevance scores:")
for doc, score in results:
print(f"Content: '{doc.page_content}', Relevance Score: {score}")
Error Message and Stack Trace (if applicable)
Description
Description
Problem
When calling similarity_search_with_relevance_scores or asimilarity_search_with_relevance_scores on the legacy Qdrant vector store class, the returned scores are raw distances rather than normalized relevance scores in the [0, 1] range. For instance, an exact match with Euclidean distance returns 0.0 (which is the raw distance) instead of 1.0 (which is the normalized relevance score).
Root cause
In libs/partners/qdrant/langchain_qdrant/vectorstores.py, the legacy Qdrant class implements the _select_relevance_score_fn method to return distance-specific normalization functions (e.g., for COSINE, DOT, or EUCLID distance metrics). However, the class overrode _similarity_search_with_relevance_scores and _asimilarity_search_with_relevance_scores to directly call and return similarity_search_with_score and asimilarity_search_with_score outputs. This bypassed the relevance normalization pipeline entirely.
Suggested fix
Remove the overridden _similarity_search_with_relevance_scores and _asimilarity_search_with_relevance_scores methods from the legacy Qdrant class so it correctly inherits the base VectorStore class implementation, which maps raw scores through _select_relevance_score_fn.
(Note: The new QdrantVectorStore already correctly inherits from the base class and is unaffected by this issue.)
System Info
System Information
OS: Linux
OS Version: #1 SMP PREEMPT_DYNAMIC Thu May 21 18:06:59 UTC 2026
Python Version: 3.13.5 | packaged by Anaconda, Inc. | (main, Jun 12 2025, 16:09:02) [GCC 11.2.0]
Package Information
langchain_core: 1.4.8
langsmith: 0.8.18
langchain_protocol: 0.0.18
langchain_qdrant: 1.1.0
langchain_tests: 1.1.9
Optional packages not installed
deepagents
deepagents-cli
Other Dependencies
httpx: 0.28.1
jsonpatch: 1.33
numpy: 2.3.3
orjson: 3.11.6
packaging: 25.0
pydantic: 2.12.1
pytest: 9.0.3
pytest-asyncio: 1.3.0
pytest-benchmark: 5.0.1
pytest-codspeed: 4.0.0
pytest-recording: 0.13.4
pytest-socket: 0.7.0
pyyaml: 6.0.3
qdrant-client: 1.15.1
requests: 2.34.0
requests-toolbelt: 1.0.0
rich: 14.1.0
syrupy: 5.1.0
tenacity: 9.1.2
typing-extensions: 4.15.0
uuid-utils: 0.12.0
vcrpy: 8.2.1
websockets: 16.0
wrapt: 1.17.3
xxhash: 3.6.0
zstandard: 0.25.0
Submission checklist
Package (Required)
Related Issues / PRs
No response
Reproduction Steps / Example Code (Python)
Error Message and Stack Trace (if applicable)
Description
Description
Problem
When calling
similarity_search_with_relevance_scoresorasimilarity_search_with_relevance_scoreson the legacyQdrantvector store class, the returned scores are raw distances rather than normalized relevance scores in the[0, 1]range. For instance, an exact match with Euclidean distance returns0.0(which is the raw distance) instead of1.0(which is the normalized relevance score).Root cause
In
libs/partners/qdrant/langchain_qdrant/vectorstores.py, the legacyQdrantclass implements the_select_relevance_score_fnmethod to return distance-specific normalization functions (e.g., forCOSINE,DOT, orEUCLIDdistance metrics). However, the class overrode_similarity_search_with_relevance_scoresand_asimilarity_search_with_relevance_scoresto directly call and returnsimilarity_search_with_scoreandasimilarity_search_with_scoreoutputs. This bypassed the relevance normalization pipeline entirely.Suggested fix
Remove the overridden
_similarity_search_with_relevance_scoresand_asimilarity_search_with_relevance_scoresmethods from the legacyQdrantclass so it correctly inherits the baseVectorStoreclass implementation, which maps raw scores through_select_relevance_score_fn.(Note: The new
QdrantVectorStorealready correctly inherits from the base class and is unaffected by this issue.)System Info
System Information
Package Information
Optional packages not installed
Other Dependencies