Skip to content

HuggingFace inference operator: task dropdown offers tasks with no codegen, which silently fall back to text-gen and emit raw JSON #7047

Description

@PG1204

What happened?

The HuggingFace operator's task selector lists pipeline tasks the operator can't actually run. STATIC_TASK_OPTIONS in frontend/src/app/workspace/component/hugging-face/hugging-face.component.ts (and the dynamic list fetched from HF's /api/tasks) include tasks that have no corresponding TaskCodegen, e.g. text-classification, token-classification, translation, summarization, feature-extraction, fill-mask.

The operator only registers codegens for a fixed set of tasks (TextGenCodegen, ImageTaskCodegen, AudioTaskCodegen, MediaGenCodegen, QaRankingCodegen, see registeredCodegens in HuggingFaceInferenceOpDesc). Any task outside that set falls through to TextGenCodegen, whose payload hits the generic {"inputs": prompt_value} branch and whose parser only handles text-generation. The result: the row's output cell gets a raw json.dumps(body) of whatever the endpoint returned, with no indication the task isn't supported. The unrecognized-task fallback is intentional as a safety net (keeps codegen total), but the UI actively steering users into it is not.

Proposed fix: prune the task selector to the tasks that actually have a codegen, and filter both STATIC_TASK_OPTIONS and the dynamic /api/tasks result against a supported-task set. "Only show what works" is simpler and clearer than showing unsupported tasks with a warning label. The supported set currently lives implicitly in the Scala codegen registrations, so the frontend needs its own copy of that list; the PR should keep the two in sync (and note it) so a newly added codegen surfaces in the UI. Scope is frontend-only (hugging-face.component.ts + its spec).

Supported tasks today (the allowed set): text-generation; 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; automatic-speech-recognition, audio-classification, text-to-speech; text-to-image, text-to-video; question-answering, table-question-answering, zero-shot-classification, sentence-similarity, text-ranking.

How to reproduce?

  1. Add a HuggingFace inference operator and open the task dropdown.
  2. Select an unsupported task, e.g. summarization or translation, pick any model, and
    run the workflow.
  3. The result column contains a raw JSON dump of the endpoint response instead of a
    task-appropriate result, and nothing warned that the task isn't supported.

Version/Branch

1.3.0-incubating-SNAPSHOT (main)

Commit Hash (Optional)

No response

What browsers are you seeing the problem on?

No response

Relevant log output

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions