You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Two content moderations models are available: text-moderation-stable and text-moderation-latest.
1283
+
/// The default is text-moderation-latest which will be automatically upgraded over time. This ensures you are always using our most accurate model. If you use text-moderation-stable, we will provide advanced notice before updating the model. Accuracy of text-moderation-stable may be slightly lower than for text-moderation-latest.
1284
+
let model: String?
1285
+
1286
+
enumModel: String{
1287
+
casestable="text-moderation-stable"
1288
+
caselatest="text-moderation-latest"
1289
+
}
1290
+
1291
+
init(
1292
+
input: Input,
1293
+
model: Model?=nil)
1294
+
{
1295
+
self.input= input
1296
+
self.model= model?.rawValue
1297
+
}
1298
+
}
1299
+
```
1300
+
Response
1301
+
```swift
1302
+
/// The [moderation object](https://platform.openai.com/docs/api-reference/moderations/object). Represents policy compliance report by OpenAI's content moderation model against a given input.
1303
+
publicstructModerationObject: Decodable {
1304
+
1305
+
/// The unique identifier for the moderation request.
1306
+
publiclet id: String
1307
+
/// The model used to generate the moderation results.
1308
+
publiclet model: String
1309
+
/// A list of moderation objects.
1310
+
publiclet results: [Moderation]
1311
+
1312
+
publicstructModeration: Decodable {
1313
+
1314
+
/// Whether the content violates OpenAI's usage policies.
1315
+
publiclet flagged: Bool
1316
+
/// A list of the categories, and whether they are flagged or not.
1317
+
publiclet categories: Category<Bool>
1318
+
/// A list of the categories along with their scores as predicted by model.
1319
+
publiclet categoryScores: Category<Double>
1320
+
1321
+
publicstructCategory<T: Decodable>: Decodable {
1322
+
1323
+
/// 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 harrassment.
1324
+
publiclet hate: T
1325
+
/// 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.
1326
+
publiclet hateThreatening: T
1327
+
/// Content that expresses, incites, or promotes harassing language towards any target.
1328
+
publiclet harassment: T
1329
+
/// Harassment content that also includes violence or serious harm towards any target.
1330
+
publiclet harassmentThreatening: T
1331
+
/// Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders.
1332
+
publiclet selfHarm: T
1333
+
/// 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.
1334
+
publiclet selfHarmIntent: T
1335
+
/// 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.
1336
+
publiclet selfHarmInstructions: T
1337
+
/// Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness).
1338
+
publiclet sexual: T
1339
+
/// Sexual content that includes an individual who is under 18 years old.
1340
+
publiclet sexualMinors: T
1341
+
/// Content that depicts death, violence, or physical injury.
1342
+
publiclet violence: T
1343
+
/// Content that depicts death, violence, or physical injury in graphic detail.
0 commit comments