接口请求域名: waf.intl.tencentcloudapi.com 。
更新大模型内容安全规则
默认接口请求频率限制:20次/秒。
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| Action | 是 | String | 公共参数,本接口取值:ModifyLLMContentRule。 |
| Version | 是 | String | 公共参数,本接口取值:2018-01-25。 |
| Region | 是 | String | 公共参数,详见产品支持的 地域列表,本接口仅支持其中的: ap-guangzhou, ap-seoul, ap-singapore 。 |
| Name | 是 | String | 名称 |
| Priority | 是 | Integer | 优先级 |
| Status | 是 | Integer | 规则开关 |
| CheckType | 是 | Integer | 检测范围,1:入向,2:出向,3:入向和出向 |
| RuleItem.N | 是 | Array of RuleItem | 检测内容匹配 |
| Options.N | 是 | Array of LLMOptionsItem | 匹配条件 |
| Domain | 否 | String | 域名 |
| ActionType | 否 | String | 动作,观察monitor,拦截intercept |
| ResponseText | 否 | String | 响应提示内容 |
| SessionApplied.N | 否 | Array of String | 规则需要启用的SessionID |
| RuleId | 否 | String | 规则ID,新增时填0 |
| PageId | 否 | Integer | 拦截页面id |
| ContentLogicalOp | 否 | String | 检测内容and or表达式,默认为and |
| InstanceId | 否 | String | 实例id,必填项 |
| ReplyType | 否 | Integer | 代答类型:1-内置可信模型安全代答,2-自定义代答(ActionType=reply)时生效 枚举值:
|
| CustomReplyRuleId | 否 | String | 自定义回答模板 |
| ModalType | 否 | Integer | 模态类型:0-文本(默认),1-图片 枚举值:
|
| Category | 否 | String | 规则类别:black-普通规则(默认),white-白名单规则;空值按black处理。white时ActionType仅允许pass(放行),RuleItem支持白名单匹配字段(Key: ip/geo/type/content/chat_id/user_id/tool_name/tool_args/keyword_whitelist;Op: belong/not_belong/equal/not_equal/contain/not_contain/prefix/suffix/wildcard) |
| Domains.N | 否 | Array of String | 白名单规则生效范围:多个serviceId/domain列表(Category=white时使用),表示该白名单规则同时生效于哪些域名/serviceId。黑名单规则不使用此字段。 |
| AppliedModules.N | 否 | Array of Integer | 加白生效模块type列表(Category=white时使用),表示该白名单规则命中后对哪些防护模块生效(放行)。取值:2-算力消耗规则,3-自定义防护规则,4-ToolCall防护,5-提示词攻击防护,6-内容合规检测,7-敏感数据检测。 |
| RiskLevel | 否 | String | 严重程度:critical-超高危,high-高危,medium-中危(默认),low-低危。命中该规则时攻击日志按此展示风险等级;不传或空值按medium处理。 枚举值:
|
| 参数名称 | 类型 | 描述 |
|---|---|---|
| RuleId | String | 操作的RuleId |
| RequestId | String | 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 |
POST / HTTP/1.1
Host: waf.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifyLLMContentRule
<公共请求参数>
{
"Domain": "jacky12220901.testwaf.com",
"Name": "ddptest",
"ActionType": "log",
"Priority": 50,
"Status": 1,
"ResponseText": "ceshi",
"CheckType": 1,
"RuleItem": [
{
"Key": "inappropriate_info",
"Op": "contain",
"Value": [
"601"
],
"Levels": [
{
"Label": "601",
"Level": 400
}
]
}
],
"SessionApplied": [
"0"
],
"Options": [
{
"Key": "protectpath_business",
"Op": "belong",
"Value": [
"`"
],
"Name": "5300000310"
}
],
"InstanceId": "waf_2l15d14809yfq9sf",
"ReplyType": 1,
"CustomReplyRuleId": "0"
}
{
"Response": {
"RuleId": "5200039233",
"RequestId": "23a6c61f-825a-4a88-a03c-00a6859d1928"
}
}
云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。
以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码。
| 错误码 | 描述 |
|---|---|
| InternalError | 内部错误。 |
| LimitExceeded.ContentRuleErr | 当前域名下的内容规则数量已达上限 |
| LimitExceeded.LimitRuleErr | 当前域名下的算力消耗规则数量已达上限 |
| LimitExceeded.SpecificationErr | SpecificationErr |
| UnsupportedOperation | 操作不支持。 |
文档反馈