Skip to content

Commit

Permalink
community[patch]: fix Chroma add_images (#17964)
Browse files Browse the repository at this point in the history
###  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
  • Loading branch information
WhitePegasis committed Mar 1, 2024
1 parent d722525 commit 50abeb7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/community/langchain_community/vectorstores/chroma.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def add_images(
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
)
Expand All @@ -231,7 +231,7 @@ def add_images(
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
)
Expand Down

0 comments on commit 50abeb7

Please sign in to comment.