内容审查
本页收录内容审核能力相关接口。
Apifox 覆盖范围补充
- 创建内容审核
模型接口/审查(Moderations)
POST 创建内容审核
POST /moderations
对文本是否违反 OpenAI 的内容政策进行分类
Body 请求参数
{
"model": "omni-moderation-latest",
"input": [
{ "type": "text", "text": "...text to classify goes here..." },
{
"type": "image_url",
"image_url": {
"url": "https://github.com/dianping/cat/raw/master/cat-home/src/main/webapp/images/logo/cat_logo03.png"
}
}
]
}
请求参数
| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| Authorization | header | string | 否 | none |
| body | body | object | 否 | none |
| » input | body | string | 是 | 要分类的输入文本 |
| » model | body | string | 是 | 有两种内容审核模型可用:text-moderation-stable和text-moderation-latest。 默认值text-moderation-latest将随着时间的推移自动升级。这可确保您始终使用我们最准确的模型。如果您使用text-moderation-stable,我们将在更新模型之前提供提前通知。的准确度text-moderation-stable可能略低于 的准确度text-moderation-latest。 |
返回示例
200 Response
{
"id": "string",
"model": "string",
"results": [
{
"categories": {
"hate": true,
"hate/threatening": true,
"self-harm": true,
"sexual": true,
"sexual/minors": true,
"violence": true,
"violence/graphic": true
},
"category_scores": {
"hate": 0,
"hate/threatening": 0,
"self-harm": 0,
"sexual": 0,
"sexual/minors": 0,
"violence": 0,
"violence/graphic": 0
},
"flagged": true
}
]
}
返回结果
| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | none | Inline |
返回数据结构
状态码 200
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| » id | string | true | none | 审核任务的唯一标识符 | |
| » model | string | true | none | 用于审核的模型 | |
| » results | [object] | true | none | 审核结果的详细信息 | |
| »» categories | object | false | none | 审核模型检测到的所有分类标签 | |
| »»» hate | boolean | true | none | 审核模型检测到是否存在仇恨言论 | |
| »»» hate | boolean | true | none | none | |
| »»» self-harm | boolean | true | none | 审核模型检测到是否存在自残内容 | |
| »»» sexual | boolean | true | none | 审核模型检测到是否存在性内容 | |
| »»» sexual | boolean | true | none | none | |
| »»» violence | boolean | true | none | 审核模型检测到是否存在暴力内容 | |
| »»» violence | boolean | true | none | none | |
| »» category_scores | object | false | none | 审核模型对所有分类标签的得分 | |
| »»» hate | number | true | none | 审核模型对仇恨言论的得分 | |
| »»» hate | number | true | none | none | |
| »»» self-harm | number | true | none | 审核模型对自残内容的得分 | |
| »»» sexual | number | true | none | 审核模型对性内容的得分 | |
| »»» sexual | number | true | none | none | |
| »»» violence | number | true | none | 审核模型对暴力内容的得分 | |
| »»» violence | number | true | none | none | |
| »» flagged | boolean | false | none | 审核模型是否将输入内容标记为可疑内容 |