Home / Function/ similarity_search_with_score() — langchain Function Reference

similarity_search_with_score() — langchain Function Reference

Architecture documentation for the similarity_search_with_score() function in in_memory.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  0ce5a306_acdd_dcdf_54b7_518eb6c91dee["similarity_search_with_score()"]
  6e491709_d60f_689d_8a1a_c760b54fd120["InMemoryVectorStore"]
  0ce5a306_acdd_dcdf_54b7_518eb6c91dee -->|defined in| 6e491709_d60f_689d_8a1a_c760b54fd120
  07698de6_b0eb_f3e8_73ec_849e4831d737["similarity_search()"]
  07698de6_b0eb_f3e8_73ec_849e4831d737 -->|calls| 0ce5a306_acdd_dcdf_54b7_518eb6c91dee
  bc9209e2_2df4_4845_6a2a_f1a745b98d88["similarity_search_with_score_by_vector()"]
  0ce5a306_acdd_dcdf_54b7_518eb6c91dee -->|calls| bc9209e2_2df4_4845_6a2a_f1a745b98d88
  style 0ce5a306_acdd_dcdf_54b7_518eb6c91dee fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/vectorstores/in_memory.py lines 359–370

    def similarity_search_with_score(
        self,
        query: str,
        k: int = 4,
        **kwargs: Any,
    ) -> list[tuple[Document, float]]:
        embedding = self.embedding.embed_query(query)
        return self.similarity_search_with_score_by_vector(
            embedding,
            k,
            **kwargs,
        )

Subdomains

Frequently Asked Questions

What does similarity_search_with_score() do?
similarity_search_with_score() is a function in the langchain codebase, defined in libs/core/langchain_core/vectorstores/in_memory.py.
Where is similarity_search_with_score() defined?
similarity_search_with_score() is defined in libs/core/langchain_core/vectorstores/in_memory.py at line 359.
What does similarity_search_with_score() call?
similarity_search_with_score() calls 1 function(s): similarity_search_with_score_by_vector.
What calls similarity_search_with_score()?
similarity_search_with_score() is called by 1 function(s): similarity_search.

Analyze Your Own Codebase

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

Try Supermodel Free