From 0b33da566a54808c6900e4e6a75f25970c2c7140 Mon Sep 17 00:00:00 2001 From: jesus Date: Mon, 7 Sep 2026 09:40:58 +0000 Subject: [PATCH] refactor(vertex_ai): keep yield outside the JSON decode guard Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/llms/vertex_ai/files/transformation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/litellm/llms/vertex_ai/files/transformation.py b/litellm/llms/vertex_ai/files/transformation.py index 032f4ed563d..0efc3f1f453 100644 --- a/litellm/llms/vertex_ai/files/transformation.py +++ b/litellm/llms/vertex_ai/files/transformation.py @@ -642,12 +642,13 @@ def _iter_openai_jsonl_entries( ) -> Iterator[dict[str, Any]]: for lineno, line in _iter_numbered_openai_jsonl_lines(openai_file_content): try: - yield json.loads(line) + entry: dict[str, Any] = json.loads(line) except json.JSONDecodeError as e: raise VertexAIError( status_code=400, message=f"Invalid JSON on line {lineno} of batch input file: {e.msg}", ) from e + yield entry def _parse_vertex_batch_output_row(line: str) -> _VertexBatchRow: