Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion litellm/llms/vertex_ai/batches/transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ def _get_output_file_id_from_vertex_ai_batch_response(cls, response: VertexBatch
Gets the output file id from the Vertex AI Batch response
"""

output_file_id: str = response.get("outputInfo", OutputInfo()).get("gcsOutputDirectory", "")
output_info = response.get("outputInfo") or OutputInfo()
output_file_id: str = output_info.get("gcsOutputDirectory", "")
if output_file_id:
output_file_id = output_file_id.rstrip("/") + "/predictions.jsonl"
if output_file_id and output_file_id != "/predictions.jsonl":
Expand Down
17 changes: 17 additions & 0 deletions tests/test_litellm/llms/vertex_ai/batches/test_transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,23 @@ def test_get_output_file_id_empty_output_info_falls_through_to_output_config():
assert T._get_output_file_id_from_vertex_ai_batch_response(resp) == "gs://b/cfg/predictions.jsonl"


def test_get_output_file_id_output_info_explicit_none_falls_through_to_output_config():
# Vertex AI can return "outputInfo": null in a 200 response (e.g. before it has
# asynchronously assigned the output directory). dict.get(key, default) does NOT
# substitute default when the key is present but explicitly None, so this must be
# handled explicitly instead of crashing with AttributeError: 'NoneType' object
# has no attribute 'get'.
resp = {
"outputInfo": None,
"outputConfig": {"gcsDestination": {"outputUriPrefix": "gs://b/cfg"}},
}
assert T._get_output_file_id_from_vertex_ai_batch_response(resp) == "gs://b/cfg/predictions.jsonl"


def test_get_output_file_id_output_info_explicit_none_and_no_output_config():
assert T._get_output_file_id_from_vertex_ai_batch_response({"outputInfo": None}) == ""


def test_get_output_file_id_no_output_info_and_no_output_config():
assert T._get_output_file_id_from_vertex_ai_batch_response({}) == ""

Expand Down
78 changes: 72 additions & 6 deletions ui/litellm-dashboard/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion ui/litellm-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
},
"overrides": {
"prismjs": "1.30.0",
"js-yaml": "4.2.0",
"js-yaml": "4.3.0",
"brace-expansion": "5.0.7",
"glob": "13.0.0",
"minimatch": "10.2.4",
"ws": "8.21.0",
Expand Down
Loading