Skip to content

[BREAKING] FEAT: Add runtime generation configuration - #3506

Merged
Nina Chikanov (nina-msft) merged 56 commits into
microsoft:mainfrom
nina-msft:richlundeen-temporary-component-settings
Nov 10, 2026
Merged

Nina Chikanov (nina-msft) merged 56 commits into
microsoft:mainfrom
nina-msft:richlundeen-temporary-component-settings

Conversation

@nina-msft

@nina-msft Nina Chikanov (nina-msft) commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

  • Add typed RequestGenerationConfig metadata for per-request temperature, with strict current-message validation and capability checks. Runtime selections do not mutate shared target defaults or cached identities.
  • Share runtime support across OpenAIChatTarget, OpenAICompletionTarget, and OpenAIResponseTarget. Unknown models default to supported in these text adapters; known exclusions and configured sampling modes still apply. Image, TTS, Video, and Realtime remain unsupported.
  • Resolve request-local values with passthrough precedence and retain them through transport retries and Responses tool continuations. RoundRobinTarget enables delegation only when every child supports temperature and validates all children before dispatch/fallback.
  • Advertise inclusive capabilities.temperature_range bounds. OpenAI-compatible text adapters normally accept 0–2; live verification confirmed Mistral-Large-3 accepts 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.
  • Keep a compact dropdown directly below Send. The GUI uses the same capability and range as backend validation. Temperature footers appear only for a target that supports runtime temperature and messages with recorded evidence; unknown provider defaults stay unknown.
  • Treat saved _pyrit_generation evidence as server-authored: unchanged source copies retain it, while edited/new history and send=false appends cannot introduce client-authored evidence.
  • Remove the obsolete editor temperature-variant creation path from FEAT: Adding Temporary Instance Creation from the Registry #3030; retain generic component construction and saved binding support.

Breaking REST change: target responses drop supports_temperature_override, reconstructable, and reconstruction_error. Runtime controls use capabilities.supports_temperature instead 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.1 unsupported has been removed because Responses now supports runtime temperature.

Supported — OpenAIChatTarget (gpt-5.4), override set to 0

The dropdown sits directly below Send, showing a chevron when editable and the value when overridden.

Supported target with the compact zero-temperature dropdown directly below Send

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.

Supported target with the single temperature field and optional help

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.

main at c188d2157 is merged. Final follow-up commit: ab8cad97b. 633 focused Python tests and 452 frontend tests passed. All applicable pre-commit hooks, including the full pyrit type 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:

.\.venv\Scripts\python.exe -m pytest tests\unit\prompt_target\target\test_runtime_temperature.py tests\unit\prompt_target\test_round_robin_target.py tests\unit\prompt_target\target\test_target_capabilities.py tests\unit\prompt_target\target\test_target_configuration.py tests\unit\backend\test_temporary_components.py -q --tb=short --disable-warnings

MessageList and ChatWindow regressions: 395 passed across two complete suites. From frontend:

npm test -- --runInBand --silent src\components\Chat\MessageList.test.tsx src\components\Chat\ChatWindow.test.tsx

Generation settings and metadata/range utilities: 57 passed across two complete suites. From frontend:

npm test -- --runInBand --silent --runTestsByPath src\components\Chat\GenerationSettings.test.tsx src\utils\requestGeneration.test.ts

Frontend types and changed-file lint: passed. From frontend:

npm run type-check
npx eslint src\components\Chat\ChatWindow.tsx src\components\Chat\ChatWindow.test.tsx src\components\Chat\MessageList.tsx src\components\Chat\MessageList.test.tsx src\components\Chat\GenerationSettings.tsx src\components\Chat\GenerationSettings.test.tsx src\utils\requestGeneration.ts src\utils\requestGeneration.test.ts src\types\index.ts --max-warnings 0

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:

$env:PATH = (Join-Path (Get-Location) '.venv\Scripts') + ';' + $env:PATH
$files = @(git diff --name-only)
python -m pre_commit run --files @files

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 accepted 2; Mistral-Large-3 rejected 2 with 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.

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
Comment thread doc/code/targets/0_prompt_targets.md Resolved
@hannahwestra25

Copy link
Copy Markdown
Collaborator

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
@nina-msft Nina Chikanov (nina-msft) changed the title [DRAFT] FEAT: Allow per-send temperature in OpenAI Chat and Chat UI [DRAFT] [BREAKING] FEAT: Add runtime generation configuration Oct 31, 2026
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
Copilot AI balanced review requested due to automatic review settings November 2, 2026 19:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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
@nina-msft
Nina Chikanov (nina-msft) marked this pull request as ready for review November 3, 2026 00:36
@nina-msft Nina Chikanov (nina-msft) changed the title [DRAFT] [BREAKING] FEAT: Add runtime generation configuration [BREAKING] FEAT: Add runtime generation configuration Nov 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor review notes are inline.

Comment thread doc/code/targets/0_prompt_targets.md Resolved
Comment thread doc/gui/0_gui.md Resolved
@richlundeen

Copy link
Copy Markdown
Contributor

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:

  • Move the compact control to the right, directly below the Send arrow.
  • Use one Temperature override field: blank means use the target default, a number overrides it (including 0), and clearing restores the default. Keep validation inline.
  • Move persistence/default explanations into optional help. For unsupported targets, use a short disabled state/reason rather than the full form; any retained override must still be clearable.

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.

Generation settings popover covering the chat composer with verbose copy and an unsupported temperature field

@hannahwestra25

Copy link
Copy Markdown
Collaborator

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 :
image
which would mean keeping it on the left but that's a nit

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 hannahwestra25 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@nina-msft
Nina Chikanov (nina-msft) added this pull request to the merge queue Nov 10, 2026
Merged via the queue into microsoft:main with commit 566c3e2 Nov 10, 2026
61 checks passed
@nina-msft
Nina Chikanov (nina-msft) deleted the richlundeen-temporary-component-settings branch November 10, 2026 23:48
Julio César Suástegui (juliosuas) added a commit to juliosuas/PyRIT that referenced this pull request Nov 11, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants