BUG: SelfAskGeneral scorers leave their output keys out of the identifier

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

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

@Hrushikesh-ramilla がすでに取り組んでいます。

2026年11月3日 から。

  • #3847 @Hrushikesh-ramilla による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
ai

調査の方向性

pyrit/score/self_ask_general_true_false_scorer.py(136行目付近)の _build_identifier と、pyrit/score/self_ask_general_float_scale_scorer.py(137行目付近)の対応するメソッドから始め、5つの *_output_key 引数のうちどれがすでに記録されているかを確認してください。不足しているキーを両方の識別子に追加し、その後 issue の再現スクリプトを実行して、異なる出力キーが異なる unique_name ハッシュを生成するようになったことを確認してください。両方のスコアラーの識別子がキーごとに異なり、既存のスコアラーのテストが引き続き通れば完了です。

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

説明

Bug: triage
Describe the bug

The five *_output_key arguments of SelfAskGeneralTrueFalseScorer and SelfAskGeneralFloatScaleScorer decide which field of the judge's JSON becomes the score, the rationale and the rest. _build_identifier records none of them (self_ask_general_true_false_scorer.py:136, self_ask_general_float_scale_scorer.py:137), so two scorers that read different fields share one hash. Split out of #3477, which only closes the converter side.

Steps/Code to Reproduce

Run on main at 5fb4fb977.

import asyncio

from pyrit.prompt_target import OpenAIChatTarget
from pyrit.score import NumericRange, SelfAskGeneralFloatScaleScorer, SelfAskGeneralTrueFalseScorer
from pyrit.setup import IN_MEMORY, initialize_pyrit_async


async def main() -> None:
    await initialize_pyrit_async(memory_db_type=IN_MEMORY, silent=True)
    target = OpenAIChatTarget(endpoint="https://example.invalid/v1", api_key="unused", model_name="model-a")
    for key in ("score_value", "verdict"):
        kwargs = {"chat_target": target, "system_prompt_format_string": "Score this.", "score_value_output_key": key}
        print(key, SelfAskGeneralTrueFalseScorer(**kwargs).get_identifier().unique_name)
        print(key, SelfAskGeneralFloatScaleScorer(scale=NumericRange(minimum_value=0, maximum_value=100), **kwargs).get_identifier().unique_name)


asyncio.run(main())
Expected Results

Different output keys, different identifiers.

Actual Results
score_value SelfAskGeneralTrueFalseScorer::ddd340c4
score_value SelfAskGeneralFloatScaleScorer::61870892
verdict SelfAskGeneralTrueFalseScorer::ddd340c4
verdict SelfAskGeneralFloatScaleScorer::61870892
Versions
  • OS: Windows 11
  • Python version: 3.12.0
  • PyRIT version: source checkout of main at 5fb4fb977
System:
    python: 3.12.0 (tags/v3.12.0:0fb18b0, Oct  2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)]
executable: C:\dev\pyr-main\Scripts\python.exe
   machine: Windows-11-10.0.26300-SP0

Python dependencies:
        pyrit: 1.2.0.dev0
       Cython: None
        numpy: 2.4.6
       openai: 2.54.0
    packaging: 26.3
          pip: 23.2.1
        scipy: 1.17.1
   setuptools: 84.2.1
      sqlite3: None
        torch: None
 transformers: 5.20.2

The scorer side of the registry-wide test can pick this up once #3312 lands.

主要言語
Python
スター
4.7k
フォーク
1k
平均マージ
2日 3時間
マージ済み PR(30日)
450

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

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

microsoft/PyRIT のほかの issue

microsoft/PyRIT の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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