mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-27 17:08:47 +00:00
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
This commit is contained in:
parent
d722525c70
commit
50abeb7ed9
@ -209,7 +209,7 @@ class Chroma(VectorStore):
|
|||||||
empty_ids.append(idx)
|
empty_ids.append(idx)
|
||||||
if non_empty_ids:
|
if non_empty_ids:
|
||||||
metadatas = [metadatas[idx] for idx in 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_with_metadatas = (
|
||||||
[embeddings[idx] for idx in non_empty_ids] if embeddings else None
|
[embeddings[idx] for idx in non_empty_ids] if embeddings else None
|
||||||
)
|
)
|
||||||
@ -231,7 +231,7 @@ class Chroma(VectorStore):
|
|||||||
else:
|
else:
|
||||||
raise e
|
raise e
|
||||||
if empty_ids:
|
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_without_metadatas = (
|
||||||
[embeddings[j] for j in empty_ids] if embeddings else None
|
[embeddings[j] for j in empty_ids] if embeddings else None
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user