-
Notifications
You must be signed in to change notification settings - Fork 34
/
moderation.go
631 lines (536 loc) · 22.9 KB
/
moderation.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package openai
import (
"context"
"net/http"
"github.com/openai/openai-go/internal/apijson"
"github.com/openai/openai-go/internal/param"
"github.com/openai/openai-go/internal/requestconfig"
"github.com/openai/openai-go/option"
)
// ModerationService contains methods and other services that help with interacting
// with the openai API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewModerationService] method instead.
type ModerationService struct {
Options []option.RequestOption
}
// NewModerationService generates a new service that applies the given options to
// each request. These options are applied after the parent client's options (if
// there is one), and before any request-specific options.
func NewModerationService(opts ...option.RequestOption) (r *ModerationService) {
r = &ModerationService{}
r.Options = opts
return
}
// Classifies if text and/or image inputs are potentially harmful. Learn more in
// the [moderation guide](https://platform.openai.com/docs/guides/moderation).
func (r *ModerationService) New(ctx context.Context, body ModerationNewParams, opts ...option.RequestOption) (res *ModerationNewResponse, err error) {
opts = append(r.Options[:], opts...)
path := "moderations"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
type Moderation struct {
// A list of the categories, and whether they are flagged or not.
Categories ModerationCategories `json:"categories,required"`
// A list of the categories along with the input type(s) that the score applies to.
CategoryAppliedInputTypes ModerationCategoryAppliedInputTypes `json:"category_applied_input_types,required"`
// A list of the categories along with their scores as predicted by model.
CategoryScores ModerationCategoryScores `json:"category_scores,required"`
// Whether any of the below categories are flagged.
Flagged bool `json:"flagged,required"`
JSON moderationJSON `json:"-"`
}
// moderationJSON contains the JSON metadata for the struct [Moderation]
type moderationJSON struct {
Categories apijson.Field
CategoryAppliedInputTypes apijson.Field
CategoryScores apijson.Field
Flagged apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *Moderation) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r moderationJSON) RawJSON() string {
return r.raw
}
// A list of the categories, and whether they are flagged or not.
type ModerationCategories struct {
// Content that expresses, incites, or promotes harassing language towards any
// target.
Harassment bool `json:"harassment,required"`
// Harassment content that also includes violence or serious harm towards any
// target.
HarassmentThreatening bool `json:"harassment/threatening,required"`
// 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.
Hate bool `json:"hate,required"`
// 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.
HateThreatening bool `json:"hate/threatening,required"`
// 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.
Illicit bool `json:"illicit,required"`
// 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.
IllicitViolent bool `json:"illicit/violent,required"`
// Content that promotes, encourages, or depicts acts of self-harm, such as
// suicide, cutting, and eating disorders.
SelfHarm bool `json:"self-harm,required"`
// 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.
SelfHarmInstructions bool `json:"self-harm/instructions,required"`
// 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.
SelfHarmIntent bool `json:"self-harm/intent,required"`
// Content meant to arouse sexual excitement, such as the description of sexual
// activity, or that promotes sexual services (excluding sex education and
// wellness).
Sexual bool `json:"sexual,required"`
// Sexual content that includes an individual who is under 18 years old.
SexualMinors bool `json:"sexual/minors,required"`
// Content that depicts death, violence, or physical injury.
Violence bool `json:"violence,required"`
// Content that depicts death, violence, or physical injury in graphic detail.
ViolenceGraphic bool `json:"violence/graphic,required"`
JSON moderationCategoriesJSON `json:"-"`
}
// moderationCategoriesJSON contains the JSON metadata for the struct
// [ModerationCategories]
type moderationCategoriesJSON struct {
Harassment apijson.Field
HarassmentThreatening apijson.Field
Hate apijson.Field
HateThreatening apijson.Field
Illicit apijson.Field
IllicitViolent apijson.Field
SelfHarm apijson.Field
SelfHarmInstructions apijson.Field
SelfHarmIntent apijson.Field
Sexual apijson.Field
SexualMinors apijson.Field
Violence apijson.Field
ViolenceGraphic apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ModerationCategories) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r moderationCategoriesJSON) RawJSON() string {
return r.raw
}
// A list of the categories along with the input type(s) that the score applies to.
type ModerationCategoryAppliedInputTypes struct {
// The applied input type(s) for the category 'harassment'.
Harassment []ModerationCategoryAppliedInputTypesHarassment `json:"harassment,required"`
// The applied input type(s) for the category 'harassment/threatening'.
HarassmentThreatening []ModerationCategoryAppliedInputTypesHarassmentThreatening `json:"harassment/threatening,required"`
// The applied input type(s) for the category 'hate'.
Hate []ModerationCategoryAppliedInputTypesHate `json:"hate,required"`
// The applied input type(s) for the category 'hate/threatening'.
HateThreatening []ModerationCategoryAppliedInputTypesHateThreatening `json:"hate/threatening,required"`
// The applied input type(s) for the category 'illicit'.
Illicit []ModerationCategoryAppliedInputTypesIllicit `json:"illicit,required"`
// The applied input type(s) for the category 'illicit/violent'.
IllicitViolent []ModerationCategoryAppliedInputTypesIllicitViolent `json:"illicit/violent,required"`
// The applied input type(s) for the category 'self-harm'.
SelfHarm []ModerationCategoryAppliedInputTypesSelfHarm `json:"self-harm,required"`
// The applied input type(s) for the category 'self-harm/instructions'.
SelfHarmInstructions []ModerationCategoryAppliedInputTypesSelfHarmInstruction `json:"self-harm/instructions,required"`
// The applied input type(s) for the category 'self-harm/intent'.
SelfHarmIntent []ModerationCategoryAppliedInputTypesSelfHarmIntent `json:"self-harm/intent,required"`
// The applied input type(s) for the category 'sexual'.
Sexual []ModerationCategoryAppliedInputTypesSexual `json:"sexual,required"`
// The applied input type(s) for the category 'sexual/minors'.
SexualMinors []ModerationCategoryAppliedInputTypesSexualMinor `json:"sexual/minors,required"`
// The applied input type(s) for the category 'violence'.
Violence []ModerationCategoryAppliedInputTypesViolence `json:"violence,required"`
// The applied input type(s) for the category 'violence/graphic'.
ViolenceGraphic []ModerationCategoryAppliedInputTypesViolenceGraphic `json:"violence/graphic,required"`
JSON moderationCategoryAppliedInputTypesJSON `json:"-"`
}
// moderationCategoryAppliedInputTypesJSON contains the JSON metadata for the
// struct [ModerationCategoryAppliedInputTypes]
type moderationCategoryAppliedInputTypesJSON struct {
Harassment apijson.Field
HarassmentThreatening apijson.Field
Hate apijson.Field
HateThreatening apijson.Field
Illicit apijson.Field
IllicitViolent apijson.Field
SelfHarm apijson.Field
SelfHarmInstructions apijson.Field
SelfHarmIntent apijson.Field
Sexual apijson.Field
SexualMinors apijson.Field
Violence apijson.Field
ViolenceGraphic apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ModerationCategoryAppliedInputTypes) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r moderationCategoryAppliedInputTypesJSON) RawJSON() string {
return r.raw
}
type ModerationCategoryAppliedInputTypesHarassment string
const (
ModerationCategoryAppliedInputTypesHarassmentText ModerationCategoryAppliedInputTypesHarassment = "text"
)
func (r ModerationCategoryAppliedInputTypesHarassment) IsKnown() bool {
switch r {
case ModerationCategoryAppliedInputTypesHarassmentText:
return true
}
return false
}
type ModerationCategoryAppliedInputTypesHarassmentThreatening string
const (
ModerationCategoryAppliedInputTypesHarassmentThreateningText ModerationCategoryAppliedInputTypesHarassmentThreatening = "text"
)
func (r ModerationCategoryAppliedInputTypesHarassmentThreatening) IsKnown() bool {
switch r {
case ModerationCategoryAppliedInputTypesHarassmentThreateningText:
return true
}
return false
}
type ModerationCategoryAppliedInputTypesHate string
const (
ModerationCategoryAppliedInputTypesHateText ModerationCategoryAppliedInputTypesHate = "text"
)
func (r ModerationCategoryAppliedInputTypesHate) IsKnown() bool {
switch r {
case ModerationCategoryAppliedInputTypesHateText:
return true
}
return false
}
type ModerationCategoryAppliedInputTypesHateThreatening string
const (
ModerationCategoryAppliedInputTypesHateThreateningText ModerationCategoryAppliedInputTypesHateThreatening = "text"
)
func (r ModerationCategoryAppliedInputTypesHateThreatening) IsKnown() bool {
switch r {
case ModerationCategoryAppliedInputTypesHateThreateningText:
return true
}
return false
}
type ModerationCategoryAppliedInputTypesIllicit string
const (
ModerationCategoryAppliedInputTypesIllicitText ModerationCategoryAppliedInputTypesIllicit = "text"
)
func (r ModerationCategoryAppliedInputTypesIllicit) IsKnown() bool {
switch r {
case ModerationCategoryAppliedInputTypesIllicitText:
return true
}
return false
}
type ModerationCategoryAppliedInputTypesIllicitViolent string
const (
ModerationCategoryAppliedInputTypesIllicitViolentText ModerationCategoryAppliedInputTypesIllicitViolent = "text"
)
func (r ModerationCategoryAppliedInputTypesIllicitViolent) IsKnown() bool {
switch r {
case ModerationCategoryAppliedInputTypesIllicitViolentText:
return true
}
return false
}
type ModerationCategoryAppliedInputTypesSelfHarm string
const (
ModerationCategoryAppliedInputTypesSelfHarmText ModerationCategoryAppliedInputTypesSelfHarm = "text"
ModerationCategoryAppliedInputTypesSelfHarmImage ModerationCategoryAppliedInputTypesSelfHarm = "image"
)
func (r ModerationCategoryAppliedInputTypesSelfHarm) IsKnown() bool {
switch r {
case ModerationCategoryAppliedInputTypesSelfHarmText, ModerationCategoryAppliedInputTypesSelfHarmImage:
return true
}
return false
}
type ModerationCategoryAppliedInputTypesSelfHarmInstruction string
const (
ModerationCategoryAppliedInputTypesSelfHarmInstructionText ModerationCategoryAppliedInputTypesSelfHarmInstruction = "text"
ModerationCategoryAppliedInputTypesSelfHarmInstructionImage ModerationCategoryAppliedInputTypesSelfHarmInstruction = "image"
)
func (r ModerationCategoryAppliedInputTypesSelfHarmInstruction) IsKnown() bool {
switch r {
case ModerationCategoryAppliedInputTypesSelfHarmInstructionText, ModerationCategoryAppliedInputTypesSelfHarmInstructionImage:
return true
}
return false
}
type ModerationCategoryAppliedInputTypesSelfHarmIntent string
const (
ModerationCategoryAppliedInputTypesSelfHarmIntentText ModerationCategoryAppliedInputTypesSelfHarmIntent = "text"
ModerationCategoryAppliedInputTypesSelfHarmIntentImage ModerationCategoryAppliedInputTypesSelfHarmIntent = "image"
)
func (r ModerationCategoryAppliedInputTypesSelfHarmIntent) IsKnown() bool {
switch r {
case ModerationCategoryAppliedInputTypesSelfHarmIntentText, ModerationCategoryAppliedInputTypesSelfHarmIntentImage:
return true
}
return false
}
type ModerationCategoryAppliedInputTypesSexual string
const (
ModerationCategoryAppliedInputTypesSexualText ModerationCategoryAppliedInputTypesSexual = "text"
ModerationCategoryAppliedInputTypesSexualImage ModerationCategoryAppliedInputTypesSexual = "image"
)
func (r ModerationCategoryAppliedInputTypesSexual) IsKnown() bool {
switch r {
case ModerationCategoryAppliedInputTypesSexualText, ModerationCategoryAppliedInputTypesSexualImage:
return true
}
return false
}
type ModerationCategoryAppliedInputTypesSexualMinor string
const (
ModerationCategoryAppliedInputTypesSexualMinorText ModerationCategoryAppliedInputTypesSexualMinor = "text"
)
func (r ModerationCategoryAppliedInputTypesSexualMinor) IsKnown() bool {
switch r {
case ModerationCategoryAppliedInputTypesSexualMinorText:
return true
}
return false
}
type ModerationCategoryAppliedInputTypesViolence string
const (
ModerationCategoryAppliedInputTypesViolenceText ModerationCategoryAppliedInputTypesViolence = "text"
ModerationCategoryAppliedInputTypesViolenceImage ModerationCategoryAppliedInputTypesViolence = "image"
)
func (r ModerationCategoryAppliedInputTypesViolence) IsKnown() bool {
switch r {
case ModerationCategoryAppliedInputTypesViolenceText, ModerationCategoryAppliedInputTypesViolenceImage:
return true
}
return false
}
type ModerationCategoryAppliedInputTypesViolenceGraphic string
const (
ModerationCategoryAppliedInputTypesViolenceGraphicText ModerationCategoryAppliedInputTypesViolenceGraphic = "text"
ModerationCategoryAppliedInputTypesViolenceGraphicImage ModerationCategoryAppliedInputTypesViolenceGraphic = "image"
)
func (r ModerationCategoryAppliedInputTypesViolenceGraphic) IsKnown() bool {
switch r {
case ModerationCategoryAppliedInputTypesViolenceGraphicText, ModerationCategoryAppliedInputTypesViolenceGraphicImage:
return true
}
return false
}
// A list of the categories along with their scores as predicted by model.
type ModerationCategoryScores struct {
// The score for the category 'harassment'.
Harassment float64 `json:"harassment,required"`
// The score for the category 'harassment/threatening'.
HarassmentThreatening float64 `json:"harassment/threatening,required"`
// The score for the category 'hate'.
Hate float64 `json:"hate,required"`
// The score for the category 'hate/threatening'.
HateThreatening float64 `json:"hate/threatening,required"`
// The score for the category 'illicit'.
Illicit float64 `json:"illicit,required"`
// The score for the category 'illicit/violent'.
IllicitViolent float64 `json:"illicit/violent,required"`
// The score for the category 'self-harm'.
SelfHarm float64 `json:"self-harm,required"`
// The score for the category 'self-harm/instructions'.
SelfHarmInstructions float64 `json:"self-harm/instructions,required"`
// The score for the category 'self-harm/intent'.
SelfHarmIntent float64 `json:"self-harm/intent,required"`
// The score for the category 'sexual'.
Sexual float64 `json:"sexual,required"`
// The score for the category 'sexual/minors'.
SexualMinors float64 `json:"sexual/minors,required"`
// The score for the category 'violence'.
Violence float64 `json:"violence,required"`
// The score for the category 'violence/graphic'.
ViolenceGraphic float64 `json:"violence/graphic,required"`
JSON moderationCategoryScoresJSON `json:"-"`
}
// moderationCategoryScoresJSON contains the JSON metadata for the struct
// [ModerationCategoryScores]
type moderationCategoryScoresJSON struct {
Harassment apijson.Field
HarassmentThreatening apijson.Field
Hate apijson.Field
HateThreatening apijson.Field
Illicit apijson.Field
IllicitViolent apijson.Field
SelfHarm apijson.Field
SelfHarmInstructions apijson.Field
SelfHarmIntent apijson.Field
Sexual apijson.Field
SexualMinors apijson.Field
Violence apijson.Field
ViolenceGraphic apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ModerationCategoryScores) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r moderationCategoryScoresJSON) RawJSON() string {
return r.raw
}
// An object describing an image to classify.
type ModerationImageURLInputParam struct {
// Contains either an image URL or a data URL for a base64 encoded image.
ImageURL param.Field[ModerationImageURLInputImageURLParam] `json:"image_url,required"`
// Always `image_url`.
Type param.Field[ModerationImageURLInputType] `json:"type,required"`
}
func (r ModerationImageURLInputParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r ModerationImageURLInputParam) implementsModerationMultiModalInputUnionParam() {}
// Contains either an image URL or a data URL for a base64 encoded image.
type ModerationImageURLInputImageURLParam struct {
// Either a URL of the image or the base64 encoded image data.
URL param.Field[string] `json:"url,required" format:"uri"`
}
func (r ModerationImageURLInputImageURLParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Always `image_url`.
type ModerationImageURLInputType string
const (
ModerationImageURLInputTypeImageURL ModerationImageURLInputType = "image_url"
)
func (r ModerationImageURLInputType) IsKnown() bool {
switch r {
case ModerationImageURLInputTypeImageURL:
return true
}
return false
}
type ModerationModel = string
const (
ModerationModelOmniModerationLatest ModerationModel = "omni-moderation-latest"
ModerationModelOmniModeration2024_09_26 ModerationModel = "omni-moderation-2024-09-26"
ModerationModelTextModerationLatest ModerationModel = "text-moderation-latest"
ModerationModelTextModerationStable ModerationModel = "text-moderation-stable"
)
// An object describing an image to classify.
type ModerationMultiModalInputParam struct {
// Always `image_url`.
Type param.Field[ModerationMultiModalInputType] `json:"type,required"`
ImageURL param.Field[interface{}] `json:"image_url"`
// A string of text to classify.
Text param.Field[string] `json:"text"`
}
func (r ModerationMultiModalInputParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r ModerationMultiModalInputParam) implementsModerationMultiModalInputUnionParam() {}
// An object describing an image to classify.
//
// Satisfied by [ModerationImageURLInputParam], [ModerationTextInputParam],
// [ModerationMultiModalInputParam].
type ModerationMultiModalInputUnionParam interface {
implementsModerationMultiModalInputUnionParam()
}
// Always `image_url`.
type ModerationMultiModalInputType string
const (
ModerationMultiModalInputTypeImageURL ModerationMultiModalInputType = "image_url"
ModerationMultiModalInputTypeText ModerationMultiModalInputType = "text"
)
func (r ModerationMultiModalInputType) IsKnown() bool {
switch r {
case ModerationMultiModalInputTypeImageURL, ModerationMultiModalInputTypeText:
return true
}
return false
}
// An object describing text to classify.
type ModerationTextInputParam struct {
// A string of text to classify.
Text param.Field[string] `json:"text,required"`
// Always `text`.
Type param.Field[ModerationTextInputType] `json:"type,required"`
}
func (r ModerationTextInputParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
func (r ModerationTextInputParam) implementsModerationMultiModalInputUnionParam() {}
// Always `text`.
type ModerationTextInputType string
const (
ModerationTextInputTypeText ModerationTextInputType = "text"
)
func (r ModerationTextInputType) IsKnown() bool {
switch r {
case ModerationTextInputTypeText:
return true
}
return false
}
// Represents if a given text input is potentially harmful.
type ModerationNewResponse struct {
// The unique identifier for the moderation request.
ID string `json:"id,required"`
// The model used to generate the moderation results.
Model string `json:"model,required"`
// A list of moderation objects.
Results []Moderation `json:"results,required"`
JSON moderationNewResponseJSON `json:"-"`
}
// moderationNewResponseJSON contains the JSON metadata for the struct
// [ModerationNewResponse]
type moderationNewResponseJSON struct {
ID apijson.Field
Model apijson.Field
Results apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ModerationNewResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r moderationNewResponseJSON) RawJSON() string {
return r.raw
}
type ModerationNewParams struct {
// Input (or inputs) to classify. Can be a single string, an array of strings, or
// an array of multi-modal input objects similar to other models.
Input param.Field[ModerationNewParamsInputUnion] `json:"input,required"`
// The content moderation model you would like to use. Learn more in
// [the moderation guide](https://platform.openai.com/docs/guides/moderation), and
// learn about available models
// [here](https://platform.openai.com/docs/models#moderation).
Model param.Field[ModerationModel] `json:"model"`
}
func (r ModerationNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Input (or inputs) to classify. Can be a single string, an array of strings, or
// an array of multi-modal input objects similar to other models.
//
// Satisfied by [shared.UnionString], [ModerationNewParamsInputArray],
// [ModerationNewParamsInputModerationMultiModalArray].
type ModerationNewParamsInputUnion interface {
ImplementsModerationNewParamsInputUnion()
}
type ModerationNewParamsInputArray []string
func (r ModerationNewParamsInputArray) ImplementsModerationNewParamsInputUnion() {}
type ModerationNewParamsInputModerationMultiModalArray []ModerationMultiModalInputUnionParam
func (r ModerationNewParamsInputModerationMultiModalArray) ImplementsModerationNewParamsInputUnion() {
}