From fbb827da030e6039b2f2c5f0fdb1a1d149807da7 Mon Sep 17 00:00:00 2001 From: Vishal Bala Date: Fri, 19 Dec 2025 12:08:31 +0400 Subject: [PATCH] Lazy-import botocore exception to avoid unnecessary dependency --- redisvl/utils/vectorize/bedrock.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/redisvl/utils/vectorize/bedrock.py b/redisvl/utils/vectorize/bedrock.py index 1fec88ee..a67b2b00 100644 --- a/redisvl/utils/vectorize/bedrock.py +++ b/redisvl/utils/vectorize/bedrock.py @@ -5,7 +5,6 @@ from pathlib import Path from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Union -from botocore.exceptions import ValidationError from pydantic import ConfigDict from tenacity import retry, stop_after_attempt, wait_random_exponential from tenacity.retry import retry_if_not_exception_type @@ -221,6 +220,8 @@ def _embed(self, content: Any, **kwargs) -> List[float]: ValueError: If attempting to embed an image with a text model ValueError: If embedding fails """ + from botocore.exceptions import ValidationError + body = self._serialize_request_body(content) try: @@ -261,6 +262,8 @@ def _embed_many( ValueError: If attempting to embed an image with a text model ValueError: If embedding fails """ + from botocore.exceptions import ValidationError + if not isinstance(contents, list): raise TypeError("`contents` must be a list")