The GitHub Actions job "Backport Approval Check" on texera.git/gh-readonly-queue/main/pr-7920-471e53cfc1d5f96748a7ec6b7563561239229e5e has succeeded. Run started by GitHub user xuang7 (triggered by xuang7).
Head commit for run: 378a3b54ec645e57760011bca0e08c1829c86680 / Prateek Ganigi <[email protected]> feat(workflow-operator): read chat-provider responses for the image question-answering tasks (#7920) ### What changes were proposed in this PR? When the operator falls back from `hf-inference` to a third-party chat-completions provider, the reply comes back as `{"choices": [{"message": {"content": ...}}]}`. Three image tasks in `ImageTaskCodegen.parsePython` could not read that shape, so a correct answer was written to the result column as a raw JSON envelope: - `visual-question-answering` and `document-question-answering` returned `body.get("answer", json.dumps(body))`, and a chat response has no `answer` key. - `zero-shot-image-classification` shared the image-only branch, which always returns`json.dumps(body)`. Both now read `choices[0]["message"]["content"]` when the body carries `choices`, keeping the native `hf-inference` shape as the primary path. `zero-shot-image-classification` gets its own branch, placed ahead of the image-only tasks because the generated `if/elif` chain is first-match-wins. This is the same idiom `image-to-text` and `image-text-to-text` already use in this file, and the one applied to the text tasks in #7798. `image-classification`, `object-detection` and `image-segmentation` are left as they are: they have no question to answer, so a free-text chat reply is not meaningful structured output for them. This is Part A of #7906 and covers the response side only. The request side which is carrying `candidate_labels` into the chat message for `zero-shot-image-classification`, follows in Part B. ### Any related issues? Addresses #7906 ### How was this PR tested? 133 tests pass in the `WorkflowOperator` Hugging Face suites, `PythonCodeRawInvalidTextSpec` py-compiles the generated Python for all 117 operators, and `scalafmtCheck` is clean for main and test sources. Two tests were added to `ImageTaskCodegenSpec`: one asserts the visual/document question-answering branch reads `choices` ahead of the native `answer` lookup, the other asserts the new `zero-shot-image-classification` branch exists and precedes the image-only branch. The emitted Python was also exercised directly: the three fixed tasks return the chat content, native `hf-inference` responses parse exactly as before, non-dict and `answer`-less bodies still fall through to `json.dumps`, and the untouched branches (`image-classification`, `object-detection`, `image-segmentation`, `image-to-text`, `image-text-to-text`) are unchanged. ### Was this PR authored or co-authored using generative AI tooling? Yes, this PR was co-authored with Claude in compliance with ASF policy. --------- Co-authored-by: Xuan Gu <[email protected]> Report URL: https://github.com/apache/texera/actions/runs/35281206672 With regards, GitHub Actions via GitBox
