Repository navigation
[BREAKING] FEAT: Add runtime generation configuration - #3506
Nina Chikanov (nina-msft) merged 56 commits into
Conversation
Add a typed per-send contract, initial OpenAI Chat support, durable temperature evidence, and future-send Chat controls while preserving configured target defaults and saved variant bindings. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Use known capability profiles and explicit deployment declarations instead of an adapter model allowlist. Restore send-hook retries and pacing while retaining the first temperature resolution. Document GUI verification and remaining scope. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Preserve web-search validation, manual-chat safeguards, and accessible temperature explanations alongside per-send overrides. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Introduce typed generation envelopes and per-parameter temperature resolution, retaining legacy metadata readers and rejecting conflicting formats. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
|
could you add screenshots ? |
Address Hannah's feedback with per-field capability mapping, a set-based adapter contract, generic parameter resolution, and canonical-only metadata. Keep OpenAI capability updates and send-time mode checks aligned and preserve declarations through discovery. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Remove draft history, design decisions, and duplicate capability explanations; retain a concise usage example, default resolution, validation, and saved evidence. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Use shared sampling rules for runtime support and validation, preserve configured defaults and model lifecycle behavior, and document generic generation configuration. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Add composer generation settings and per-message details. Remove obsolete editor temperature-variant creation. Breaking REST change: remove target reconstructable, reconstruction_error, and supports_temperature_override fields. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Resolve composer, editor-test, and GUI documentation conflicts while preserving generation settings and legacy field cleanup. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Resolve runtime temperature support on target instances rather than shared model profiles. Relocate sampling coverage and document the capability boundary. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
There was a problem hiding this comment.
🟡 Changes recommended
After runtime reinitialization removes temperature support, an existing override can block sending while the disabled checkbox prevents users from clearing it.
1 open issue
What changed in this PR
Adds per-request generation configuration to PyRIT, allowing temperature overrides without changing shared targets or saved bindings. This replaces the GUI’s temperature-specific temporary-target flow introduced in #3030.
Changes:
- Adds typed request options, capability validation, and OpenAI Chat temperature resolution with saved request/response evidence.
- Moves generation controls into the composer and displays saved values in message footers.
- Removes obsolete target response fields and updates tests and documentation.
| File | Description |
|---|---|
tests/unit/prompt_target/test_discover_target_capabilities.py |
Tests preservation of generation capabilities during discovery. |
tests/unit/prompt_target/target/test_target_configuration.py |
Verifies generation availability is excluded from identity. |
tests/unit/prompt_target/target/test_target_capabilities.py |
Tests separation of model profiles and runtime support. |
tests/unit/prompt_target/target/test_runtime_temperature.py |
Covers validation, sampling rules, persistence, retries, and isolation. |
tests/unit/prompt_target/target/test_prompt_target.py |
Updates expected response metadata with generation evidence. |
tests/unit/models/test_request_generation_config.py |
Tests generation models and metadata validation. |
tests/unit/backend/test_temporary_components.py |
Tests runtime overrides alongside saved target bindings. |
pyrit/prompt_target/openai/openai_chat_target.py |
Resolves runtime temperature and records submitted values. |
pyrit/prompt_target/common/target_configuration.py |
Excludes generation availability from target hashes. |
pyrit/prompt_target/common/target_capabilities.py |
Clarifies model-profile responsibilities in documentation. |
pyrit/prompt_target/common/prompt_target.py |
Validates request options and associates generation evidence. |
pyrit/prompt_target/common/discover_target_capabilities.py |
Preserves declared fields when resolving capabilities. |
pyrit/models/target/target_capabilities.py |
Adds the runtime temperature capability. |
pyrit/models/target/request_generation_config.py |
Defines request options and resolution evidence. |
pyrit/models/target/__init__.py |
Exports generation models lazily. |
pyrit/models/catalog/target.py |
Removes obsolete target response fields. |
pyrit/models/__init__.py |
Exposes generation models through the public package. |
pyrit/backend/services/message_send_service.py |
Validates generation options before submission. |
pyrit/backend/mappers/target_mappers.py |
Removes reconstruction-derived target flags. |
frontend/src/utils/requestGeneration.ts |
Validates, serializes, and displays generation settings. |
frontend/src/utils/requestGeneration.test.ts |
Tests option serialization and evidence display. |
frontend/src/utils/messageMapper.ts |
Maps saved evidence into message display fields. |
frontend/src/types/index.ts |
Adds generation types and updates target responses. |
frontend/src/services/targetRegistry.ts |
Removes temperature-specific target construction. |
frontend/src/hooks/useConversationDraft.ts |
Removes editor temperature-variant state and creation. |
frontend/src/hooks/useConversationDraft.test.ts |
Tests saves without constructing temperature variants. |
frontend/src/hooks/useAttackTargetResolution.ts |
Stops adding obsolete flags to resolved targets. |
frontend/src/components/Chat/PromptEditor.tsx |
Adds a composer footer slot. |
frontend/src/components/Chat/MessageList.tsx |
Displays saved generation evidence and details. |
frontend/src/components/Chat/MessageList.test.tsx |
Tests generation footers and detail popovers. |
frontend/src/components/Chat/MessageList.styles.ts |
Supports wrapping footers and bounded detail popovers. |
frontend/src/components/Chat/GenerationSettings.tsx |
Adds capability-aware generation controls. |
frontend/src/components/Chat/GenerationSettings.test.tsx |
Tests defaults, overrides, and disabled controls. |
frontend/src/components/Chat/GenerationSettings.styles.ts |
Styles generation controls and summaries. |
frontend/src/components/Chat/ChatWindow.tsx |
Maintains composer selections and attaches per-send options. |
frontend/src/components/Chat/ChatWindow.test.tsx |
Tests runtime settings across sends and navigation. |
frontend/src/components/Chat/ChatWindow.styles.ts |
Removes obsolete temperature-control styles. |
frontend/src/components/Chat/ChatInputArea.tsx |
Integrates generation settings into the composer. |
frontend/src/App.labels.test.tsx |
Updates workspace tests for composer-based settings. |
doc/gui/0_gui.md |
Documents generation controls and saved evidence. |
doc/code/targets/6_1_target_capabilities.py |
Documents model-family sampling rules. |
doc/code/targets/6_1_target_capabilities.ipynb |
Synchronizes capability documentation in the notebook. |
doc/code/targets/0_prompt_targets.md |
Documents SDK request options and generation evidence. |
doc/code/registry/0_registry.md |
Separates runtime settings from target reconstruction. |
Review effort: Balanced
Reset retained generation settings on target identity changes and allow clearing unsupported overrides. Strip request-only options from synthesized responses while retaining evidence, and preserve explicit null passthrough payloads across retries. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Preserve request-generation controls alongside the shared responsive layout hook from main. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Replace incomplete message mocks so metadata validation exercises real request and response objects without weakening the generation contract. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Richard Lundeen (richlundeen)
left a comment
There was a problem hiding this comment.
Two minor review notes are inline.
|
After trying this in the GUI, I think this is too much UI and text for a single override. The large popover covers the composer, puts the setting far from Send, and requires a checkbox before the actual input. The unsupported state in this screenshot still shows the entire unusable form. Please simplify it:
This could become a compact request-options area for JSON schema/structured output and other supported parameters later. I'd keep that broader support as a contained follow-up; simplifying this temperature control belongs in this PR. |
|
agree with Richard Lundeen (@richlundeen) on simplifying the generation settings but I think the whole send input field could use a re-vamp. I like how ghcp does it : |
Replace target temperature_range properties with a capability-keyed generation_range lookup and validate numeric bounds in PromptTarget. Preserve the temperature constructor option and API descriptors, including wrapper intersections and reconstruction. Address review feedback by making the OpenAI range helper private and normalizing model lookup casing. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
…rage Clarify SDK range lookup versus constructor and REST fields, and preserve provider model-name casing. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
hannahwestra25
left a comment
There was a problem hiding this comment.
lgtm :) small nits / comments
Retain staged-upload reuse, requested generation settings, and saved generation display while resolving frontend conflicts. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Keep runtime generation controls when merging the accessibility updates. Handle Escape on the dialog surface and retain intentional focus when opening the editor. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Replace temperature-specific bounds with option-keyed generation_ranges across SDK targets, reconstruction, REST descriptors, and clients. Remove the TemperatureRange alias, clarify adapter responsibilities, and preserve the existing Python-only declaration boundary. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Preserve request-scoped generation settings alongside saved capability snapshots and scoped round-robin dispatch. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ff01f02a-4d7d-489e-8dff-0cfb75e59876
Brings in microsoft#3506 (runtime generation configuration) and the rest of main since microsoft#3663. ChatWindow keeps the extracted send workflow; microsoft#3506's send path moves into useChatSend: - the request carries the composer's generation draft, snapshotted on the pending send and parsed against the target when the send starts; - the first piece carries request_generation_config instead of a temperature-rebuilt target binding (buildTemperatureTarget is gone, along with the now-unused targetResolutionStatus option); - a first send reports its created attack so ChatWindow keeps the next-send draft across that route change. ChatWindow keeps the draft state, generation settings UI and the send-disabled reason. useChatSend tests cover the request metadata, the send-time snapshot, the created-attack callback and out-of-range input.



