From 50abeb7ed93f78eb5fde8875ad3a093e1934c3e7 Mon Sep 17 00:00:00 2001 From: Sourav Pradhan Date: Sat, 2 Mar 2024 03:25:58 +0530 Subject: [PATCH] community[patch]: fix Chroma add_images (#17964) ### Description Fixed a small bug in chroma.py add_images(), previously whenever we are not passing metadata the documents is containing the base64 of the uris passed, but when we are passing the metadata the documents is containing normal string uris which should not be the case. ### Issue In add_images() method when we are calling upsert() we have to use "b64_texts" instead of normal string "uris". ### Twitter handle https://twitter.com/whitepegasus01 --- libs/community/langchain_community/vectorstores/chroma.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/community/langchain_community/vectorstores/chroma.py b/libs/community/langchain_community/vectorstores/chroma.py index 025212527ca..abd64f56275 100644 --- a/libs/community/langchain_community/vectorstores/chroma.py +++ b/libs/community/langchain_community/vectorstores/chroma.py @@ -209,7 +209,7 @@ class Chroma(VectorStore): empty_ids.append(idx) if non_empty_ids: metadatas = [metadatas[idx] for idx in non_empty_ids] - images_with_metadatas = [uris[idx] for idx in non_empty_ids] + images_with_metadatas = [b64_texts[idx] for idx in non_empty_ids] embeddings_with_metadatas = ( [embeddings[idx] for idx in non_empty_ids] if embeddings else None ) @@ -231,7 +231,7 @@ class Chroma(VectorStore): else: raise e if empty_ids: - images_without_metadatas = [uris[j] for j in empty_ids] + images_without_metadatas = [b64_texts[j] for j in empty_ids] embeddings_without_metadatas = ( [embeddings[j] for j in empty_ids] if embeddings else None )