From 2310847c0f81042765c8944967bfac14b6af2375 Mon Sep 17 00:00:00 2001 From: Mohammad Mohtashim <45242107+keenborder786@users.noreply.github.com> Date: Thu, 13 Feb 2025 07:26:13 +0500 Subject: [PATCH] (Chroma): Small Fix in `add_texts` when checking for embeddings (#29766) - **Description:** Small fix in `add_texts` to make embedding nullability is checked properly. - **Issue:** #29765 --------- Co-authored-by: Chester Curme --- libs/partners/chroma/langchain_chroma/vectorstores.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/partners/chroma/langchain_chroma/vectorstores.py b/libs/partners/chroma/langchain_chroma/vectorstores.py index 121f412ca3e..ccb175be9d3 100644 --- a/libs/partners/chroma/langchain_chroma/vectorstores.py +++ b/libs/partners/chroma/langchain_chroma/vectorstores.py @@ -547,7 +547,9 @@ class Chroma(VectorStore): metadatas = [metadatas[idx] for idx in non_empty_ids] texts_with_metadatas = [texts[idx] for idx in non_empty_ids] embeddings_with_metadatas = ( - [embeddings[idx] for idx in non_empty_ids] if embeddings else None + [embeddings[idx] for idx in non_empty_ids] + if embeddings is not None + else None ) ids_with_metadata = [ids[idx] for idx in non_empty_ids] try: