[Core] Add token_ids output type and enforce canonical names (#7843)

Signed-off-by: Jungle430 <junglece430@gmail.com>
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
JungleandCodex authored and GitHub committed 2026-10-05 16:49:03 +08:00
1 parent 0b0d2d7009
commit 67d21b5fff
12 files changed
+471 -58

No files matched your search

+5 -1
View File
@@ -46,6 +46,8 @@ def _modality_to_type_string(modality: OutputModality) -> str:
return "image"
if OutputModality.LATENT in modality:
return "latent"
if OutputModality.TOKEN_IDS in modality:
return "token_ids"
except TypeError:
# Flag identity mismatch (e.g. after module reload in tests).
name = getattr(modality, "name", "") or ""
@@ -56,6 +58,8 @@ def _modality_to_type_string(modality: OutputModality) -> str:
return "image"
if "latent" in lowered:
return "latent"
if "token_ids" in lowered:
return "token_ids"
return "text"
@@ -410,7 +414,7 @@ class MultimodalOutputProcessor(VLLMOutputProcessor):
log_stats: Whether to log statistics
stream_interval: Stream interval for output generation
engine_core_output_type: Optional output type string (e.g.,
"image", "audio", "latent"). Converted to OutputModality
"image", "audio", "latent", "token_ids"). Converted to OutputModality
internally. Kept for backward compatibility with
stage_init_utils.
output_modality: Type-safe output modality flag. Used to tag