text-moderation

Отправить синхронный запрос используя модель text-moderation-007

Чтобы отправлять авторизованные запросы нужно получить API ключ, как это сделать написано в разделе С чего начать?

Модерация текста

POST https://gptunnel.ru/v1/moderations

Синхронный запрос к модели text-moderation-007

Headers

Request Body

{
	"id": "modr-9b51yQZrBNIHDrIeX5bBcftbj5wgs",
	"model": "text-moderation-007",
	"results": [
		{
			"flagged": false,
			"categories": {
				"sexual": false,
				"hate": false,
				"harassment": false,
				"self-harm": false,
				"sexual/minors": false,
				"hate/threatening": false,
				"violence/graphic": false,
				"self-harm/intent": false,
				"self-harm/instructions": false,
				"harassment/threatening": false,
				"violence": false
			},
			"category_scores": {
				"sexual": 0.00009054947440745309,
				"hate": 0.00007182655826909468,
				"harassment": 0.00016347762721125036,
				"self-harm": 0.0000020744676021422492,
				"sexual/minors": 0.000013518638297682628,
				"hate/threatening": 0.0000010106600711878855,
				"violence/graphic": 0.00001040412189468043,
				"self-harm/intent": 4.586087243296788e-7,
				"self-harm/instructions": 3.98835481973947e-7,
				"harassment/threatening": 0.000023142851205193438,
				"violence": 0.00013958947965875268
			}
		}
	],
	"usage": {
		"prompt_tokens": 5,
		"completion_tokens": 0,
		"prompt_cost": 0.00005,
		"completion_cost": 0,
		"total_cost": 0.00005
	}
}

Пример запроса

import axios from 'axios'

const request = axios({
  method: 'POST',
  url: 'https://gptunnel.ru/v1/moderations',
  headers: {
    // use your API key here
    Authorization: 'YOUR_API_KEY',
  },
  data: {
     input: "Your text string goes here",
  },
})

request.then((result) => {
  console.log(result)
}).catch((error) => {
  console.error(error)
})

Пример ответа

{
	"id": "modr-9b51yQZrBNIHDrIeX5bBcftbj5wgs",
	"model": "text-moderation-007",
	"results": [
		{
			"flagged": false,
			"categories": {
				"sexual": false,
				"hate": false,
				"harassment": false,
				"self-harm": false,
				"sexual/minors": false,
				"hate/threatening": false,
				"violence/graphic": false,
				"self-harm/intent": false,
				"self-harm/instructions": false,
				"harassment/threatening": false,
				"violence": false
			},
			"category_scores": {
				"sexual": 0.00009054947440745309,
				"hate": 0.00007182655826909468,
				"harassment": 0.00016347762721125036,
				"self-harm": 0.0000020744676021422492,
				"sexual/minors": 0.000013518638297682628,
				"hate/threatening": 0.0000010106600711878855,
				"violence/graphic": 0.00001040412189468043,
				"self-harm/intent": 4.586087243296788e-7,
				"self-harm/instructions": 3.98835481973947e-7,
				"harassment/threatening": 0.000023142851205193438,
				"violence": 0.00013958947965875268
			}
		}
	],
	"usage": {
		"prompt_tokens": 5,
		"completion_tokens": 0,
		"prompt_cost": 0.00005,
		"completion_cost": 0,
		"total_cost": 0.00005
	}
}

Last updated