Repository navigation
Description
Is your feature request related to a problem? Please describe.
PromptTemplateConverter._build_identifier() currently stores the complete template string in params["template"]. Long templates therefore make the identifier metadata larger wherever it is serialized or persisted.
The template already contributes to the overall identifier hash, so this is not a missing-identity or hash-collision bug. The goal is smaller identifier metadata and consistency with converters that identify templates by a content hash.
Describe the solution you'd like
Replace the full template in PromptTemplateConverter identifier params with a deterministic template_hash, following the existing convention in LLMGenericTextConverter and TemplateSegmentConverter: SHA-256 of the template's UTF-8 bytes, truncated to 16 hexadecimal characters.
Keep strip_characters in the identifier and leave conversion output unchanged. Hash the configured template, not the rendered prompt or input text.
Add regression tests covering equivalent independently constructed templates, different templates, changes to strip_characters, and a long template whose identifier contains only the fixed-size template hash rather than its full text. Document the resulting one-time change to identifier hashes and autogenerated registry names. Preserve the deprecated TaskFramingConverter identifier compatibility.
Describe alternatives you've considered, if relevant
Keep the full template in identifier params. This preserves existing hashes and makes the template directly inspectable, but retains potentially large metadata. Do not simply truncate the template text, since templates that differ after the cutoff must still have different identities.
Additional context
pyrit/converter/prompt_template_converter.py: currently stores the full template.pyrit/converter/llm_generic_text_converter.pyandpyrit/converter/template_segment_converter.py: existing template-hash patterns.- FEAT: Add PromptTemplateConverter and deprecate TaskFramingConverter #2845 introduced
PromptTemplateConverter. - Related FIX Include the prompt template in Tone, Tense, Translation, Noise, ScientificTranslation and Variation converter identifiers #3316 retains template hashes in six LLM converter subclasses, but does not change
PromptTemplateConverter.
This issue is scoped to the representation of the template in PromptTemplateConverter identifiers, not a broader converter refactor.
Activity
romanlutz commentedon Oct 19, 2026
this is assigned to Isaac Emmanuel (@1cbyc) (even though the GH UI doesn't let me assign without them having commented here). Please don't submit duplicate PRs!