Description
RequestGenerationConfigmetadata for per-request temperature, with strict current-message validation and capability checks. Runtime selections do not mutate shared target defaults or cached identities.OpenAIChatTarget,OpenAICompletionTarget, andOpenAIResponseTarget. Unknown models default to supported in these text adapters; known exclusions and configured sampling modes still apply. Image, TTS, Video, and Realtime remain unsupported.RoundRobinTargetenables delegation only when every child supports temperature and validates all children before dispatch/fallback.capabilities.temperature_rangebounds. OpenAI-compatible text adapters normally accept 0–2; live verification confirmedMistral-Large-3accepts 0–1, so it remains supported with a narrower range. RoundRobin exposes the intersection of child ranges. Additive runtime capability fields do not change existing configuration hashes._pyrit_generationevidence as server-authored: unchanged source copies retain it, while edited/new history andsend=falseappends cannot introduce client-authored evidence.Breaking REST change: target responses drop
supports_temperature_override,reconstructable, andreconstruction_error. Runtime controls usecapabilities.supports_temperatureinstead of temporary-target reconstruction.Fixed/adaptive attack-policy configuration identity, effective-value evaluation grouping, and coordinated resume/replay changes remain outside this slice; this PR does not claim to complete those parts of User Story 13354.
GUI screenshots
The compact-control captures below remain representative. No provider requests were sent for these captures. The earlier screenshot labeling Responses
gpt-4.1unsupported has been removed because Responses now supports runtime temperature.Supported — OpenAIChatTarget (gpt-5.4), override set to
0The dropdown sits directly below Send, showing a chevron when editable and the value when overridden.
Supported — compact editor
One field, no checkbox. Blank uses the target default; target-specific bounds are available in help and enforced during editing and submission.
Tests and Documentation
Audited all documentation changed by the PR: registry and target guides, paired capability notebook/script, GUI guide, and backend README. Updated RoundRobin delegation, model-specific bounds, and marker visibility; notebook cells remain synchronized and existing outputs are preserved.
mainatc188d2157is merged. Final follow-up commit:ab8cad97b. 633 focused Python tests and 452 frontend tests passed. All applicable pre-commit hooks, including the fullpyrittype check, passed. These are focused suites, not a full-repository test claim.Validation commands and results
Python runtime temperature, RoundRobin, capability/configuration, and backend descriptor regressions: 633 passed. From the repository root:
MessageList and ChatWindow regressions: 395 passed across two complete suites. From
frontend:Generation settings and metadata/range utilities: 57 passed across two complete suites. From
frontend:Frontend types and changed-file lint: passed. From
frontend:All applicable configured pre-commit hooks: passed, including documentation validation, notebook sanitation, Ruff, and
uv run --frozen --extra all --link-mode=copy ty check pyrit. Run from the repository root before staging/committing the final changes:Live provider check: all 27 text-capable targets advertising support before RoundRobin was enabled were sent a harmless request at
0.7. Eight accepted; 19 failed for authentication, connectivity, or model/endpoint availability reasons and remain inconclusive for temperature support. Of the eight responsive targets, seven also accepted2; Mistral-Large-3 rejected2with an explicit 0–1 range error. No authentication or availability failure was used to infer lack of temperature support.Paired notebook/script source cells were compared with Jupytext; saved outputs were checked against the pre-change notebook. Notebook code was not executed.