litellm/tests/test_litellm/llms/vertex_ai
yucheng-berri 61d32c9aac
fix: handle explicit outputInfo: null in Vertex AI batch response (#34473)
* fix: handle explicit outputInfo: null in Vertex AI batch response

Vertex AI can return HTTP 200 for a create_batch/get_batch call with an
explicit "outputInfo": null body (the output directory is assigned
asynchronously and may not be populated yet at response time).

_get_output_file_id_from_vertex_ai_batch_response did:

    response.get("outputInfo", OutputInfo()).get("gcsOutputDirectory", "")

dict.get(key, default) only substitutes default when the key is absent,
not when it is present but explicitly None, so this crashed with:

    AttributeError: 'NoneType' object has no attribute 'get'

surfaced to callers as an opaque openai.InternalServerError 500 from
litellm.create_batch()/retrieve_batch() for any Vertex AI batch job,
regardless of whether the job ultimately succeeds.

Fixed by guarding with `response.get("outputInfo") or OutputInfo()`,
matching the existing null-safe pattern already used by the sibling
_get_input_file_id_from_vertex_ai_batch_response for inputConfig. The
existing outputConfig fallback branch (a few lines below) already
handles this case correctly once it's reachable - it just never was.

Added 2 regression tests covering outputInfo: null with and without an
outputConfig fallback available.

* test: drop explanatory comment from regression test

---------

Co-authored-by: htourinho-clgx <htourinho@cotality.com>
2026-07-24 15:10:16 -07:00
..
audio_transcription feat(vertex_ai): add Google Cloud Speech-to-Text Chirp 3 transcription support (#32274) 2026-07-06 18:25:22 -07:00
batches fix: handle explicit outputInfo: null in Vertex AI batch response (#34473) 2026-07-24 15:10:16 -07:00
context_caching chore(oss): litellm oss staging 150626 (#30463) 2026-06-16 12:06:41 -07:00
files fix(vertex_ai/files): single media upload for batch files to fix 499s on large uploads (#31653) 2026-06-29 17:31:32 -07:00
gemini fix(vertex): incrementally parse accumulated Gemini stream JSON to prevent multi-value wedge (#34320) 2026-07-24 11:07:02 -07:00
gemini_embeddings fix(vertex): preserve Gemini Embedding 2 usageMetadata for cost tracking (#31354) 2026-06-25 19:53:16 -07:00
image_edit style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
image_generation feat(vertex_ai): pass full imageConfig dict for Gemini image generation (#31811) 2026-07-01 23:29:59 -07:00
multimodal_embeddings Merge remote-tracking branch 'upstream/litellm_internal_staging' into litellm_staging_03_23_2026 2026-04-25 15:16:13 -03:00
realtime test: add realtime proxy e2e suite across providers (#30960) 2026-06-26 09:36:49 -07:00
rerank fix(tests): remove importlib.reload of http_handler that breaks client injection in later tests (#34336) 2026-07-23 01:11:35 +00:00
vertex_ai_partner_models chore(tests): replace a customer name and domain with neutral placeholders 2026-07-21 15:09:15 -07:00
vertex_gemma_models fix(vertex_gemma): strip context_management from request body (#28438) 2026-05-21 23:10:33 +05:30
videos fix(vertex-ai): use DB credentials in video handlers + implement Veo video edit (#29098) 2026-05-28 11:45:41 -07:00
__init__.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_bge_embedding.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_bge_response_transformation.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_gemini_batch_embeddings.py test(batches): move orphan tests into tests/test_litellm for CI coverage (#30510) 2026-06-16 10:20:59 -07:00
test_gemini_empty_properties.py fix: keep type field in Gemini schema when properties is empty (#18979) 2026-01-14 22:58:05 +05:30
test_gemini_header_forwarding.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_http_status_201.py Litellm fix GitHub action testing (#11163) 2025-05-26 14:41:42 -07:00
test_vertex.py Day 0 support : Gemini 3.5 Flash (#28268) 2026-05-19 15:50:54 -07:00
test_vertex_ai_batch_transformation.py fix: cover provider path traversal variants 2026-04-29 22:29:09 -07:00
test_vertex_ai_common_utils.py feat(vertex_ai): add Google Cloud Speech-to-Text Chirp 3 transcription support (#32274) 2026-07-06 18:25:22 -07:00
test_vertex_ai_psc_endpoint_support.py fix(vertex_ai): build full request path when custom api_base has no path (#32367) 2026-07-07 13:17:07 -07:00
test_vertex_ai_search_vector_store_transformation.py feat(vector-stores): forward per-request params to Vertex AI Search (#29459) 2026-06-02 12:51:20 -07:00
test_vertex_gemini_gcs_uri_mime.py Litellm oss staging (#28161) 2026-05-18 16:27:44 -07:00
test_vertex_global_url_support.py fix(vertex_ai): use aiplatform.{geo}.rep.googleapis.com for multi-region locations (#26281) 2026-04-23 15:58:02 -07:00
test_vertex_image_generation.py test: fix tests 2025-11-22 16:50:50 -08:00
test_vertex_llm_base.py fix(vertex_ai): return create_vertex_url result directly for openai-path partner models with custom api_base (#32380) 2026-07-07 14:49:21 -07:00
test_vertex_model_garden_openapi.py [internal copy of #29003] fix(vertex_ai): use user-supplied api_base as is for Model Garden OpenAI-compat path (#29530) 2026-06-02 16:15:25 -07:00