Skip to content

Commit 8ee7ca9

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 eb95054 commit 8ee7ca9

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):
@@ -737,6 +733,11 @@ def generate_embedding(
737733
Returns:
738734
List of floats representing the embedding vector
739735
"""
736+
from idp_common.image import (
737+
prepare_image,
738+
prepare_bedrock_image_attachment
739+
)
740+
740741
if (not text or not isinstance(text, str)) and (not image_source):
741742
# Return an empty vector for empty input
742743
return []

0 commit comments

Comments
 (0)