Skip to content

The agent engineering platform.

Support similarity_score_threshold retrieval with Chroma (#5655)

Jiayao Yu6a3ceaa3771a
diff --git a/langchain/vectorstores/chroma.py b/langchain/vectorstores/chroma.py
index 646a1508b2..b1927e41d3 100644
--- a/langchain/vectorstores/chroma.py
+++ b/langchain/vectorstores/chroma.py
@@ -232,6 +232,14 @@ class Chroma(VectorStore):
return _results_to_docs_and_scores(results)
+ def _similarity_search_with_relevance_scores(
+ self,
+ query: str,
+ k: int = 4,
+ **kwargs: Any,
+ ) -> List[Tuple[Document, float]]:
+ return self.similarity_search_with_score(query, k)
+
def max_marginal_relevance_search_by_vector(
self,
embedding: List[float],