From f328d3287033cd1245c28469735f0c2bc4fa95d7 Mon Sep 17 00:00:00 2001 From: OrangerXu Date: Wed, 14 Oct 2026 13:59:50 +0800 Subject: [PATCH] chore(types): give the variations OpenAPI fixtures explicit types dict[str, object] on the documented request body and the openapi_extra mapping keeps FastAPI's decorator overloads resolving, and the ORJSONResponse deprecation on the azure-compat path is suppressed with its reason - both to hold the basedpyright delta ceilings. --- litellm/proxy/image_endpoints/endpoints.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/litellm/proxy/image_endpoints/endpoints.py b/litellm/proxy/image_endpoints/endpoints.py index 1e8cc40c4f7..76cfaca5f5e 100644 --- a/litellm/proxy/image_endpoints/endpoints.py +++ b/litellm/proxy/image_endpoints/endpoints.py @@ -53,7 +53,7 @@ IMAGE_VARIATION_OPTIONAL_FIELD_DEFAULTS: Final = MappingProxyType({"image": None # ImageVariationRequestParams carries FileTypes (typing.IO[bytes]) which # pydantic cannot turn into a JSON schema, so the documented JSON body # schema is spelled out for the shape the multipart form accepts. -_IMAGE_VARIATION_REQUEST_BODY: Final = { +_IMAGE_VARIATION_REQUEST_BODY: Final[dict[str, object]] = { "required": True, "content": { "application/json": { @@ -71,7 +71,7 @@ _IMAGE_VARIATION_REQUEST_BODY: Final = { } }, } -_IMAGE_VARIATION_OPENAPI_EXTRA: Final = MappingProxyType({"requestBody": _IMAGE_VARIATION_REQUEST_BODY}) +_IMAGE_VARIATION_OPENAPI_EXTRA: Final[dict[str, object]] = {"requestBody": _IMAGE_VARIATION_REQUEST_BODY} IMAGE_ARRAY_FIELD: Final = "image[]" MASK_ARRAY_FIELD: Final = "mask[]" @@ -390,21 +390,21 @@ async def image_edit_api( "/v1/images/variations", dependencies=[Depends(user_api_key_auth)], responses={200: {"model": ImageResponse}}, - openapi_extra=dict(_IMAGE_VARIATION_OPENAPI_EXTRA), + openapi_extra=dict[str, object](_IMAGE_VARIATION_OPENAPI_EXTRA), tags=["images"], ) @router.post( "/images/variations", dependencies=[Depends(user_api_key_auth)], responses={200: {"model": ImageResponse}}, - openapi_extra=dict(_IMAGE_VARIATION_OPENAPI_EXTRA), + openapi_extra=dict[str, object](_IMAGE_VARIATION_OPENAPI_EXTRA), tags=["images"], ) @router.post( "/openai/deployments/{model:path}/images/variations", dependencies=[Depends(user_api_key_auth)], responses={200: {"model": ImageResponse}}, - openapi_extra=dict(_IMAGE_VARIATION_OPENAPI_EXTRA), + openapi_extra=dict[str, object](_IMAGE_VARIATION_OPENAPI_EXTRA), response_class=ORJSONResponse, ) # azure compatible endpoint async def image_variation_api(