Connection Rai Policy - Create
更新与 Azure OpenAI 连接关联的指定内容筛选器的状态。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}?api-version=2026-01-15-preview
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}?api-version=2026-01-15-preview&proxy-api-version={proxy-api-version}
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
connection
|
path | True |
string pattern: ^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$ |
工作区连接的友好名称 |
|
rai
|
path | True |
string pattern: ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$ |
Rai 策略的名称。 |
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
资源组的名称。 此名称不区分大小写。 |
|
subscription
|
path | True |
string minLength: 1 |
目标订阅的 ID。 |
|
workspace
|
path | True |
string pattern: ^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$ |
Azure 机器学习工作区名称 |
|
api-version
|
query | True |
string minLength: 1 |
用于此作的 API 版本。 |
|
proxy-api-version
|
query |
string |
代理调用使用的 API 版本 |
请求正文
| 名称 | 必需 | 类型 | 说明 |
|---|---|---|---|
| properties | True |
Azure OpenAI 内容过滤属性。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 200 OK |
资源“RaiPolicyPropertiesBasicResource”更新作成功 |
|
| 201 Created |
资源 'RaiPolicyPropertiesBasicResource' 创建作成功 标头
|
|
| Other Status Codes |
意外的错误响应。 |
安全性
azure_auth
Azure Active Directory OAuth2 流程。
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
| 名称 | 说明 |
|---|---|
| user_impersonation | 模拟用户帐户 |
示例
Create Rai policy
示例请求
PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.MachineLearningServices/workspaces/aml-workspace-name/connections/testConnection/raiPolicies/raiPolicyName?api-version=2026-01-15-preview
{
"properties": {
"type": "SystemManaged",
"basePolicyName": "112",
"completionBlocklists": [
{
"blocking": false,
"blocklistName": "blocklistName"
}
],
"contentFilters": [
{
"name": "policyName",
"allowedContentLevel": "Low",
"blocking": false,
"enabled": false,
"source": "Prompt"
}
],
"mode": "Blocking",
"promptBlocklists": [
{
"blocking": false,
"blocklistName": "blocklistName"
}
]
}
}
示例响应
{
"name": "raiPolicyName",
"type": "Microsoft.MachineLearningServices/workspaces/connections/raiPolicies",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.MachineLearningServices/workspaces/aml-workspace-name/connections/testConnection/raiPolicies/raiPolicyName",
"properties": {
"type": "SystemManaged",
"basePolicyName": "112",
"completionBlocklists": [
{
"blocking": false,
"blocklistName": "blocklistName"
}
],
"contentFilters": [
{
"name": "policyName",
"allowedContentLevel": "Low",
"blocking": false,
"enabled": false,
"source": "Prompt"
}
],
"mode": "Blocking",
"promptBlocklists": [
{
"blocking": false,
"blocklistName": "blocklistName"
}
]
},
"systemData": {
"createdAt": "2020-01-01T00:00:00Z",
"createdBy": "00000000-1111-2222-3333-444444444444",
"createdByType": "Application",
"lastModifiedAt": "2020-01-01T00:00:00Z",
"lastModifiedBy": "00000000-1111-2222-3333-444444444444",
"lastModifiedByType": "Application"
}
}
{
"name": "raiPolicyName",
"type": "Microsoft.MachineLearningServices/workspaces/connections/raiPolicies",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.MachineLearningServices/workspaces/aml-workspace-name/connections/testConnection/raiPolicies/raiPolicyName",
"properties": {
"type": "SystemManaged",
"basePolicyName": "112",
"completionBlocklists": [
{
"blocking": false,
"blocklistName": "blocklistName"
}
],
"contentFilters": [
{
"name": "policyName",
"allowedContentLevel": "Low",
"blocking": false,
"enabled": false,
"source": "Prompt"
}
],
"mode": "Blocking",
"promptBlocklists": [
{
"blocking": false,
"blocklistName": "blocklistName"
}
]
},
"systemData": {
"createdAt": "2020-01-01T00:00:00Z",
"createdBy": "00000000-1111-2222-3333-444444444444",
"createdByType": "Application",
"lastModifiedAt": "2020-01-01T00:00:00Z",
"lastModifiedBy": "00000000-1111-2222-3333-444444444444",
"lastModifiedByType": "Application"
}
}
定义
| 名称 | 说明 |
|---|---|
|
Allowed |
筛选内容的级别。 |
|
created |
创建资源的标识的类型。 |
|
Error |
资源管理错误附加信息。 |
|
Error |
错误详细信息。 |
|
Error |
错误响应 |
|
Rai |
Azure OpenAI 黑名单配置。 |
|
Rai |
Azure OpenAI 内容过滤器。 |
|
Rai |
要应用内容筛选器的内容源。 |
|
Rai |
内容筛选器模式。 |
|
Rai |
Azure OpenAI 内容过滤属性。 |
|
Rai |
Azure OpenAI 内容筛选器资源。 |
|
Rai |
内容筛选器策略类型。 |
|
system |
与创建和上次修改资源相关的元数据。 |
AllowedContentLevel
筛选内容的级别。
| 值 | 说明 |
|---|---|
| Low | |
| Medium | |
| High |
createdByType
创建资源的标识的类型。
| 值 | 说明 |
|---|---|
| User | |
| Application | |
| ManagedIdentity | |
| Key |
ErrorAdditionalInfo
资源管理错误附加信息。
| 名称 | 类型 | 说明 |
|---|---|---|
| info |
object |
其他信息。 |
| type |
string |
其他信息类型。 |
ErrorDetail
错误详细信息。
| 名称 | 类型 | 说明 |
|---|---|---|
| additionalInfo |
错误附加信息。 |
|
| code |
string |
错误代码。 |
| details |
错误详细信息。 |
|
| message |
string |
错误消息。 |
| target |
string |
错误目标。 |
ErrorResponse
错误响应
| 名称 | 类型 | 说明 |
|---|---|---|
| error |
错误对象。 |
RaiBlocklistConfig
Azure OpenAI 黑名单配置。
| 名称 | 类型 | 说明 |
|---|---|---|
| blocking |
boolean |
如果发生阻塞, |
| blocklistName |
string |
ContentFilter 的名称。 |
RaiPolicyContentFilter
Azure OpenAI 内容过滤器。
| 名称 | 类型 | 说明 |
|---|---|---|
| allowedContentLevel |
筛选内容的级别。 |
|
| blocking |
boolean |
如果发生阻塞, |
| enabled |
boolean |
如果已启用 ContentFilter。 |
| name |
string |
ContentFilter 的名称。 |
| source |
要应用内容筛选器的内容源。 |
RaiPolicyContentSource
要应用内容筛选器的内容源。
| 值 | 说明 |
|---|---|
| Prompt | |
| Completion |
RaiPolicyMode
内容筛选器模式。
| 值 | 说明 |
|---|---|
| Default | |
| Deferred | |
| Blocking |
RaiPolicyProperties
Azure OpenAI 内容过滤属性。
| 名称 | 类型 | 说明 |
|---|---|---|
| basePolicyName |
string |
基本内容筛选器的名称。 |
| completionBlocklists |
Azure OpenAI 黑名单配置。 |
|
| contentFilters |
Azure OpenAI 内容过滤器。 |
|
| mode |
内容筛选器模式。 |
|
| promptBlocklists |
Azure OpenAI 黑名单配置。 |
|
| type |
内容筛选器策略类型。 |
RaiPolicyPropertiesBasicResource
Azure OpenAI 内容筛选器资源。
| 名称 | 类型 | 说明 |
|---|---|---|
| id |
string |
资源的完全限定资源 ID。 示例 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
| name |
string |
资源的名称 |
| properties |
Azure OpenAI 内容过滤属性。 |
|
| systemData |
包含 createdBy 和 modifiedBy 信息的 Azure 资源管理器元数据。 |
|
| type |
string |
资源类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts” |
RaiPolicyType
内容筛选器策略类型。
| 值 | 说明 |
|---|---|
| UserManaged | |
| SystemManaged |
systemData
与创建和上次修改资源相关的元数据。
| 名称 | 类型 | 说明 |
|---|---|---|
| createdAt |
string (date-time) |
资源创建时间戳(UTC)。 |
| createdBy |
string |
创建资源的标识。 |
| createdByType |
创建资源的标识的类型。 |
|
| lastModifiedAt |
string (date-time) |
上次修改的资源时间戳(UTC) |
| lastModifiedBy |
string |
上次修改资源的标识。 |
| lastModifiedByType |
上次修改资源的标识的类型。 |