aglinxinyuan opened a new issue, #6250:
URL: https://github.com/apache/texera/issues/6250

   ### Task Summary
   
   Add a dedicated `ImageTaskCodegenSpec.scala` that pins the payload/parse 
Python-snippet contract of `ImageTaskCodegen` — the Hugging Face codegen for 
the image-pipeline task family (9 tasks). Mirror the existing 
`TextGenCodegenSpec` (same package) as the template.
   
   ## Background
   
   `ImageTaskCodegen` 
(`common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/huggingFace/codegen/ImageTaskCodegen.scala`)
 is an `object extends TaskCodegen` and the richest codegen of the family. It 
splits into **image-only** tasks (raw image bytes as the request body) and 
**image + prompt** tasks (base64 image bundled with a text prompt in a JSON 
payload), plus a validation path.
   
   ```scala
   override val task: String = "image-classification"
   override val tasks: Set[String] = Set(
     "image-classification", "object-detection", "image-segmentation", 
"image-to-text",
     "visual-question-answering", "document-question-answering",
     "zero-shot-image-classification", "image-text-to-text", "image-to-image"
   )
   ```
   
   ## Behavior to pin
   
   | Member | Contract |
   | --- | --- |
   | `task` | equals `"image-classification"` |
   | `tasks` | equals exactly the 9-element set above |
   | `payloadPython` (image-only) | tasks in `image_only_tasks` set `payload = 
current_image_bytes`, `use_raw_binary_body = True`, `raw_binary_headers = 
image_headers` |
   | `payloadPython` (VQA / doc-QA) | build a payload with 
`self._image_input_as_base64(current_image_bytes)` and `"question": 
prompt_value` |
   | `payloadPython` (zero-shot) | `raise ValueError(...)` when fewer than 2 
candidate labels are supplied |
   | `parsePython` | `image-to-text` / `image-text-to-text` read 
`choices[0].message.content`; URL responses are normalized via 
`self._url_to_data_url`; classification/detection/segmentation return 
`json.dumps(body)` |
   | no raw-value leakage | with sentinel `CodegenContext` fields (e.g. 
`imageInput` / `inputImageColumn` / `candidateLabels` = `"MARKER_…"`), neither 
snippet contains the sentinel |
   
   Build the `CodegenContext` with a `makeCtx` helper as in 
`TextGenCodegenSpec`. Assert on snippet structure / marker substrings, not 
exact whitespace.
   
   ## Scope
   
   - New spec: `ImageTaskCodegenSpec.scala` under 
`common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/huggingFace/codegen/`.
   - No production-code changes.
   
   ### Task Type
   
   - [ ] Refactor / Cleanup
   - [ ] DevOps / Deployment / CI
   - [x] Testing / QA
   - [ ] Documentation
   - [ ] Performance
   - [ ] Other
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to