Skip to content

Ignore blank lines when reading TXT prompts#1480

Open
biefan wants to merge 1 commit intoAzure:mainfrom
biefan:fix-txt-reader-blank-lines
Open

Ignore blank lines when reading TXT prompts#1480
biefan wants to merge 1 commit intoAzure:mainfrom
biefan:fix-txt-reader-blank-lines

Conversation

@biefan
Copy link
Contributor

@biefan biefan commented Mar 16, 2026

Summary

  • skip blank and whitespace-only lines when parsing TXT prompt files
  • add a regression test covering mixed prompt and blank lines

Problem

pyrit.common.text_helper.read_txt() currently turns every input line into a prompt entry after strip(). This means blank lines are loaded as {"prompt": ""}, which silently injects empty prompts into TXT-backed datasets.

Testing

  • .venv/bin/pytest tests/unit/common/test_text_helper.py -q

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.

2 participants