Skip to content

FEAT: Runtime capability discovery for prompt targets#1

Draft
hannahwestra25 wants to merge 56 commits into
hawestra/deprecate_prompt_chatfrom
hawestra/query_target_capabilities
Draft

FEAT: Runtime capability discovery for prompt targets#1
hannahwestra25 wants to merge 56 commits into
hawestra/deprecate_prompt_chatfrom
hawestra/query_target_capabilities

Conversation

@hannahwestra25

Copy link
Copy Markdown
Owner

Description

Adds query_target_capabilities_async and verify_target_modalities_async so consumers can probe what a PromptTarget actually supports, instead of trusting its declared TargetConfiguration. Useful for custom OpenAI-compatible endpoints, gateways that strip features, and models whose support drifts.

API (query_target_capabilities.py, exported from pyrit.prompt_target):

  • query_target_capabilities_async(*, target, capabilities=None) — sends a minimal probe per capability (SYSTEM_PROMPT, MULTI_MESSAGE_PIECES, MULTI_TURN, JSON_OUTPUT, JSON_SCHEMA) and returns the verified set. Capabilities without a probe fall back to declared support.
  • verify_target_modalities_async(*, target, test_modalities=None, test_assets=None) — probes input modality combinations; skips those whose assets are missing.

During probing the target's configuration is temporarily replaced with a permissive one so _validate_request doesn't short-circuit, and is always restored on exit.

Tests and Documentation

Tests: test_query_target_capabilities.py covers each probe, the restore guarantee (incl. exception path), subset filtering, modality probing with present/missing assets, and the no-probe fallback.

Docs: new notebook 6_1_target_capabilities.ipynb plus an updated section in 0_prompt_targets.md.

@hannahwestra25 hannahwestra25 force-pushed the hawestra/query_target_capabilities branch from c4f012e to a3873b5 Compare May 8, 2026 16:35
hannahwestra25 and others added 25 commits May 8, 2026 12:36
…soft#1692)

Co-authored-by: Roman Lutz <romanlutz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Roman Lutz <romanlutz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ft#1701)

Co-authored-by: Roman Lutz <romanlutz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…icrosoft#1713)

Co-authored-by: Roman Lutz <romanlutz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
romanlutz and others added 27 commits May 11, 2026 22:34
…microsoft#1709)

Co-authored-by: Roman Lutz <romanlutz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ft#1710)

Co-authored-by: Roman Lutz <romanlutz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…crosoft#1707)

Co-authored-by: Roman Lutz <romanlutz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…narios (microsoft#1695)

Co-authored-by: Behnam Ousat <behnamousat@microsoft.com>
…icrosoft#1718)

Co-authored-by: Roman Lutz <romanlutz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Roman Lutz <romanlutz13@gmail.com>
…ings (microsoft#1723)

Co-authored-by: Roman Lutz <romanlutz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Roman Lutz <romanlutz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Richard Lundeen <rlundeen@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rosoft#1711)

Co-authored-by: Roman Lutz <romanlutz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…crosoft#1705)

Co-authored-by: Roman Lutz <romanlutz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…icrosoft#1706)

Co-authored-by: Roman Lutz <romanlutz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Roman Lutz <romanlutz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Roman Lutz <romanlutz13@gmail.com>
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.

8 participants