From 0a7a2b99b502b1b6d91b367871286782bc459892 Mon Sep 17 00:00:00 2001 From: uyhcire <27897696+uyhcire@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:18:19 -0700 Subject: [PATCH] Fix Chroma integration failing when there are less than 4 items in the collection (#3674) The code was failing to decrement the `n_results` kwarg passed to `query(...)` --- langchain/vectorstores/chroma.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain/vectorstores/chroma.py b/langchain/vectorstores/chroma.py index 43ce6c0a..d3b4cfbc 100644 --- a/langchain/vectorstores/chroma.py +++ b/langchain/vectorstores/chroma.py @@ -111,7 +111,7 @@ class Chroma(VectorStore): return self._collection.query( query_texts=query_texts, query_embeddings=query_embeddings, - n_results=n_results, + n_results=i, where=where, ) except chromadb.errors.NotEnoughElementsException: