Skip to content

Fix provider message preprocessing regressions - #9840

Draft
taking-lying-flat wants to merge 1 commit into
modelscope:mainfrom
taking-lying-flat:agent/fix-provider-message-preprocessing
Draft

Fix provider message preprocessing regressions#9840
taking-lying-flat wants to merge 1 commit into
modelscope:mainfrom
taking-lying-flat:agent/fix-provider-message-preprocessing

Conversation

@taking-lying-flat

Copy link
Copy Markdown
Contributor

Summary

  • keep pretokenized List[int] message content out of Anthropic auto-detection
  • propagate images extracted from Anthropic rejected_messages to rejected_images
  • reject ambiguous rows that provide both embedded rejected image blocks and top-level rejected_images
  • add regression coverage for pretokenized messages and rejected multimodal preference data

Root cause

#9809 added provider auto-detection that called block.get() for every item in list-valued message content. SWIFT also supports list-valued pretokenized token IDs, so valid List[int] content raised AttributeError during preprocessing.

The recursive rejected_messages path retained only the normalized messages from its temporary result. Anthropic image extraction therefore left <image> placeholders in the rejected messages while discarding the corresponding media.

Impact

Pretokenized datasets continue through MessagesPreprocessor unchanged, and Anthropic multimodal preference rows retain their rejected images without silently overriding an explicitly supplied top-level field.

Follow-up to #9809.

Validation

  • 10 focused TestRejectedMessagesPreprocess and TestProviderMessagesPreprocess tests passed
  • flake8 passed for both changed files
  • isort --check-only passed for both changed files
  • yapf --diff passed for both changed files
  • git diff --check passed

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant