FEAT: Runtime capability discovery for prompt targets#1699
Open
hannahwestra25 wants to merge 12 commits intomicrosoft:mainfrom
Open
FEAT: Runtime capability discovery for prompt targets#1699hannahwestra25 wants to merge 12 commits intomicrosoft:mainfrom
hannahwestra25 wants to merge 12 commits intomicrosoft:mainfrom
Conversation
…lities in verify_target_async
romanlutz
reviewed
May 8, 2026
| ) | ||
|
|
||
| # Probe a single dimension: | ||
| verified_caps = await query_target_capabilities_async(target=target) |
Contributor
There was a problem hiding this comment.
It would be more intuitive IMO if it was target.get_capabilities() or (even better) target.capabilities (and similarly target.input_modalities / target.output_modalities) since these are static after instantiation (right?).
Having to import a function makes it a bit more obscure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds query_target_capabilities.py, which probes a
PromptTargetat runtime to determine what the underlying endpoint actually accepts. Useful for custom OpenAI-compatible endpoints, gateways that strip features, or any deployment where declared capabilities may not match real behavior.New public API (exported from
pyrit.prompt_target)query_target_capabilities_async— probes boolean capability flags (SYSTEM_PROMPT,MULTI_MESSAGE_PIECES,MULTI_TURN,JSON_OUTPUT,JSON_SCHEMA).verify_target_modalities_async— probes which input-modality combinations are accepted.verify_target_async— runs both and returns a populatedTargetCapabilities.Each probe is bounded by
per_probe_timeout_s(default 30s) and retried once on transient errors. The target's configuration is temporarily replaced with a permissive one so_validate_requestdoesn't short-circuit. Probe-written memory rows are tagged withprompt_metadata["capability_probe"] == "1".Caveats (in docstrings)
Tests & docs