litellm/tests/unit/llms/vertex_ai
shri manasa cb7c96e9f3
fix(vertex-ai): raise BadRequestError instead of ValueError in VertexAIImagenImageEditConfig (#52538)
* fix(vertex-ai): raise BadRequestError instead of ValueError in VertexAIImagenImageEditConfig

When transform_image_edit_request() receives image=None, an empty image list,
or prompt=None, it previously raised a raw ValueError. The exception_mapping
layer then wrapped this into APIConnectionError with a misleading 'looks like a
bug in LiteLLM' message, and the proxy returned HTTP 500 instead of 400.

The same issue was fixed for VertexAIGeminiImageEditConfig in PR #52087
(commit 40a4054c71). This commit applies the identical fix to the previously
missed VertexAIImagenImageEditConfig.

Changes:
- Replace the three raw ValueError raises in transform_image_edit_request with
  litellm.BadRequestError(message=..., model=model, llm_provider='vertex_ai').
- Add tests/llms/vertex_ai/image_edit/test_vertex_imagen_bad_request.py with
  five unit tests covering both validation paths and their status codes.

Fixes #52366

* test(vertex-ai): add comprehensive tests for all 3 validation raise sites

* test(vertex-ai): test public sync/async entry points and proxy-level 400 response

* fix(vertex-ai): return 400 for unreadable Imagen edit images and fix the stale ValueError test

A string, path or wrong-type image or mask still surfaced as a 500. The older test that expected ValueError for an empty image list failed against the new BadRequestError, and the proxy test never reached the Imagen code, so both are removed

---------

Co-authored-by: kenneth <kenneth@berri.ai>
2026-11-25 21:15:29 -08:00
..
agent_engine
audio_transcription feat(vertex_ai): label Vertex requests with the caller's key, team, org, and project (#50732) 2026-11-14 00:39:01 -05:00
batches feat(vertex_ai): label Vertex requests with the caller's key, team, org, and project (#50732) 2026-11-14 00:39:01 -05:00
context_caching fix(vertex_ai): cache the whole conversation prefix up to the cache_control block so Gemini sees turns in order (#54434) 2026-11-25 21:26:15 +00:00
count_tokens ci(unit): cut unit check time with cheaper per-test resets and fewer non-unit tests (#51864) 2026-11-14 15:41:30 -08:00
files fix(gemini): return raw pcm16 when Gemini TTS answers WAV audio (#51145) 2026-11-24 08:45:12 -08:00
fine_tuning
fixtures
gemini fix(vertex_ai): cache the whole conversation prefix up to the cache_control block so Gemini sees turns in order (#54434) 2026-11-25 21:26:15 +00:00
gemini_embeddings fix(embeddings): send request-shaped extra_body fields at the provider's documented path (#54273) 2026-11-25 13:29:52 -08:00
image_edit fix(vertex-ai): raise BadRequestError instead of ValueError in VertexAIImagenImageEditConfig (#52538) 2026-11-25 21:15:29 -08:00
image_generation fix(gemini): return an error instead of an empty 200 when a Gemini image request gets no image (#29125) 2026-11-25 20:55:23 +00:00
interactions feat(vertex_ai): label Vertex requests with the caller's key, team, org, and project (#50732) 2026-11-14 00:39:01 -05:00
multimodal_embeddings fix(embeddings): send request-shaped extra_body fields at the provider's documented path (#54273) 2026-11-25 13:29:52 -08:00
rag_engine
realtime feat(gemini): support Gemini Live Avatar on Vertex AI realtime (#53270) 2026-11-21 15:06:59 -08:00
rerank feat(vertex_ai): label Vertex requests with the caller's key, team, org, and project (#50732) 2026-11-14 00:39:01 -05:00
responses feat(vertex_ai): add Meta Muse models on Vertex AI (#50768) 2026-11-21 13:00:24 -08:00
text_to_speech
vertex_ai_partner_models fix(anthropic): drop unsigned thinking blocks before /v1/messages reaches Claude (#51793) 2026-11-24 05:30:55 +00:00
vertex_embeddings fix(embeddings): send request-shaped extra_body fields at the provider's documented path (#54273) 2026-11-25 13:29:52 -08:00
vertex_gemma_models
videos feat(vertex_ai): label Vertex requests with the caller's key, team, org, and project (#50732) 2026-11-14 00:39:01 -05:00
__init__.py
google_genai_proxy_test_config.yaml
test_bge_embedding.py
test_bge_response_transformation.py
test_common_utils.py
test_gemini_batch_embeddings.py
test_gemini_empty_properties.py
test_gemini_header_forwarding.py
test_http_status_201.py
test_request_labels.py feat(vertex_ai): label Vertex requests with the caller's key, team, org, and project (#50732) 2026-11-14 00:39:01 -05:00
test_vertex.py feat(messages): serve vertex ai claude messages on rust only (#52314) 2026-11-19 21:15:10 +00:00
test_vertex_ai_batch_transformation.py
test_vertex_ai_common_utils.py fix(messages): answer 400 for a non-string user or system text block and keep count_tokens in step with inference (#54165) 2026-11-25 00:48:41 +00:00
test_vertex_ai_non_gemini.py
test_vertex_ai_psc_endpoint_support.py
test_vertex_ai_search_vector_store_transformation.py
test_vertex_gemini_gcs_uri_mime.py
test_vertex_global_url_support.py
test_vertex_image_generation.py
test_vertex_llm_base.py feat(bedrock): derive STS session tags and session name from caller identity (#52978) 2026-11-19 17:11:09 -08:00
test_vertex_model_garden_openapi.py fix(openai_like): honor the deployment timeout and stream_timeout on async streams (#53442) 2026-11-22 21:52:59 +00:00
test_vertex_passthrough_logging_handler.py