BUG: CharacterSpaceConverter introduces whitespace holes and trailing whitespace
メンテナーはふだん 2 日以内に返信
評価
調査の方向性
PyRIT のソースコードから CharacterSpaceConverter とそのテストを見つけてください。コンバーターの実装を読み、まず既存のコンバーターテストを実行してください。その後、単語間の句読点、短縮形、末尾の句読点を対象とするテストを追加してください。句読点がスペースの挿入前に取り除かれ、出力が例と一致し、句読点パターンがモジュールレベルで一度だけコンパイルされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
CharacterSpaceConverter spaces out characters with " ".join(prompt) before removing punctuation with re.sub(...). This order of operations introduces whitespace artifacts:
- Stripping punctuation leaves empty character "holes", producing 4 spaces between words (e.g.,
"Hello, world"->"H e l l o w o r l d"instead of the standard 3-space inter-word spacing"H e l l o w o r l d"). - Contractions or mid-word punctuation leave double spaces (e.g.,
"How's"->"H o w s"instead of"H o w s"). - Trailing punctuation leaves unwanted trailing whitespace (e.g.,
"hello!"->"h e l l o ").
Additionally, the punctuation regex is recompiled on every invocation of convert_async rather than precompiled at module level.
Steps/Code to Reproduce
import asyncio
from pyrit.converter import CharacterSpaceConverter
async def main():
converter = CharacterSpaceConverter()
res1 = await converter.convert_async(prompt="hello!")
print(repr(res1.output_text)) # prints 'h e l l o ' with trailing space
res2 = await converter.convert_async(prompt="Hello, world! How's everything?")
print(repr(res2.output_text)) # prints 'H e l l o w o r l d H o w s e v e r y t h i n g '
asyncio.run(main())
Expected Results
Punctuation should be stripped prior to character spacing so spacing remains uniform without artificial gaps or trailing whitespace:
"hello!"->'h e l l o'"Hello, world! How's everything?"->'H e l l o w o r l d H o w s e v e r y t h i n g'
Actual Results
'h e l l o ''H e l l o w o r l d H o w s e v e r y t h i n g '
Versions
- OS: Windows 11
- Python version: 3.12
- PyRIT version: main
- 主要言語
- Python
- スター
- 4.7k
- フォーク
- 1k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 510
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/PyRIT のほかの issue
-
BUG: HuggingFaceChatTarget runs model.generate() on the event loop対応中かも @Shizoqua が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 2 日以内に返信
-
BUG: StaticPromptInjectionScorer misses modern frontier chat template delimiters (DeepSeek, Cohere Command R, Mistral)対応中かも @Kaap10 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
Parameter required status is lost after wire round-trip対応中かも @its-amann が 3 日前に担当しました。 オープンBug: triage help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
microsoft/PyRIT#3854 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
BUG: LLMGenericTextConverter identifier changes between processes for set-valued template parameters対応中かも @samrudhi03 が 3 日前に担当しました。 オープンBug: triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
microsoft/PyRIT#3841 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
BUG: SelfAskGeneral scorers leave their output keys out of the identifier対応中かも @Hrushikesh-ramilla が 4 日前に担当しました。 オープンBug: triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信
microsoft/PyRIT の issue をすべて見る
似ている issue
-
ChatBedrockConverse changes the keys of JSON tool results to camelCase (`order_id` becomes `orderId`)対応中かも @geyazheng が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
langchain-ai/langchain-aws#1469 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
b4b usability
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
fix(schedule): align list_tasks since cursor filter boundary from strict > to >=対応中かも @bfs2021 が今日担当しました。 オープンagent-ready bug p2 schedule
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
allenporter/supernote#540 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
frazane/scoringrules#164 ·
メンテナーはふだん 1 日以内に返信