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

Đang mở Phù hợp với người mới
#3,839 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@Hrushikesh-ramilla đang làm issue này rồi.

Từ ngày 3/11/2026.

  • #3847 của @Hrushikesh-ramilla — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
ai

Hướng nghiên cứu

Bắt đầu từ _build_identifier trong pyrit/score/self_ask_general_true_false_scorer.py (khoảng dòng 136) và phương thức tương ứng trong pyrit/score/self_ask_general_float_scale_scorer.py (khoảng dòng 137), sau đó kiểm tra xem trong năm đối số *_output_key đã có những đối số nào được ghi lại. Thêm các khóa còn thiếu vào cả hai identifier, rồi chạy script tái hiện trong issue để xác nhận các output key khác nhau hiện tạo ra các hash unique_name khác nhau. Hoàn thành khi identifier của hai scorer khác nhau với từng khóa và các test scorer hiện có vẫn chạy thành công.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
4.7k
Fork
1k
Merge trung bình
2 ngày 3 giờ
Pull request đã merge (30 ngày)
450

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/PyRIT

Tất cả issue của microsoft/PyRIT

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.