FEAT Migrate consumers to TargetConfiguration capability checks#1645
Open
hannahwestra25 wants to merge 11 commits intomicrosoft:mainfrom
Open
FEAT Migrate consumers to TargetConfiguration capability checks#1645hannahwestra25 wants to merge 11 commits intomicrosoft:mainfrom
TargetConfiguration capability checks#1645hannahwestra25 wants to merge 11 commits intomicrosoft:mainfrom
Conversation
…ments & migrate towards using target config from target capabilities and misc checks
…ra/move_to_target_config
…ra/move_to_target_config
…ra/move_to_target_config
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.
Summary
Replaces scattered
isinstance(target, PromptChatTarget)checks with explicit, declarative capability requirements validated againstTargetConfiguration. Consumers now care about capabilities, not concrete target types.The bigger picture
Next step in the migration from type-based gating to the
TargetConfiguration/TargetCapabilities/CapabilityHandlingPolicymodel. With this change, scorers, converters, and attacks can accept anyPromptTargetwhose configuration satisfies their declared requirements — natively or via anADAPTnormalization pipeline — opening non-chat targets to flows previously locked to chat-shaped APIs.What changed
set_system_promptmoved fromPromptChatTargetontoPromptTarget(capability gates behavior, not subclass identity).TargetRequirementsgains:required— satisfied by native support orADAPTpolicy.native_required— must be natively supported;ADAPTis rejected.validate(*, target)— enforces both tiers, called automatically by base classes.CHAT_CONSUMER_REQUIREMENTSintroduced as the shared constant for scorers/converters.TARGET_REQUIREMENTS = CHAT_CONSUMER_REQUIREMENTSand validate in__init__;chat_target/converter_targetparams typed asPromptTarget.AttackStrategyexposesTARGET_REQUIREMENTSand validates theobjective_targetin its__init__.CrescendoAttack,ChunkedRequestAttack, andMultiPromptSendingAttackdeclare theirMULTI_TURNneed asnative_required— adaptation would silently collapse their multi-turn semantics, so it's rejected at construction time.ConversationManager.set_system_promptacceptsPromptTargetand callsensure_can_handle(SYSTEM_PROMPT). Prepended-conversation routing switched fromisinstance(PromptChatTarget)to a capability check.validate()across native support,ADAPT,RAISE, and empty-required cases.Out of scope
No behavior change for targets that already satisfied the old
PromptChatTargetcontract. Custom adaptation still plugs in throughCapabilityHandlingPolicy/ normalizer overrides.Tests and Documentation
Added/Updated tests