diff --git a/litellm/llms/openrouter/image_edit/transformation.py b/litellm/llms/openrouter/image_edit/transformation.py index 393feefa75a..84ad38a2d5a 100644 --- a/litellm/llms/openrouter/image_edit/transformation.py +++ b/litellm/llms/openrouter/image_edit/transformation.py @@ -211,7 +211,7 @@ class OpenRouterImageEditConfig(BaseImageEditConfig): if img is None: continue mime_type = ImageEditRequestUtils.get_image_content_type(img) - image_bytes = self._read_image_bytes(cast(FileTypes, img)) + image_bytes = self._read_image_bytes(cast(FileTypes, img)) # cast-ok: image entries were narrowed by the None check and FileTypes contract b64_data = base64.b64encode(image_bytes).decode("utf-8") content_parts.append( { diff --git a/litellm/llms/vertex_ai/context_caching/vertex_ai_context_caching.py b/litellm/llms/vertex_ai/context_caching/vertex_ai_context_caching.py index 3208a3e5180..1321114a195 100644 --- a/litellm/llms/vertex_ai/context_caching/vertex_ai_context_caching.py +++ b/litellm/llms/vertex_ai/context_caching/vertex_ai_context_caching.py @@ -417,7 +417,7 @@ class ContextCachingEndpoints(VertexBase): "Content-Type": "application/json", } if isinstance(token, dict): - headers.update(cast(Mapping[str, str], token)) + headers.update(cast(Mapping[str, str], token)) # cast-ok: token mapping is returned by the Vertex auth helper elif token is not None: headers["Authorization"] = f"Bearer {token}" if extra_headers is not None: @@ -496,7 +496,7 @@ class ContextCachingEndpoints(VertexBase): response: Final = client.post( url=url, headers=headers, - json=cast(dict[str, object], cached_content_request_body), + json=cast(dict[str, object], cached_content_request_body), # cast-ok: request body is assembled as JSON object data # cast-ok: request body is assembled as JSON object data ) response.raise_for_status() except httpx.HTTPStatusError as err: @@ -597,7 +597,7 @@ class ContextCachingEndpoints(VertexBase): "Content-Type": "application/json", } if isinstance(token, dict): - headers.update(cast(Mapping[str, str], token)) + headers.update(cast(Mapping[str, str], token)) # cast-ok: token mapping is returned by the Vertex auth helper elif token is not None: headers["Authorization"] = f"Bearer {token}" if extra_headers is not None: @@ -673,7 +673,7 @@ class ContextCachingEndpoints(VertexBase): response: Final = await client.post( url=url, headers=headers, - json=cast(dict[str, object], cached_content_request_body), + json=cast(dict[str, object], cached_content_request_body), # cast-ok: request body is assembled as JSON object data ) response.raise_for_status() except httpx.HTTPStatusError as err: diff --git a/litellm/proxy/spend_tracking/spend_tracking_utils.py b/litellm/proxy/spend_tracking/spend_tracking_utils.py index fd43e1a6daa..a8b025cb0b3 100644 --- a/litellm/proxy/spend_tracking/spend_tracking_utils.py +++ b/litellm/proxy/spend_tracking/spend_tracking_utils.py @@ -1797,7 +1797,7 @@ def _placeholder_stored_request_body_metadata( { "model_group": persisted_model_group, "error_information": _scrub_raw_model_from_error_information( - cast(StandardLoggingPayloadErrorInformation, error_information), + cast(StandardLoggingPayloadErrorInformation, error_information), # cast-ok: validated mapping is the logging error-information contract raw_model, ) if isinstance(error_information, Mapping) diff --git a/litellm/responses/bridge_check.py b/litellm/responses/bridge_check.py index 60318d6b184..9c6575b877f 100644 --- a/litellm/responses/bridge_check.py +++ b/litellm/responses/bridge_check.py @@ -164,7 +164,7 @@ def responses_api_bridge_check( return model_info, model try: - model_info = cast( + model_info = cast( # cast-ok: provider metadata helper returns the bridge model-info mapping dict[str, object], get_model_info_helper(model=model, custom_llm_provider=custom_llm_provider), )