asimilarity_search() — langchain Function Reference
Architecture documentation for the asimilarity_search() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 41bbebb1_b0af_d870_c2bd_efa10cfe64d0["asimilarity_search()"] 6c336ac6_f55c_1ad7_6db3_73dbd71fb625["VectorStore"] 41bbebb1_b0af_d870_c2bd_efa10cfe64d0 -->|defined in| 6c336ac6_f55c_1ad7_6db3_73dbd71fb625 b6e9997b_7438_0977_d32b_03004dbd76a9["asearch()"] b6e9997b_7438_0977_d32b_03004dbd76a9 -->|calls| 41bbebb1_b0af_d870_c2bd_efa10cfe64d0 b39b9863_1373_282b_c5cb_bebb545f3276["_aget_relevant_documents()"] b39b9863_1373_282b_c5cb_bebb545f3276 -->|calls| 41bbebb1_b0af_d870_c2bd_efa10cfe64d0 style 41bbebb1_b0af_d870_c2bd_efa10cfe64d0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/vectorstores/base.py lines 606–622
async def asimilarity_search(
self, query: str, k: int = 4, **kwargs: Any
) -> list[Document]:
"""Async return docs most similar to query.
Args:
query: Input text.
k: Number of `Document` objects to return.
**kwargs: Arguments to pass to the search method.
Returns:
List of `Document` objects most similar to the query.
"""
# This is a temporary workaround to make the similarity search
# asynchronous. The proper solution is to make the similarity search
# asynchronous in the vector store implementations.
return await run_in_executor(None, self.similarity_search, query, k=k, **kwargs)
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does asimilarity_search() do?
asimilarity_search() is a function in the langchain codebase, defined in libs/core/langchain_core/vectorstores/base.py.
Where is asimilarity_search() defined?
asimilarity_search() is defined in libs/core/langchain_core/vectorstores/base.py at line 606.
What calls asimilarity_search()?
asimilarity_search() is called by 2 function(s): _aget_relevant_documents, asearch.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free