FEAT Add focused enum and word-selection converter inputs - #2708
Richard Lundeen (richlundeen) wants to merge 3 commits into
Conversation
Resolve constructor annotations and enum inputs at the registry boundary. Add built-in word-selection metadata and controls through shared parameter helpers, preserving nullable defaults and explicit empty lists. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Allow top-level string union members without enabling unsupported nested object inputs. Cover SearchReplaceConverter creation and both union orders. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Behnam (behnam-o)
left a comment
There was a problem hiding this comment.
I left a comment on how I think this fix can be more general and not a special case to handle word selection ... let me know if it doesn't make sense ... I am not against how it looks today if you think the generic solution/suggestion adds more complexity than necessary.
| exclude=True, | ||
| description="Set when the parameter references another registry component (resolved by name); not serialized.", | ||
| ) | ||
| word_selection: dict[str, list[Parameter]] | None = Field( |
There was a problem hiding this comment.
[GHCP assisted] Could this be modeled as a generic structured registry input rather than a word-selection special case?
Parameter.word_selection, _STRATEGIES in the shared resolution_custom.py, and the converter-dialog rendering branch couple shared registry/UI infrastructure to one converter concept. The next target, scorer, or scenario needing an allowlisted structured input would likely require the same pattern again.
I prototyped a generic variant contract here: behnam-o@a3b3016. The allowlist remains domain-owned by WordSelectionStrategy, while shared registry and form code handle variant metadata, resolution, and rendering generically. It removes the custom resolver and adds about 121 net production lines. Would you consider this direction?
Description
Add focused registry and GUI support for enum and built-in word-selection inputs, without a general structured-object resolver or broad form rewrite.
Parametercoercion for enum names, values, existing members, and native numeric values. Keep Binary's strict enum check and distinguish invalid inputs (400) from unexpected constructor errors (500).{ "type": "random", "parameters": { "proportion": 0.3, "seed": 42 } }and the six other built-in word-selection types. Derive nested controls from backend parameter metadata; do not allow arbitrary class imports.Tests and Documentation
check-added-large-files, whose internalgit check-attrcall exits 128 in the cached hook environment. A separate size check confirmed all staged files are below the configured 3 MiB limit (largest: 61,091 bytes).Source branch:
richlundeen/PyRIT:richlundeen-focused-converter-inputs. Target:microsoft/PyRIT:main.