Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

BUG: ComicJailbreak max_examples counts goals that render nothing, so templates=["code"] with max_examples=10 fails

Aperta Adatta ai principianti
#3,589 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@ShivamSharma43 ci sta già lavorando.

Dal 27/10/2026.

  • #3590 di @ShivamSharma43 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
testing-qa

Direzione di ricerca

Leggi pyrit/datasets/seed_datasets/remote/comic_jailbreak_dataset.py, in particolare _fetch_dataset_async, e segui come vengono conteggiati gli obiettivi rispetto a max_examples quando manca il testo del modello selezionato. Inizia verificando i casi segnalati per code, instruction e un limite pari a zero. Il lavoro è completato quando il limite conta gli obiettivi renderizzati e i valori inferiori a 1 generano il ValueError indicato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

_ComicJailbreakDataset (pyrit/datasets/seed_datasets/remote/comic_jailbreak_dataset.py) documents max_examples as the "maximum number of source goals to render", but _fetch_dataset_async counts every goal it looks at, including goals that have no text for any of the selected templates and so render nothing. In the dataset, 213 of the 300 goals have no Code text, 61 have no Instruction text and 59 have no Speech text, so the cap is used up by goals that produce no seeds:

  • templates=["code"], max_examples=10: none of the first 10 goals has Code text, so nothing is rendered and loading fails with SeedDataset cannot be empty.
  • templates=["instruction"], max_examples=10: only 2 goals are rendered.

The cap is also checked only after a goal has been rendered, so max_examples=0 (or a negative value) still renders one goal.

Steps/Code to Reproduce
import asyncio

from pyrit.datasets.seed_datasets.remote.comic_jailbreak_dataset import _ComicJailbreakDataset
from pyrit.models import SeedObjective
from pyrit.setup.initialization import IN_MEMORY, initialize_pyrit_async


async def main():
    await initialize_pyrit_async(memory_db_type=IN_MEMORY)
    for templates, max_examples in ((["code"], 10), (["instruction"], 10), (["article"], 0)):
        try:
            loader = _ComicJailbreakDataset(templates=templates, max_examples=max_examples)
            dataset = await loader.fetch_dataset_async(cache=False)
        except ValueError as e:
            print(f"templates={templates} max_examples={max_examples}: ValueError: {str(e).splitlines()[0]}")
            continue
        goals = {s.value for s in dataset.seeds if isinstance(s, SeedObjective)}
        print(f"templates={templates} max_examples={max_examples}: {len(goals)} goals")


asyncio.run(main())
Expected Results

max_examples goals are rendered for each template, and a cap below 1 is rejected:

templates=['code'] max_examples=10: 10 goals
templates=['instruction'] max_examples=10: 10 goals
templates=['article'] max_examples=0: ValueError: max_examples must be at least 1 or None, got 0
Actual Results
templates=['code'] max_examples=10: ValueError: 1 validation error for SeedDataset
templates=['instruction'] max_examples=10: 2 goals
templates=['article'] max_examples=0: 1 goals

The first error is SeedDataset cannot be empty.

Screenshots

N/A

Versions
  • OS: Windows 11
  • Python version: 3.11.9
  • PyRIT version: installed from main (6224d531) in editable mode
Lingua principale
Python
Stelle
4.7k
Fork
980
Merge medio
2g 9h
PR unite (30g)
422

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/PyRIT

Tutte le issue di microsoft/PyRIT

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.