refactor(vertex_ai): keep yield outside the JSON decode guard

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
jesus 2026-09-07 09:40:58 +00:00
parent 7e0714657b
commit 0b33da566a

View file

@ -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: