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

BUG: Tone, Tense, Translation, Noise, ScientificTranslation and Variation converter identifiers ignore a custom prompt_template

Aperta
#3,314 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@ShivamSharma43 ci sta già lavorando.

Dal 18/10/2026.

  • #3316 di @ShivamSharma43 — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
20/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python
Ambito
ai, backend

Direzione di ricerca

The issue identifies six converters in PyRIT: ToneConverter, TenseConverter, TranslationConverter, NoiseConverter, ScientificTranslationConverter, and VariationConverter. Read their identifier-building methods and compare them with LLMGenericTextConverter and IPAConverter, then inspect identifier tests. Done means custom prompt templates produce distinct identifiers from the corresponding built-in templates; linked pull request #3316 shows this work is already under way.

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

Descrizione

Describe the bug

Six LLM-based converters accept a custom prompt_template but leave it out of their identifiers, so a converter with a custom template has the same hash as one with the built-in template:

  • ToneConverter (only tone)
  • TenseConverter (only tense)
  • TranslationConverter (only language)
  • NoiseConverter (only noise and number_errors)
  • ScientificTranslationConverter (only mode, so a built-in mode with a custom template looks like the built-in one)
  • VariationConverter (no params at all)

The template is the system prompt sent to the converter target, so it changes the output. LLMGenericTextConverter already identifies its templates with system_prompt_template_hash and user_prompt_template_hash, and IPAConverter keeps them by building on super()._build_identifier(), but these six subclasses replace the base params instead.

Because the default registry name comes from that hash, registering a converter with a custom template next to the default one raises a duplicate-name error, and memory and analytics cannot tell the two apart. This is the same problem as #3287, for the LLM-based converters.

Steps/Code to Reproduce
import asyncio

from pyrit.converter import (
    NoiseConverter,
    ScientificTranslationConverter,
    TenseConverter,
    ToneConverter,
    TranslationConverter,
    VariationConverter,
)
from pyrit.models import SeedPrompt
from pyrit.prompt_target import OpenAIChatTarget
from pyrit.setup import IN_MEMORY, initialize_pyrit_async

asyncio.run(initialize_pyrit_async(memory_db_type=IN_MEMORY))
target = OpenAIChatTarget(endpoint="https://example.invalid/openai/v1", api_key="unused", model_name="gpt-4o")


def custom(text: str, *params: str) -> SeedPrompt:
    return SeedPrompt(value=text, data_type="text", parameters=list(params))


pairs = [
    (
        ToneConverter(converter_target=target, tone="angry"),
        ToneConverter(converter_target=target, tone="angry", prompt_template=custom("Rewrite in a {{ tone }} tone, in French.", "tone")),
    ),
    (
        TenseConverter(converter_target=target, tense="past"),
        TenseConverter(converter_target=target, tense="past", prompt_template=custom("Use the {{ tense }} tense, as a poem.", "tense")),
    ),
    (
        TranslationConverter(converter_target=target, language="French"),
        TranslationConverter(converter_target=target, language="French", prompt_template=custom("Translate to {{ language }} slang.", "language")),
    ),
    (
        NoiseConverter(converter_target=target),
        NoiseConverter(converter_target=target, prompt_template=custom("Add {{ number_errors }} typos: {{ noise }}", "noise", "number_errors")),
    ),
    (
        ScientificTranslationConverter(converter_target=target, mode="academic"),
        ScientificTranslationConverter(converter_target=target, mode="academic", prompt_template=custom("Rewrite as a lab report.")),
    ),
    (
        VariationConverter(converter_target=target),
        VariationConverter(converter_target=target, prompt_template=custom("Give {{ number_iterations }} rhyming variations.", "number_iterations")),
    ),
]
for default, custom_one in pairs:
    print(default.get_identifier().unique_name, custom_one.get_identifier().unique_name)
Expected Results

Each pair has two different identifiers.

Actual Results
ToneConverter::71c29a7e ToneConverter::71c29a7e
TenseConverter::b9a79a58 TenseConverter::b9a79a58
TranslationConverter::04918fb0 TranslationConverter::04918fb0
NoiseConverter::a5ec8804 NoiseConverter::a5ec8804
ScientificTranslationConverter::a303aaf0 ScientificTranslationConverter::a303aaf0
VariationConverter::46dc63ec VariationConverter::46dc63ec
Screenshots

N/A

Versions
  • OS: Windows 11
  • Python version: 3.11.9
  • PyRIT version: installed from main (f277fedd) in editable mode
Lingua principale
Python
Stelle
4.6k
Fork
962
Merge medio
2g 16h
PR unite (30g)
354

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.