Skip to content

Commit

Permalink
chore: converse b64 to bytes conversion raises error with more clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
MiNeves00 committed Mar 5, 2025
1 parent 986e3e8 commit f41c13a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libs/core/llmstudio_core/providers/bedrock_converse.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,10 @@ def _base64_to_bytes(image_url: str) -> bytes:

base64_data = re.sub(r"^data:image/[^;]+;base64,", "", image_url)

return base64.b64decode(base64_data)
try:
return base64.b64decode(base64_data)
except Exception as e:
raise ValueError(f"Failed to decode Base64: {e} ; for Base64: {image_url}")

@staticmethod
def _get_img_format_from_bytes(image_bytes: bytes) -> str:
Expand Down

0 comments on commit f41c13a

Please sign in to comment.