Python: skip empty and whitespace-only instructions in prepend - #8524
Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
Conversation
|
Manohar Paturi (@ManoharPaturi), thanks for the contribution. The current head is not green: |
8d04a9b to
9e42c3b
Compare
|
Eduard van Valkenburg (@eavanvalkenburg) the branch was cut from an older main which is what the failing package/pre-commit checks were tripping over. rebased onto current main (the actual change is 2 files, 28 lines), tests pass, and the body now follows the template with Fixes #8523. pushed in 9e42c3b. |
|
Eduard van Valkenburg (@eavanvalkenburg) the remaining pre-commit failure was two stray blank lines at the top of the test file that pyupgrade rewrites. cleaned up and pushed, checks should go green now. |
9e42c3b to
6a9f002
Compare
Only None short-circuited before; an instructions value of "" (the usual unset-options default) still injected a system message with empty content ahead of the conversation. Empty and all-whitespace entries are dropped, and a real instruction prepends verbatim. Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
6a9f002 to
65d91df
Compare
|
Eduard van Valkenburg (@eavanvalkenburg) found the remaining one: the new test file was missing the copyright notice header that the core lint requires (and ruff reflowed one import while i was in there). header added, all three hooks pass locally now (ruff clean, pyupgrade idempotent, tests 3/3). pushed. |
Motivation & Context
prepend_instructions_to_messagesadds an empty system message for each empty or whitespace-only string in the instructions list, so options likeinstructions=["", "Be helpful"]produce a blank system message ahead of the real one. Reported in #8523.Description & Review Guide
Related Issue
Fixes #8523
Contribution Checklist