Skip to content

FIX: Send converted_value in PromptShieldTarget - #3482

Closed
Abhinav Maurya (Fire162) wants to merge 1 commit into
microsoft:mainfrom
Fire162:fix-prompt-shield-converted-value
Closed

Abhinav Maurya (Fire162) wants to merge 1 commit into
microsoft:mainfrom
Fire162:fix-prompt-shield-converted-value

Conversation

@Fire162

Copy link
Copy Markdown

Description

PromptShieldTarget._send_prompt_to_target_async parsed request.original_value when constructing the request payload. Because other prompt targets use converted_value, any request converters applied to the prompt (e.g. via PromptNormalizer) were ignored.

This updates PromptShieldTarget to parse request.converted_value.

Fixes #3478.

Tests and Documentation

  • Added unit test test_prompt_shield_send_prompt_async_sends_converted_value in tests/unit/prompt_target/target/test_prompt_shield_target.py verifying that converted text is sent in the request payload.
  • Ran test suite with pytest tests/unit/prompt_target/target/test_prompt_shield_target.py.

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.

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.

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.

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.

BUG: PromptShieldTarget sends the prompt from before conversion, so request converters are ignored

2 participants