Home / Function/ asimilarity_search_by_vector() — langchain Function Reference

asimilarity_search_by_vector() — langchain Function Reference

Architecture documentation for the asimilarity_search_by_vector() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  72d081a4_ee4a_8702_6c32_5ed19a2f7457["asimilarity_search_by_vector()"]
  6c336ac6_f55c_1ad7_6db3_73dbd71fb625["VectorStore"]
  72d081a4_ee4a_8702_6c32_5ed19a2f7457 -->|defined in| 6c336ac6_f55c_1ad7_6db3_73dbd71fb625
  style 72d081a4_ee4a_8702_6c32_5ed19a2f7457 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/vectorstores/base.py lines 639–657

    async def asimilarity_search_by_vector(
        self, embedding: list[float], k: int = 4, **kwargs: Any
    ) -> list[Document]:
        """Async return docs most similar to embedding vector.

        Args:
            embedding: Embedding to look up documents similar to.
            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 vector.
        """
        # 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_by_vector, embedding, k=k, **kwargs
        )

Subdomains

Frequently Asked Questions

What does asimilarity_search_by_vector() do?
asimilarity_search_by_vector() is a function in the langchain codebase, defined in libs/core/langchain_core/vectorstores/base.py.
Where is asimilarity_search_by_vector() defined?
asimilarity_search_by_vector() is defined in libs/core/langchain_core/vectorstores/base.py at line 639.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free