cli/resources/moderations/methods/create/index.md +0 −342 deleted
File Deleted View Diff
1## Create moderation
2
3`$ openai moderations create`
4
5**post** `/moderations`
6
7Classifies if text and/or image inputs are potentially harmful. Learn
8more in the [moderation guide](https://platform.openai.com/docs/guides/moderation).
9
10### Parameters
11
12- `--input: string or array of string or array of ModerationMultiModalInput`
13
14 Input (or inputs) to classify. Can be a single string, an array of strings, or
15 an array of multi-modal input objects similar to other models.
16
17- `--model: optional string or ModerationModel`
18
19 The content moderation model you would like to use. Learn more in
20 [the moderation guide](https://platform.openai.com/docs/guides/moderation), and learn about
21 available models [here](https://platform.openai.com/docs/models#moderation).
22
23### Returns
24
25- `ModerationNewResponse: object { id, model, results }`
26
27 Represents if a given text input is potentially harmful.
28
29 - `id: string`
30
31 The unique identifier for the moderation request.
32
33 - `model: string`
34
35 The model used to generate the moderation results.
36
37 - `results: array of Moderation`
38
39 A list of moderation objects.
40
41 - `categories: object { harassment, "harassment/threatening", hate, 10 more }`
42
43 A list of the categories, and whether they are flagged or not.
44
45 - `harassment: boolean`
46
47 Content that expresses, incites, or promotes harassing language towards any target.
48
49 - `harassment/threatening: boolean`
50
51 Harassment content that also includes violence or serious harm towards any target.
52
53 - `hate: boolean`
54
55 Content that expresses, incites, or promotes hate based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. Hateful content aimed at non-protected groups (e.g., chess players) is harassment.
56
57 - `hate/threatening: boolean`
58
59 Hateful content that also includes violence or serious harm towards the targeted group based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste.
60
61 - `illicit: boolean`
62
63 Content that includes instructions or advice that facilitate the planning or execution of wrongdoing, or that gives advice or instruction on how to commit illicit acts. For example, "how to shoplift" would fit this category.
64
65 - `illicit/violent: boolean`
66
67 Content that includes instructions or advice that facilitate the planning or execution of wrongdoing that also includes violence, or that gives advice or instruction on the procurement of any weapon.
68
69 - `self-harm: boolean`
70
71 Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders.
72
73 - `self-harm/instructions: boolean`
74
75 Content that encourages performing acts of self-harm, such as suicide, cutting, and eating disorders, or that gives instructions or advice on how to commit such acts.
76
77 - `self-harm/intent: boolean`
78
79 Content where the speaker expresses that they are engaging or intend to engage in acts of self-harm, such as suicide, cutting, and eating disorders.
80
81 - `sexual: boolean`
82
83 Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness).
84
85 - `sexual/minors: boolean`
86
87 Sexual content that includes an individual who is under 18 years old.
88
89 - `violence: boolean`
90
91 Content that depicts death, violence, or physical injury.
92
93 - `violence/graphic: boolean`
94
95 Content that depicts death, violence, or physical injury in graphic detail.
96
97 - `category_applied_input_types: object { harassment, "harassment/threatening", hate, 10 more }`
98
99 A list of the categories along with the input type(s) that the score applies to.
100
101 - `harassment: array of "text"`
102
103 The applied input type(s) for the category 'harassment'.
104
105 - `"text"`
106
107 - `harassment/threatening: array of "text"`
108
109 The applied input type(s) for the category 'harassment/threatening'.
110
111 - `"text"`
112
113 - `hate: array of "text"`
114
115 The applied input type(s) for the category 'hate'.
116
117 - `"text"`
118
119 - `hate/threatening: array of "text"`
120
121 The applied input type(s) for the category 'hate/threatening'.
122
123 - `"text"`
124
125 - `illicit: array of "text"`
126
127 The applied input type(s) for the category 'illicit'.
128
129 - `"text"`
130
131 - `illicit/violent: array of "text"`
132
133 The applied input type(s) for the category 'illicit/violent'.
134
135 - `"text"`
136
137 - `self-harm: array of "text" or "image"`
138
139 The applied input type(s) for the category 'self-harm'.
140
141 - `"text"`
142
143 - `"image"`
144
145 - `self-harm/instructions: array of "text" or "image"`
146
147 The applied input type(s) for the category 'self-harm/instructions'.
148
149 - `"text"`
150
151 - `"image"`
152
153 - `self-harm/intent: array of "text" or "image"`
154
155 The applied input type(s) for the category 'self-harm/intent'.
156
157 - `"text"`
158
159 - `"image"`
160
161 - `sexual: array of "text" or "image"`
162
163 The applied input type(s) for the category 'sexual'.
164
165 - `"text"`
166
167 - `"image"`
168
169 - `sexual/minors: array of "text"`
170
171 The applied input type(s) for the category 'sexual/minors'.
172
173 - `"text"`
174
175 - `violence: array of "text" or "image"`
176
177 The applied input type(s) for the category 'violence'.
178
179 - `"text"`
180
181 - `"image"`
182
183 - `violence/graphic: array of "text" or "image"`
184
185 The applied input type(s) for the category 'violence/graphic'.
186
187 - `"text"`
188
189 - `"image"`
190
191 - `category_scores: object { harassment, "harassment/threatening", hate, 10 more }`
192
193 A list of the categories along with their scores as predicted by model.
194
195 - `harassment: number`
196
197 The score for the category 'harassment'.
198
199 - `harassment/threatening: number`
200
201 The score for the category 'harassment/threatening'.
202
203 - `hate: number`
204
205 The score for the category 'hate'.
206
207 - `hate/threatening: number`
208
209 The score for the category 'hate/threatening'.
210
211 - `illicit: number`
212
213 The score for the category 'illicit'.
214
215 - `illicit/violent: number`
216
217 The score for the category 'illicit/violent'.
218
219 - `self-harm: number`
220
221 The score for the category 'self-harm'.
222
223 - `self-harm/instructions: number`
224
225 The score for the category 'self-harm/instructions'.
226
227 - `self-harm/intent: number`
228
229 The score for the category 'self-harm/intent'.
230
231 - `sexual: number`
232
233 The score for the category 'sexual'.
234
235 - `sexual/minors: number`
236
237 The score for the category 'sexual/minors'.
238
239 - `violence: number`
240
241 The score for the category 'violence'.
242
243 - `violence/graphic: number`
244
245 The score for the category 'violence/graphic'.
246
247 - `flagged: boolean`
248
249 Whether any of the below categories are flagged.
250
251### Example
252
253```cli
254openai moderations create \
255 --api-key 'My API Key' \
256 --input 'I want to kill them.'
257```
258
259#### Response
260
261```json
262{
263 "id": "id",
264 "model": "model",
265 "results": [
266 {
267 "categories": {
268 "harassment": true,
269 "harassment/threatening": true,
270 "hate": true,
271 "hate/threatening": true,
272 "illicit": true,
273 "illicit/violent": true,
274 "self-harm": true,
275 "self-harm/instructions": true,
276 "self-harm/intent": true,
277 "sexual": true,
278 "sexual/minors": true,
279 "violence": true,
280 "violence/graphic": true
281 },
282 "category_applied_input_types": {
283 "harassment": [
284 "text"
285 ],
286 "harassment/threatening": [
287 "text"
288 ],
289 "hate": [
290 "text"
291 ],
292 "hate/threatening": [
293 "text"
294 ],
295 "illicit": [
296 "text"
297 ],
298 "illicit/violent": [
299 "text"
300 ],
301 "self-harm": [
302 "text"
303 ],
304 "self-harm/instructions": [
305 "text"
306 ],
307 "self-harm/intent": [
308 "text"
309 ],
310 "sexual": [
311 "text"
312 ],
313 "sexual/minors": [
314 "text"
315 ],
316 "violence": [
317 "text"
318 ],
319 "violence/graphic": [
320 "text"
321 ]
322 },
323 "category_scores": {
324 "harassment": 0,
325 "harassment/threatening": 0,
326 "hate": 0,
327 "hate/threatening": 0,
328 "illicit": 0,
329 "illicit/violent": 0,
330 "self-harm": 0,
331 "self-harm/instructions": 0,
332 "self-harm/intent": 0,
333 "sexual": 0,
334 "sexual/minors": 0,
335 "violence": 0,
336 "violence/graphic": 0
337 },
338 "flagged": true
339 }
340 ]
341}
342```