mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-15 23:31:29 +00:00
* 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>
|
||
|---|---|---|
| .. | ||
| audio_transcription | ||
| batches | ||
| context_caching | ||
| files | ||
| gemini | ||
| gemini_embeddings | ||
| image_edit | ||
| image_generation | ||
| multimodal_embeddings | ||
| realtime | ||
| rerank | ||
| vertex_ai_partner_models | ||
| vertex_gemma_models | ||
| videos | ||
| __init__.py | ||
| test_bge_embedding.py | ||
| test_bge_response_transformation.py | ||
| test_gemini_batch_embeddings.py | ||
| test_gemini_empty_properties.py | ||
| test_gemini_header_forwarding.py | ||
| test_http_status_201.py | ||
| test_vertex.py | ||
| test_vertex_ai_batch_transformation.py | ||
| test_vertex_ai_common_utils.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 | ||
| test_vertex_model_garden_openapi.py | ||