diff --git a/litellm/litellm_core_utils/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.py index 624d5eaac27..ab60e827943 100644 --- a/litellm/litellm_core_utils/prompt_templates/factory.py +++ b/litellm/litellm_core_utils/prompt_templates/factory.py @@ -3571,7 +3571,8 @@ class BedrockImageProcessor: # against the previous signature, so an additive parameter would # break them; omitting it keeps the call byte-for-byte as it was. capped: Final = {} if max_bytes is None else {"max_bytes": max_bytes} # mutable-ok: kwargs for one call - img_bytes, mime_type = await BedrockImageProcessor.get_image_details_async(image_url, **capped) + fetched: Final = await BedrockImageProcessor.get_image_details_async(image_url, **capped) + img_bytes, mime_type = fetched # rebind-ok: mime_type is overridden below by `format` image_format = mime_type.split("/")[1] else: raise ValueError("Unsupported image type. Expected either image url or base64 encoded string") diff --git a/litellm/litellm_core_utils/url_utils.py b/litellm/litellm_core_utils/url_utils.py index 0b26eaa869e..ec3afe7276e 100644 --- a/litellm/litellm_core_utils/url_utils.py +++ b/litellm/litellm_core_utils/url_utils.py @@ -455,8 +455,8 @@ async def _async_get_capped( Returns a fully-read response so callers keep using ``.content`` as before. """ async with _underlying_httpx_client(client).stream("GET", url, **request_kwargs) as response: - chunks: list[bytes] = [] # mutable-ok: accumulator for the capped body - total = 0 + chunks: Final[list[bytes]] = [] # mutable-ok: accumulator for the capped body + total = 0 # rebind-ok: running byte count for the cap async for chunk in response.aiter_bytes(): total += len(chunk) if total > max_bytes: diff --git a/litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py b/litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py index 36a74f9a949..b49040580f7 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py +++ b/litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py @@ -417,7 +417,7 @@ class BedrockGuardrail(CustomGuardrail, BaseAWSLLM): return bedrock_request budget: Final = _ImageFetchBudget() - per_message = await asyncio.gather( + per_message: Final = await asyncio.gather( *(self._build_input_content_items(message=message, budget=budget) for message in messages) ) # mutable-ok: BedrockRequest["content"] is a list in the AWS wire format