Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(types): avoid mutable image serializer annotations

kerry34293483059d
diff --git a/litellm/types/utils.py b/litellm/types/utils.py
index 8d327b337a7..c661aa0839a 100644
--- a/litellm/types/utils.py
+++ b/litellm/types/utils.py
@@ -2552,7 +2552,7 @@ class ImageResponse(OpenAIImageResponse, BaseLiteLLMOpenAIResponseObject):
model_config = ConfigDict(extra="allow", protected_namespaces=())
@field_serializer("data")
- def _serialize_image_data(self, data: list[OpenAIImage] | None) -> list[dict[str, object]] | None:
+ def _serialize_image_data(self, data: Sequence[OpenAIImage] | None) -> Sequence[Mapping[str, object]] | None:
return None if data is None else [image.model_dump() for image in data]
def __init__(