Skip to content

The agent engineering platform.

fallback to {} for None metadata from Chroma (#1714)

Jeff Huberf93c0114566f
diff --git a/langchain/vectorstores/chroma.py b/langchain/vectorstores/chroma.py
index d4a8d63db3..2f2b49dbc6 100644
--- a/langchain/vectorstores/chroma.py
+++ b/langchain/vectorstores/chroma.py
@@ -24,7 +24,7 @@ def _results_to_docs_and_scores(results: Any) -> List[Tuple[Document, float]]:
return [
# TODO: Chroma can do batch querying,
# we shouldn't hard code to the 1st result
- (Document(page_content=result[0], metadata=result[1]), result[2])
+ (Document(page_content=result[0], metadata=result[1] or {}), result[2])
for result in zip(
results["documents"][0],
results["metadatas"][0],