asimilarity_search_by_vector() — langchain Function Reference
Architecture documentation for the asimilarity_search_by_vector() function in vectorstores.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 503a0ffb_6858_79c6_16e8_e6b733ac6e1d["asimilarity_search_by_vector()"] bf62db79_4217_463c_798f_6f8528ed0d6e["Qdrant"] 503a0ffb_6858_79c6_16e8_e6b733ac6e1d -->|defined in| bf62db79_4217_463c_798f_6f8528ed0d6e 261d8fc5_aa94_c7fc_9d68_eabaaa5ab85b["asimilarity_search_with_score_by_vector()"] 503a0ffb_6858_79c6_16e8_e6b733ac6e1d -->|calls| 261d8fc5_aa94_c7fc_9d68_eabaaa5ab85b style 503a0ffb_6858_79c6_16e8_e6b733ac6e1d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/qdrant/langchain_qdrant/vectorstores.py lines 482–539
async def asimilarity_search_by_vector(
self,
embedding: list[float],
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[Document]:
"""Return docs most similar to embedding vector.
Args:
embedding: Embedding vector 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 `Document` objects most similar to the query.
"""
results = await self.asimilarity_search_with_score_by_vector(
embedding,
k,
filter=filter,
search_params=search_params,
offset=offset,
score_threshold=score_threshold,
consistency=consistency,
**kwargs,
)
return list(map(itemgetter(0), results))
Domain
Subdomains
Source
Frequently Asked Questions
What does asimilarity_search_by_vector() do?
asimilarity_search_by_vector() is a function in the langchain codebase, defined in libs/partners/qdrant/langchain_qdrant/vectorstores.py.
Where is asimilarity_search_by_vector() defined?
asimilarity_search_by_vector() is defined in libs/partners/qdrant/langchain_qdrant/vectorstores.py at line 482.
What does asimilarity_search_by_vector() call?
asimilarity_search_by_vector() calls 1 function(s): asimilarity_search_with_score_by_vector.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free