Skip to content

Commit 1f8eb82

Browse files
author
Daniel Lorch
committed
chore: decode base64 images
1 parent c477c44 commit 1f8eb82

File tree

1 file changed

+8
-0
lines changed
  • lib/idp_common_pkg/idp_common/extraction

1 file changed

+8
-0
lines changed

lib/idp_common_pkg/idp_common/extraction/service.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from __future__ import annotations
1212

13+
import base64
1314
import json
1415
import logging
1516
import os
@@ -461,6 +462,13 @@ def _convert_image_uris_to_bytes_in_content(
461462
f"Invalid file path {image_uri} - expecting S3 path"
462463
)
463464

465+
converted_item = image.prepare_bedrock_image_attachment(image_bytes)
466+
elif "image_base64" in item:
467+
image_base64 = item["image_base64"]
468+
469+
# Decode image content
470+
image_bytes = base64.b64decode(image_base64)
471+
464472
converted_item = image.prepare_bedrock_image_attachment(image_bytes)
465473
elif "image" in item:
466474
# Keep existing image objects as-is

0 commit comments

Comments
 (0)