asimilarity_search_with_score() — langchain Function Reference
Architecture documentation for the asimilarity_search_with_score() function in vectorstores.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 0bfb6a9a_e62a_ca13_35c1_984eee7bf4a4["asimilarity_search_with_score()"] 2d095452_70a7_4606_a1b1_4650d16b5343["Qdrant"] 0bfb6a9a_e62a_ca13_35c1_984eee7bf4a4 -->|defined in| 2d095452_70a7_4606_a1b1_4650d16b5343 7b74db38_56d1_e947_f07b_e15eaecc481e["asimilarity_search()"] 7b74db38_56d1_e947_f07b_e15eaecc481e -->|calls| 0bfb6a9a_e62a_ca13_35c1_984eee7bf4a4 796f155d_8fcc_1034_c7ea_35e77a763ac6["_asimilarity_search_with_relevance_scores()"] 796f155d_8fcc_1034_c7ea_35e77a763ac6 -->|calls| 0bfb6a9a_e62a_ca13_35c1_984eee7bf4a4 b6daed04_d43f_da3b_07c7_c1835c32cf84["_aembed_query()"] 0bfb6a9a_e62a_ca13_35c1_984eee7bf4a4 -->|calls| b6daed04_d43f_da3b_07c7_c1835c32cf84 f3b0da94_b278_98e6_0a3b_a9cd8aa11516["asimilarity_search_with_score_by_vector()"] 0bfb6a9a_e62a_ca13_35c1_984eee7bf4a4 -->|calls| f3b0da94_b278_98e6_0a3b_a9cd8aa11516 style 0bfb6a9a_e62a_ca13_35c1_984eee7bf4a4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/qdrant/langchain_qdrant/vectorstores.py lines 364–421
async def asimilarity_search_with_score(
self,
query: str,
k: int = 4,
filter: MetadataFilter | None = None, # noqa: A002
search_params: models.SearchParams | None = None,
offset: int = 0,
score_threshold: float | None = None,
consistency: models.ReadConsistency | None = None,
**kwargs: Any,
) -> list[tuple[Document, float]]:
"""Return docs most similar to query.
Args:
query: Text to look up documents similar to.
k: Number of Documents to return.
filter: Filter by metadata.
search_params: Additional search params
offset:
Offset of the first result to return.
May be used to paginate results.
Note: large offset values may cause performance issues.
score_threshold:
Define a minimal score threshold for the result.
If defined, less similar results will not be returned.
Score of the returned result might be higher or smaller than the
threshold depending on the Distance function used.
E.g. for cosine similarity only higher scores will be returned.
consistency:
Read consistency of the search. Defines how many replicas should be
queried before returning the result.
Values:
- int - number of replicas to query, values should present in all
queried replicas
- 'majority' - query all replicas, but return values present in the
majority of replicas
- 'quorum' - query the majority of replicas, return values present in
all of them
- 'all' - query all replicas, and return values present in all replicas
**kwargs:
Any other named arguments to pass through to
AsyncQdrantClient.Search().
Returns:
List of documents most similar to the query text and distance for each.
"""
query_embedding = await self._aembed_query(query)
return await self.asimilarity_search_with_score_by_vector(
query_embedding,
k,
filter=filter,
search_params=search_params,
offset=offset,
score_threshold=score_threshold,
consistency=consistency,
**kwargs,
)
Domain
Subdomains
Source
Frequently Asked Questions
What does asimilarity_search_with_score() do?
asimilarity_search_with_score() is a function in the langchain codebase, defined in libs/partners/qdrant/langchain_qdrant/vectorstores.py.
Where is asimilarity_search_with_score() defined?
asimilarity_search_with_score() is defined in libs/partners/qdrant/langchain_qdrant/vectorstores.py at line 364.
What does asimilarity_search_with_score() call?
asimilarity_search_with_score() calls 2 function(s): _aembed_query, asimilarity_search_with_score_by_vector.
What calls asimilarity_search_with_score()?
asimilarity_search_with_score() is called by 2 function(s): _asimilarity_search_with_relevance_scores, asimilarity_search.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free