diff --git a/lambdas/bedrock_invoker_2/src/index.py b/lambdas/bedrock_invoker_2/src/index.py index 22475ff..0fc177f 100644 --- a/lambdas/bedrock_invoker_2/src/index.py +++ b/lambdas/bedrock_invoker_2/src/index.py @@ -22,7 +22,7 @@ def lambda_handler(event, context): for s3_uri in s3_uris: bucket, key = s3_uri.replace("s3://", "").split('/', 1) - extension = os.path.splitext(key)[1] + extension = os.path.splitext(key)[1].lower() try: print(f"Fetching file bucket: {bucket}, key: {key}") @@ -36,7 +36,7 @@ def lambda_handler(event, context): elif extension in ['.jpg', '.png', '.jpeg']: image_data = s3_object['Body'].read() encoded_image_data = base64.b64encode(image_data).decode() - media_type = f'image/{'png' if extension == '.png' else 'jpeg'}' + media_type = f"image/{'png' if extension == '.png' else 'jpeg'}" user_prompt_content.append({ 'type': 'image', 'source': {'type': 'base64', 'data': encoded_image_data, 'media_type': media_type}