Repository navigation
FIX: Send converted_value in PromptShieldTarget - #3482
Closed
Abhinav Maurya (Fire162) wants to merge 1 commit into
Closed
Abhinav Maurya (Fire162) wants to merge 1 commit into
Abhinav Maurya (Fire162) wants to merge 1 commit into
Conversation
PromptShieldTarget._send_prompt_to_target_async was parsing request.original_value instead of request.converted_value, causing any request converters applied to the prompt to be ignored. Fixes microsoft#3478.
Richard Lundeen (richlundeen)
left a comment
Contributor
There was a problem hiding this comment.
I recommend closing this as a duplicate of #3479, which is already approved. Both change PromptShieldTarget to parse converted_value instead of original_value and add regression coverage for that behavior. We only need one of these PRs. This recommendation is not a concern with the fix itself.
Reviewed with GitHub Copilot.
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
PromptShieldTarget._send_prompt_to_target_asyncparsedrequest.original_valuewhen constructing the request payload. Because other prompt targets useconverted_value, any request converters applied to the prompt (e.g. viaPromptNormalizer) were ignored.This updates
PromptShieldTargetto parserequest.converted_value.Fixes #3478.
Tests and Documentation
test_prompt_shield_send_prompt_async_sends_converted_valueintests/unit/prompt_target/target/test_prompt_shield_target.pyverifying that converted text is sent in the request payload.pytest tests/unit/prompt_target/target/test_prompt_shield_target.py.