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

[BUG] The Content Safety (Text Analyze) Tool isn't compatible with new content safety API versions #3984

Open
10GO-dev opened this issue Mar 22, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@10GO-dev
Copy link

The Content Safety (Text Analyze) Tool isn't compatible with new content safety API versions

How To Reproduce the bug
Steps to reproduce the behavior, how frequent can you experience the bug:
1.Add a new Azure Content Safety connection with the api version "2024-09-01" which is the default in the implementation example codes of text moderation in Azure AI Foundry.
2. Create a Content Safety node with the created connection.
3. It return the following error:

File "project_directory\.venv\Lib\site-packages\promptflow\tools\azure_content_safety.py", line 255, in make_decision
    raise AzureContentSafetySystemError(message=error_message)
Can not find detection result for Category.Hate
pf.flow.node_test failed with UserErrorException: Exception: Can not find detection result for Category.Hate

The thing is, there is a condition on that file azure_content_safety.py which depending on the api_version parameter of the connection it uses a specific make_decision() method.

Expected behavior
I should use the make_decision_1001() method but as the api version does not match it uses the older version which work for a different json structure.

I changed the date value of the condition in the azure_content_safety.py file to the one I set on the api '2024-09-01' and it worked perfectly

Screenshots
Image

Running Information(please complete the following information):

  • Promptflow Package Version using pf -v: [1.17.2]
  • promptflow-tools version using [1.6.0]
  • Operating System: [Windows 11]
  • Python Version using python --version: [python==3.12.9]
@10GO-dev 10GO-dev added the bug Something isn't working label Mar 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant