Skip to content

Commit

Permalink
🐛 Fix handling of empty image list
Browse files Browse the repository at this point in the history
  • Loading branch information
baptiste-pasquier committed May 2, 2024
1 parent 5c385d0 commit 8106cb5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backend/rag_components/retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def add_documents_multivector(
raise ValueError(
"The length of vectorstore_content and metadata_list must be the same"
)
if len(vectorstore_content) == 0:
return

if not isinstance(retriever, MultiVectorRetriever):
raise ValueError("retriever must be a MultiVectorRetriever")
Expand Down
6 changes: 6 additions & 0 deletions backend/rag_components/unstructured.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ def select_images(
if width < min_size[0] or height < min_size[1]:
continue

if (
element.metadata.image_mime_type is None
or element.metadata.image_base64 is None
):
continue

image = Image(
base64=element.metadata.image_base64,
mime_type=element.metadata.image_mime_type,
Expand Down

0 comments on commit 8106cb5

Please sign in to comment.