-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python: Partial content filtering response in Python SDK #4197
Comments
Thanks for filing, @orsharab. How can I repro it on my end? |
@eavanvalkenburg we should chat about plans for proper error/exception handling. |
@juliomenendez if you have any bandwidth, could you please help take a look? |
@orsharab yes, the PR doesn't restrict what type of content filter is accepted. Jailbreak is handled in the |
…g is triggered (#4428) ### Motivation and Context When an Azure OpenAI content filter error is triggered the current `AIException` hides the details of that specific error. This makes it hard for the consumer to see a more detailed description of the error in their prompt or input. Solves #4197 ### Description Detects when a content filter error is raised, then parses the meaningful information about it and raises a new `ContentFilterAIException` with that information ready for the consumer to use. ### Contribution Checklist - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone 😄 --------- Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
@orsharab the changes have been merged and should go out in the next release. |
…g is triggered (microsoft#4428) ### Motivation and Context When an Azure OpenAI content filter error is triggered the current `AIException` hides the details of that specific error. This makes it hard for the consumer to see a more detailed description of the error in their prompt or input. Solves microsoft#4197 ### Description Detects when a content filter error is raised, then parses the meaningful information about it and raises a new `ContentFilterAIException` with that information ready for the consumer to use. ### Contribution Checklist - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone 😄 --------- Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
Describe the bug
In Python SDK, when content filtering is triggered, the returned response is partial, missing "inner_error" property that indicates the reason of the content filtering:
'{"error":{"message":"The response was filtered due to the prompt triggering Azure OpenAI\'s content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: [https://go.microsoft.com/fwlink/?linkid=2198766","type":null,"param":"prompt","code":"content_filter","status":400}](https://go.microsoft.com/fwlink/?linkid=2198766%22,%22type%22:null,%22param%22:%22prompt%22,%22code%22:%22content_filter%22,%22status%22:400%7d)}'
See OpenAI API reference for "inner_error" property
Platform
Python SDK version - 0.3.15.dev0
The text was updated successfully, but these errors were encountered: