-
Notifications
You must be signed in to change notification settings - Fork 3k
Adding _InternalRiskCategory.ECI
, RiskCategory.ProtectedMaterial
, and RiskCategory.CodeVulnerability
#41077
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
Conversation
RiskCategory.ECI
, RiskCategory.ProtectedMaterial
, and RiskCategory.CodeVulnerability
_InternalRiskCategory.ECI
, RiskCategory.ProtectedMaterial
, and RiskCategory.CodeVulnerability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds three new risk categories (_InternalRiskCategory.ECI
, RiskCategory.ProtectedMaterial
, and RiskCategory.CodeVulnerability
) to the red-team flow, updates client operations to accept both risk_type
and risk_categories
, and adjusts formatting and tests to reflect these additions.
- Extend the
RiskCategory
enum and introduce_InternalRiskCategory.ECI
- Update the autogenerated client and ONEDP operations to support
risk_type
/risk_categories
- Adjust scorecard formatting and clean up deprecated evaluator mapping and related tests
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
sdk/evaluation/azure-ai-evaluation/tests/unittests/test_redteam/test_red_team.py | Removed patch decorator without updating test signature |
sdk/evaluation/azure-ai-evaluation/tests/unittests/test_redteam/test_constants.py | Deleted tests for RISK_CATEGORY_EVALUATOR_MAP |
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/simulator/_model_tools/_generated_rai_client.py | Added risk_type and risk_categories params and updated calls |
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/red_team/_utils/metric_mapping.py | Mapped new risk categories to evaluation metrics |
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/red_team/_utils/formatting_utils.py | Increased column width for scorecard |
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/red_team/_utils/constants.py | Removed the old RISK_CATEGORY_EVALUATOR_MAP constant |
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/red_team/_red_team.py | Integrated new risk categories into objective retrieval & evaluation |
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/red_team/_attack_objective_generator.py | Added ProtectedMaterial , CodeVulnerability , and _InternalRiskCategory.ECI |
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_common/raiclient/operations/_operations.py | Introduced risk_categories param but mis-mapped risk_types |
Comments suppressed due to low confidence (4)
sdk/evaluation/azure-ai-evaluation/tests/unittests/test_redteam/test_red_team.py:867
- The test signature includes
mock_risk_category_map
but the corresponding patch decorator was removed, causing a mismatch. Either remove the unused parameter or re-add the patch decorator.
async def test_evaluate_method(self, mock_get_logger, mock_risk_category_map, red_team):
sdk/evaluation/azure-ai-evaluation/tests/unittests/test_redteam/test_constants.py:43
- The tests for
RISK_CATEGORY_EVALUATOR_MAP
were removed, leaving no coverage for the evaluator mapping. Add tests to verify the new metric and risk category mappings.
def test_task_status_constants(self):
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/red_team/_red_team.py:1596
- The
query
field is set to the literal "query" despite the comment stating it should be empty. Restore it to an empty string to meet the API requirement.
"query": "query", # Empty query as required
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/red_team/_red_team.py:2022
- The default risk categories list excludes the newly added
ProtectedMaterial
andCodeVulnerability
. Include these new categories or revert to usinglist(RiskCategory)
.
self.attack_objective_generator.risk_categories = [RiskCategory.HateUnfairness, RiskCategory.Sexual, RiskCategory.Violence, RiskCategory.SelfHarm]
...aluation/azure-ai-evaluation/azure/ai/evaluation/_common/raiclient/operations/_operations.py
Outdated
Show resolved
Hide resolved
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/red_team/_utils/formatting_utils.py
Outdated
Show resolved
Hide resolved
…m/_utils/formatting_utils.py Co-authored-by: Copilot <[email protected]>
Description
Please add an informative description that covers that changes made by the pull request and link all relevant issues.
If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines