Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

TemplateSegmentConverter crashes on prompts shorter than the template parameter count

クローズ 初心者向け
#2,839 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
tooling

調査の方向性

TemplateSegmentConverter から始め、issue に記載された2語・5パラメータのケースを再現します。内部の分割点のサンプリングと、残りのセグメントの文書化された処理を調べます。短いプロンプトで ValueError が発生しなくなり、利用可能なすべての内部点で分割され、残りの Template パラメータが空のままになれば完了です。

索引モデルが issue の本文から書いたものです。

説明

what happens

TemplateSegmentConverter raises ValueError: Sample larger than population or is negative for any prompt whose word count is between 2 and N-1 when the template has N parameters. the code samples min(len(words), N-1) interior split points but the population is only len(words)-1, so a 2-word prompt against a 5-parameter template tries to sample 2 from a population of 1.

the docstring promises empty leftover segments for short prompts, so this contradicts the documented behavior.

repro

words = ["attack", "target"]
num_params = 5
random.sample(range(1, len(words)), min(len(words), num_params - 1))
# ValueError: Sample larger than population

any converter template with more parameters than the prompt has words minus one hits it.

expected

short prompts split at every available interior point and leave the remaining template parameters empty, as documented.

env: main 5503ecb

主要言語
Python
スター
4.5k
フォーク
896
平均マージ
2日 19時間
マージ済み PR(30日)
206

環境構築

このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/PyRIT のほかの issue

microsoft/PyRIT の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。