Home / Function/ similarity_search_with_score_by_vector() — langchain Function Reference

similarity_search_with_score_by_vector() — langchain Function Reference

Architecture documentation for the similarity_search_with_score_by_vector() function in qdrant.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  3b9e0613_eecd_e688_0717_98be6124f6d3["similarity_search_with_score_by_vector()"]
  671b47a0_cdd3_a89d_e90f_0631a4bd67d3["QdrantVectorStore"]
  3b9e0613_eecd_e688_0717_98be6124f6d3 -->|defined in| 671b47a0_cdd3_a89d_e90f_0631a4bd67d3
  22b00de6_c2f6_1560_4a0f_db959470c356["similarity_search_by_vector()"]
  22b00de6_c2f6_1560_4a0f_db959470c356 -->|calls| 3b9e0613_eecd_e688_0717_98be6124f6d3
  ee735a53_d6e2_76d0_6fad_19bdebf2f0f2["_validate_collection_for_dense()"]
  3b9e0613_eecd_e688_0717_98be6124f6d3 -->|calls| ee735a53_d6e2_76d0_6fad_19bdebf2f0f2
  a55135fe_576d_57f4_200f_c6402baada22["_document_from_point()"]
  3b9e0613_eecd_e688_0717_98be6124f6d3 -->|calls| a55135fe_576d_57f4_200f_c6402baada22
  style 3b9e0613_eecd_e688_0717_98be6124f6d3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/qdrant/langchain_qdrant/qdrant.py lines 645–697

    def similarity_search_with_score_by_vector(
        self,
        embedding: list[float],
        k: int = 4,
        filter: models.Filter | 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 embedding vector.

        Returns:
            List of `Document` objects most similar to the query and distance for each.

        """
        qdrant_filter = filter

        self._validate_collection_for_dense(
            client=self.client,
            collection_name=self.collection_name,
            vector_name=self.vector_name,
            distance=self.distance,
            dense_embeddings=embedding,
        )
        results = self.client.query_points(
            collection_name=self.collection_name,
            query=embedding,
            using=self.vector_name,
            query_filter=qdrant_filter,
            search_params=search_params,
            limit=k,
            offset=offset,
            with_payload=True,
            with_vectors=False,
            score_threshold=score_threshold,
            consistency=consistency,
            **kwargs,
        ).points

        return [
            (
                self._document_from_point(
                    result,
                    self.collection_name,
                    self.content_payload_key,
                    self.metadata_payload_key,
                ),
                result.score,
            )
            for result in results
        ]

Domain

Subdomains

Frequently Asked Questions

What does similarity_search_with_score_by_vector() do?
similarity_search_with_score_by_vector() is a function in the langchain codebase, defined in libs/partners/qdrant/langchain_qdrant/qdrant.py.
Where is similarity_search_with_score_by_vector() defined?
similarity_search_with_score_by_vector() is defined in libs/partners/qdrant/langchain_qdrant/qdrant.py at line 645.
What does similarity_search_with_score_by_vector() call?
similarity_search_with_score_by_vector() calls 2 function(s): _document_from_point, _validate_collection_for_dense.
What calls similarity_search_with_score_by_vector()?
similarity_search_with_score_by_vector() is called by 1 function(s): similarity_search_by_vector.

Analyze Your Own Codebase

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

Try Supermodel Free