From e289dfc09489fb743764359c4e9055580d755879 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Tue, 6 Jan 2026 13:44:32 +0530 Subject: [PATCH] Fix mypy issues --- litellm/llms/custom_httpx/llm_http_handler.py | 4 ++-- litellm/llms/custom_llm.py | 4 ++-- litellm/llms/recraft/image_edit/transformation.py | 4 ++-- .../llms/vertex_ai/image_edit/vertex_imagen_transformation.py | 2 ++ 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/litellm/llms/custom_httpx/llm_http_handler.py b/litellm/llms/custom_httpx/llm_http_handler.py index 1da6e61252f..2f6d74eb7a7 100644 --- a/litellm/llms/custom_httpx/llm_http_handler.py +++ b/litellm/llms/custom_httpx/llm_http_handler.py @@ -4453,7 +4453,7 @@ class BaseLLMHTTPHandler: self, model: str, image: Any, - prompt: str, + prompt: Optional[str], image_edit_provider_config: BaseImageEditConfig, image_edit_optional_request_params: Dict, custom_llm_provider: str, @@ -4572,7 +4572,7 @@ class BaseLLMHTTPHandler: self, model: str, image: FileTypes, - prompt: str, + prompt: Optional[str], image_edit_provider_config: BaseImageEditConfig, image_edit_optional_request_params: Dict, custom_llm_provider: str, diff --git a/litellm/llms/custom_llm.py b/litellm/llms/custom_llm.py index d235df30f25..a820ac7f345 100644 --- a/litellm/llms/custom_llm.py +++ b/litellm/llms/custom_llm.py @@ -201,7 +201,7 @@ class CustomLLM(BaseLLM): self, model: str, image: Any, - prompt: str, + prompt: Optional[str], model_response: ImageResponse, api_key: Optional[str], api_base: Optional[str], @@ -216,7 +216,7 @@ class CustomLLM(BaseLLM): self, model: str, image: Any, - prompt: str, + prompt: Optional[str], model_response: ImageResponse, api_key: Optional[str], api_base: Optional[str], diff --git a/litellm/llms/recraft/image_edit/transformation.py b/litellm/llms/recraft/image_edit/transformation.py index 94449257694..533a5108604 100644 --- a/litellm/llms/recraft/image_edit/transformation.py +++ b/litellm/llms/recraft/image_edit/transformation.py @@ -124,7 +124,7 @@ class RecraftImageEditConfig(BaseImageEditConfig): ######################################################### # Reuse OpenAI logic: Separate images as `files` and send other parameters as `data` ######################################################### - files_list = self._get_image_files_for_request(image=image) + files_list = self._get_image_files_for_request(image=image) if image is not None else [] data_without_images = {k: v for k, v in request_dict.items() if k != "image"} return data_without_images, files_list @@ -132,7 +132,7 @@ class RecraftImageEditConfig(BaseImageEditConfig): def _get_image_files_for_request( self, - image: FileTypes, + image: Optional[FileTypes], ) -> List[Tuple[str, Any]]: files_list: List[Tuple[str, Any]] = [] diff --git a/litellm/llms/vertex_ai/image_edit/vertex_imagen_transformation.py b/litellm/llms/vertex_ai/image_edit/vertex_imagen_transformation.py index b61af6ffd3a..1515e6cbe93 100644 --- a/litellm/llms/vertex_ai/image_edit/vertex_imagen_transformation.py +++ b/litellm/llms/vertex_ai/image_edit/vertex_imagen_transformation.py @@ -150,6 +150,8 @@ class VertexAIImagenImageEditConfig(BaseImageEditConfig, VertexLLM): headers: dict, ) -> Tuple[Dict[str, Any], Optional[RequestFiles]]: # Prepare reference images in the correct Imagen format + if image is None: + raise ValueError("Vertex AI Imagen image edit requires at least one reference image.") reference_images = self._prepare_reference_images(image, image_edit_optional_request_params) if not reference_images: raise ValueError("Vertex AI Imagen image edit requires at least one reference image.")