litellm/tests/unit/images
SanthoshSachin 28a71ab46c
fix(images): send image_edit markup as a multipart file part (#53815)
* fix(images): send image_edit markup as a multipart file part

* fix(images): unpack FileTypes tuples for multipart uploads and add Final annotations

* fix(images): avoid Unknown tuple narrowing in _build_upload_part for basedpyright

* fix(images): send tuple mask uploads through the shared upload part helper

Mask uploads now go through _add_image_to_files like image and markup, so a (filename, content[, content_type[, headers]]) mask tuple is sent as that file instead of nested as the part's content

* fix(images): reject JSON image references for mask and markup, send the first markup of a list, and let Azure drop markup

A mask or markup given as a JSON image reference now gets a 400 from LiteLLM before any provider call, instead of a 500 from the multipart send

A markup list sends its first file, the same as mask

Azure answers Unknown parameter for markup, so Azure no longer lists it, and drop_params drops it

The FLUX 2 edit config now returns list[str] like its parent

* fix(hosted_vllm): exclude unsupported markup param from image_edit config

* fix(images): stop listing markup for Azure AI FLUX Kontext and name the resolved provider on image edit errors

The JSON image reference 400 used litellm_params built before the provider was resolved, so azure, azure_ai and litellm_proxy errors said openai. The hosted vLLM markup test now goes through litellm.image_edit, and the JSON reference test covers a list holding a reference

* fix(images): let the markup type hint take a list like image

* fix(images): read pathlib.Path image edit uploads, send base file names and reject string mask or markup

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-25 04:14:57 +00:00
..
request_payloads test: move the unit half of 126 mixed legacy files into tests/unit (#45090) 2026-10-07 14:07:43 -07:00
__init__.py test: move tests/test_litellm root and small trees into tests/unit (#43186) 2026-09-25 11:30:43 -07:00
test_image_edit.py fix(images): send image_edit markup as a multipart file part (#53815) 2026-11-25 04:14:57 +00:00
test_image_edit_extra_params.py fix(images): send JSON-form image edits upstream as JSON instead of a url-encoded form (#53864) 2026-11-24 16:48:05 -08:00
test_image_edit_utils.py fix(vertex_ai): honor Gemini image size and imageConfig controls on generation and edits (#53580) 2026-11-23 09:05:25 -08:00
test_image_generation_extra_headers.py test: move tests/test_litellm root and small trees into tests/unit (#43186) 2026-09-25 11:30:43 -07:00
test_main.py fix(images): bill the deployment's custom pricing when the proxy pre-creates the logging object (#53994) 2026-11-23 17:37:37 -08:00
test_streaming.py fix(images): support stream=True on image generation and edit (#53966) 2026-11-23 18:01:29 -08:00