Skip to content

Commit 6053c30

Browse files
author
Daniel Lorch
committed
chore: move idp_common.image import to generate_embedding function, otherwise bedrock client would always require PIL dependency
1 parent 351c45a commit 6053c30

File tree

1 file changed

+5
-4
lines changed
  • lib/idp_common_pkg/idp_common/bedrock

1 file changed

+5
-4
lines changed

lib/idp_common_pkg/idp_common/bedrock/client.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
EndpointConnectionError,
2727
)
2828
from urllib3.exceptions import ReadTimeoutError as Urllib3ReadTimeoutError
29-
from idp_common.image import (
30-
prepare_image,
31-
prepare_bedrock_image_attachment
32-
)
3329

3430
# Dummy exception classes for requests timeouts if requests is not available
3531
class _RequestsReadTimeout(Exception):
@@ -724,6 +720,11 @@ def generate_embedding(
724720
Returns:
725721
List of floats representing the embedding vector
726722
"""
723+
from idp_common.image import (
724+
prepare_image,
725+
prepare_bedrock_image_attachment
726+
)
727+
727728
if (not text or not isinstance(text, str)) and (not image_source):
728729
# Return an empty vector for empty input
729730
return []

0 commit comments

Comments
 (0)