內容審查
本頁收錄內容審核能力相關接口。
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 | 審核模型是否將輸入內容標記為可疑內容 |