Skip to content

The agent engineering platform.

Fix Chroma integration failing when there are less than 4 items in the collection (#3674)

uyhcire0a7a2b99b502
diff --git a/langchain/vectorstores/chroma.py b/langchain/vectorstores/chroma.py
index 43ce6c0a0f..d3b4cfbcd3 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: