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

Cognitive Services 2024-06-01-preview #29228

Merged
merged 20 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5631,25 +5631,16 @@
"description": "Azure OpenAI Content Filter.",
"type": "object",
"properties": {
"policyName": {
"name": {
tianxin-ms marked this conversation as resolved.
Show resolved Hide resolved
"type": "string",
"description": "Name of Content Filter."
},
"description": {
"type": "string",
"description": "Description of Content Filter."
"isMultiLevelFilter": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isMultiLevelFilter

From ARM perspective, this is moving the wrong direction. Why do you need to change from enum to boolean? Enums are generally better properties and highly recommended over booleans in ARM APIs.

Copy link
Member

@TimLovellSmith TimLovellSmith Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, why change this?

"type": "boolean",
"description": "If the Content Filter has multi severity levels(Low, Medium, or High)."
},
"filterType": {
"type": "string",
"description": "Content Filter type.",
"enum": [
"MultiLevel",
"Switch"
],
"x-ms-enum": {
"name": "RaiContentFilterType",
"modelAsString": true
}
"source": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source

This property (and the filterType/isMultilevelFilter property) belongs in a top-level property bag, per RPC requirements: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md#request---get-resource-collection-under-subscription.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ARMBlockingComment] This needs to be fixed with the current API version itself.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will take the suggests from #29228 (comment). To use "post" action instead of "get". We won't treat "RaiContentFilter" as a ARM resource. In this case, shall we need to move these properties?

"$ref": "#/definitions/RaiPolicyContentSource"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,88 @@
"name": "raiPolicyName",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiPolicies/raiPolicyName",
"properties": {
"basePolicyName": "112",
"basePolicyName": "Microsoft.Default",
"mode": "Deferred",
"contentFilters": [
{
"name": "hate",
"allowedContentLevel": "Low",
"blocking": true
"blocking": false,
"enabled": false,
"allowedContentLevel": "High",
"source": "Prompt"
},
{
"name": "hate",
"blocking": true,
"enabled": true,
"allowedContentLevel": "Medium",
"source": "Completion"
},
{
"name": "sexual",
"blocking": true,
"enabled": true,
"allowedContentLevel": "High",
"source": "Prompt"
},
{
"name": "sexual",
"allowedContentLevel": "Low"
"blocking": true,
"enabled": true,
"allowedContentLevel": "Medium",
"source": "Completion"
},
{
"name": "selfharm",
"blocking": true,
"enabled": true,
"allowedContentLevel": "High",
"source": "Prompt"
},
{
"name": "selfharm",
"blocking": true,
"enabled": true,
"allowedContentLevel": "Medium",
"source": "Completion"
},
{
"name": "violence",
"enabled": false
"blocking": true,
"enabled": true,
"allowedContentLevel": "Medium",
"source": "Prompt"
},
{
"name": "violence",
"blocking": true,
"enabled": true,
"allowedContentLevel": "Medium",
"source": "Completion"
},
{
"name": "jailbreak",
"blocking": true,
"source": "Prompt",
"enabled": true
},
{
"name": "protected_material_text",
"blocking": true,
"source": "Completion",
"enabled": true
},
{
"name": "protected_material_code",
"blocking": true,
"source": "Completion",
"enabled": true
},
{
"name": "DefaultHateSpeechBlockList",
"enabled": false
"name": "profanity",
"blocking": true,
"source": "Prompt",
"enabled": true
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,44 @@
"body": {
"value": [
{
"policyName": "Hate",
"description": "Multi-level filter for hate speech.",
"filterType": "MultiLevel"
"name": "Hate",
"isMultiLevelFilter": true
},
{
"policyName": "Sexual",
"description": "Multi-level filter for sexual content.",
"filterType": "MultiLevel"
"name": "Sexual",
"isMultiLevelFilter": true
},
{
"policyName": "HateSpeechPatterns",
"description": "Global blocklist for hate speech.",
"filterType": "Switch"
"name": "Violence",
"isMultiLevelFilter": true
},
{
"name": "Selfharm",
"isMultiLevelFilter": true
},
{
"name": "Jailbreak",
"isMultiLevelFilter": false,
"source": "Prompt"
},
{
"name": "Protected Material Text",
"isMultiLevelFilter": false,
"source": "Completion"
},
{
"name": "Protected Material Code",
"isMultiLevelFilter": false,
"source": "Completion"
},
{
"name": "Profanity",
"isMultiLevelFilter": false
},
{
"name": "Indirect Attack",
"isMultiLevelFilter": false,
"source": "Prompt"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,88 @@
"name": "raiPolicyName",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiPolicies/raiPolicyName",
"properties": {
"basePolicyName": "112",
"basePolicyName": "Microsoft.Default",
"mode": "Deferred",
"contentFilters": [
{
"name": "hate",
"allowedContentLevel": "Low",
"blocking": true
"blocking": false,
"enabled": false,
"allowedContentLevel": "High",
"source": "Prompt"
},
{
"name": "hate",
"blocking": true,
"enabled": true,
"allowedContentLevel": "Medium",
"source": "Completion"
},
{
"name": "sexual",
"blocking": true,
"enabled": true,
"allowedContentLevel": "High",
"source": "Prompt"
},
{
"name": "sexual",
"allowedContentLevel": "Low"
"blocking": true,
"enabled": true,
"allowedContentLevel": "Medium",
"source": "Completion"
},
{
"name": "selfharm",
"blocking": true,
"enabled": true,
"allowedContentLevel": "High",
"source": "Prompt"
},
{
"name": "selfharm",
"blocking": true,
"enabled": true,
"allowedContentLevel": "Medium",
"source": "Completion"
},
{
"name": "violence",
"enabled": false
"blocking": true,
"enabled": true,
"allowedContentLevel": "Medium",
"source": "Prompt"
},
{
"name": "violence",
"blocking": true,
"enabled": true,
"allowedContentLevel": "Medium",
"source": "Completion"
},
{
"name": "jailbreak",
"blocking": true,
"source": "Prompt",
"enabled": true
},
{
"name": "protected_material_text",
"blocking": true,
"source": "Completion",
"enabled": true
},
{
"name": "protected_material_code",
"blocking": true,
"source": "Completion",
"enabled": true
},
{
"name": "DefaultHateSpeechBlockList",
"enabled": false
"name": "profanity",
"blocking": true,
"source": "Prompt",
"enabled": true
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"raiPolicyName": "raiPolicyName",
"raiPolicy": {
"properties": {
"basePolicyName": "112",
"basePolicyName": "Microsoft.Default",
"mode": "Deferred",
"contentFilters": [
{
"name": "hate",
Expand Down Expand Up @@ -88,12 +89,6 @@
"blocking": true,
"source": "Prompt",
"enabled": true
},
{
"name": "profanity",
"blocking": true,
"source": "Completion",
"enabled": true
}
]
}
Expand All @@ -106,6 +101,7 @@
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiPolicies/raiPolicyName",
"properties": {
"basePolicyName": "Microsoft.Default",
"mode": "Deferred",
"contentFilters": [
{
"name": "hate",
Expand Down Expand Up @@ -186,12 +182,6 @@
"blocking": true,
"source": "Prompt",
"enabled": true
},
{
"name": "profanity",
"blocking": true,
"source": "Completion",
"enabled": true
}
]
}
Expand All @@ -203,6 +193,7 @@
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiPolicies/raiPolicyName",
"properties": {
"basePolicyName": "Microsoft.Default",
"mode": "Deferred",
"contentFilters": [
{
"name": "hate",
Expand Down Expand Up @@ -283,12 +274,6 @@
"blocking": true,
"source": "Prompt",
"enabled": true
},
{
"name": "profanity",
"blocking": true,
"source": "Completion",
"enabled": true
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6292,25 +6292,16 @@
"description": "Azure OpenAI Content Filter.",
"type": "object",
"properties": {
"policyName": {
"name": {
"type": "string",
"description": "Name of Content Filter."
},
"description": {
"type": "string",
"description": "Description of Content Filter."
"isMultiLevelFilter": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isMultiLevelFilter

See comments on corresponding change to 2023-10-01-preview spec.

"type": "boolean",
"description": "If the Content Filter has multi severity levels(Low, Medium, or High)."
},
"filterType": {
"type": "string",
"description": "Content Filter type.",
"enum": [
"MultiLevel",
"Switch"
],
"x-ms-enum": {
"name": "RaiContentFilterType",
"modelAsString": true
}
"source": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source

See comments on corresponding change to 2023-10-01-preview spec.

"$ref": "#/definitions/RaiPolicyContentSource"
}
}
},
Expand Down
Loading