fix: make validate_repeat_prompt strip/case-insensitive#1774
fix: make validate_repeat_prompt strip/case-insensitive#1774Chessing234 wants to merge 2 commits into
Conversation
Match IFEvalG so leading whitespace and case no longer fail the check. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Code Review
This pull request updates the validate_repeat_prompt function to strip whitespace and perform case-insensitive comparisons, aligning it with IFEvalG, and adds corresponding unit tests. The review feedback suggests removing a redundant bool() cast, adding a test case to verify handling of whitespace in the original prompt, and replacing the placeholder PR number in the changelog.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| ### Removed | ||
|
|
||
| ### Fixed | ||
| - Make `validate_repeat_prompt` strip/case-insensitive (https://github.com/allenai/open-instruct/pull/1774). |
| def validate_repeat_prompt(text: str, original_prompt: str) -> bool: | ||
| return bool(text.startswith(original_prompt)) | ||
| """Match IFEvalG: strip and compare case-insensitively.""" | ||
| return bool(text.strip().lower().startswith(original_prompt.strip().lower())) |
There was a problem hiding this comment.
| [ | ||
| ("exact", "Hello world answer", "Hello world", True), | ||
| ("leading_space", " Hello world answer", "Hello world", True), | ||
| ("case", "HELLO world answer", "Hello world", True), | ||
| ("missing", "Something else", "Hello world", False), | ||
| ] |
There was a problem hiding this comment.
Summary
startswith, matching IFEvalG.Test plan