Skip to content
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

.Net: Bug: C# Content filtering annotations missing #9593

Open
rsaundersbdo opened this issue Nov 6, 2024 · 2 comments
Open

.Net: Bug: C# Content filtering annotations missing #9593

rsaundersbdo opened this issue Nov 6, 2024 · 2 comments
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code

Comments

@rsaundersbdo
Copy link

Describe the bug
When receiving a 400 content filter exception from sending a message to an Azure OpenAI model the inner exception that is supposed to include the reasoning for the exception is null.

To Reproduce
Steps to reproduce the behavior:
1.Setup an Azure OpenAI model with content filter set to block on message inputs.
2. Send a streaming message request that would trigger the content filtering to the model.
3. Inspect the expectation and see that the inner exception is null.

Expected behavior
The inner exception is expected to be populated with the information on why the message was blocked.

Screenshots
Image

Platform

  • OS: Windows
  • IDE: Visual Studio
  • Language: C#
  • Source: NuGet package version 1.27.0
@rsaundersbdo rsaundersbdo added the bug Something isn't working label Nov 6, 2024
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code triage labels Nov 6, 2024
@github-actions github-actions bot changed the title Bug: C# Content filtering annotations missing .Net: Bug: C# Content filtering annotations missing Nov 6, 2024
@evchaki evchaki removed the triage label Nov 7, 2024
@evchaki
Copy link
Contributor

evchaki commented Nov 7, 2024

@SergeyMenshykh - can you take a look at this - from Office Hours this week. @rsaundersbdo - thanks for putting this in, we will take a look.

@RogerBarreto
Copy link
Member

Just to add a bit more context

when we get a 400 back we also get this Response Body, for some reason this is not returned, wondering what might be occluding the information or this is lost in the Azure SDK...

{
    "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,
        "innererror": {
            "code": "ResponsibleAIPolicyViolation",
            "content_filter_result": {
                "hate": {
                    "filtered": false,
                    "severity": "safe"
                },
                "jailbreak": {
                    "filtered": false,
                    "detected": false
                },
                "self_harm": {
                    "filtered": false,
                    "severity": "safe"
                },
                "sexual": {
                    "filtered": false,
                    "severity": "safe"
                },
                "violence": {
                    "filtered": true,
                    "severity": "medium"
                }
            }
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

No branches or pull requests

4 participants