Support similarity_score_threshold retrieval with Chroma (#5655)

Fixes https://github.com/hwchase17/langchain/issues/5067

Verified the following code now works correctly:
```
db = Chroma(persist_directory=index_directory(index_name), embedding_function=embeddings)
retriever = db.as_retriever(search_type="similarity_score_threshold", search_kwargs={"score_threshold": 0.4})
docs = retriever.get_relevant_documents(query)
```
searx_updates
Jiayao Yu 12 months ago committed by GitHub
parent 3e45b83065
commit 6a3ceaa377
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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],

Loading…
Cancel
Save