openai 4.63.0 → 4.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +1 -1
  3. package/core.d.ts +2 -1
  4. package/core.d.ts.map +1 -1
  5. package/core.js +16 -4
  6. package/core.js.map +1 -1
  7. package/core.mjs +13 -2
  8. package/core.mjs.map +1 -1
  9. package/index.d.mts +4 -0
  10. package/index.d.ts +4 -0
  11. package/index.d.ts.map +1 -1
  12. package/index.js.map +1 -1
  13. package/index.mjs.map +1 -1
  14. package/package.json +1 -1
  15. package/resources/audio/audio.d.ts +6 -0
  16. package/resources/audio/audio.d.ts.map +1 -1
  17. package/resources/audio/audio.js.map +1 -1
  18. package/resources/audio/audio.mjs.map +1 -1
  19. package/resources/audio/index.d.ts +1 -1
  20. package/resources/audio/index.d.ts.map +1 -1
  21. package/resources/audio/index.js.map +1 -1
  22. package/resources/audio/index.mjs.map +1 -1
  23. package/resources/audio/transcriptions.d.ts +3 -3
  24. package/resources/audio/transcriptions.d.ts.map +1 -1
  25. package/resources/audio/translations.d.ts +3 -3
  26. package/resources/audio/translations.d.ts.map +1 -1
  27. package/resources/index.d.ts +2 -2
  28. package/resources/index.d.ts.map +1 -1
  29. package/resources/index.js.map +1 -1
  30. package/resources/index.mjs.map +1 -1
  31. package/resources/moderations.d.ts +135 -12
  32. package/resources/moderations.d.ts.map +1 -1
  33. package/resources/moderations.js +2 -1
  34. package/resources/moderations.js.map +1 -1
  35. package/resources/moderations.mjs +2 -1
  36. package/resources/moderations.mjs.map +1 -1
  37. package/src/core.ts +15 -3
  38. package/src/index.ts +4 -0
  39. package/src/resources/audio/audio.ts +7 -0
  40. package/src/resources/audio/index.ts +1 -1
  41. package/src/resources/audio/transcriptions.ts +3 -3
  42. package/src/resources/audio/translations.ts +3 -3
  43. package/src/resources/index.ts +4 -1
  44. package/src/resources/moderations.ts +163 -12
  45. package/src/version.ts +1 -1
  46. package/version.d.ts +1 -1
  47. package/version.js +1 -1
  48. package/version.mjs +1 -1
@@ -6,7 +6,8 @@ import * as ModerationsAPI from './moderations';
6
6
 
7
7
  export class Moderations extends APIResource {
8
8
  /**
9
- * Classifies if text is potentially harmful.
9
+ * Classifies if text and/or image inputs are potentially harmful. Learn more in
10
+ * the [moderation guide](https://platform.openai.com/docs/guides/moderation).
10
11
  */
11
12
  create(
12
13
  body: ModerationCreateParams,
@@ -22,6 +23,11 @@ export interface Moderation {
22
23
  */
23
24
  categories: Moderation.Categories;
24
25
 
26
+ /**
27
+ * A list of the categories along with the input type(s) that the score applies to.
28
+ */
29
+ category_applied_input_types: Moderation.CategoryAppliedInputTypes;
30
+
25
31
  /**
26
32
  * A list of the categories along with their scores as predicted by model.
27
33
  */
@@ -65,6 +71,20 @@ export namespace Moderation {
65
71
  */
66
72
  'hate/threatening': boolean;
67
73
 
74
+ /**
75
+ * Content that includes instructions or advice that facilitate the planning or
76
+ * execution of wrongdoing, or that gives advice or instruction on how to commit
77
+ * illicit acts. For example, "how to shoplift" would fit this category.
78
+ */
79
+ illicit: boolean;
80
+
81
+ /**
82
+ * Content that includes instructions or advice that facilitate the planning or
83
+ * execution of wrongdoing that also includes violence, or that gives advice or
84
+ * instruction on the procurement of any weapon.
85
+ */
86
+ 'illicit/violent': boolean;
87
+
68
88
  /**
69
89
  * Content that promotes, encourages, or depicts acts of self-harm, such as
70
90
  * suicide, cutting, and eating disorders.
@@ -107,6 +127,76 @@ export namespace Moderation {
107
127
  'violence/graphic': boolean;
108
128
  }
109
129
 
130
+ /**
131
+ * A list of the categories along with the input type(s) that the score applies to.
132
+ */
133
+ export interface CategoryAppliedInputTypes {
134
+ /**
135
+ * The applied input type(s) for the category 'harassment'.
136
+ */
137
+ harassment: Array<'text'>;
138
+
139
+ /**
140
+ * The applied input type(s) for the category 'harassment/threatening'.
141
+ */
142
+ 'harassment/threatening': Array<'text'>;
143
+
144
+ /**
145
+ * The applied input type(s) for the category 'hate'.
146
+ */
147
+ hate: Array<'text'>;
148
+
149
+ /**
150
+ * The applied input type(s) for the category 'hate/threatening'.
151
+ */
152
+ 'hate/threatening': Array<'text'>;
153
+
154
+ /**
155
+ * The applied input type(s) for the category 'illicit'.
156
+ */
157
+ illicit: Array<'text'>;
158
+
159
+ /**
160
+ * The applied input type(s) for the category 'illicit/violent'.
161
+ */
162
+ 'illicit/violent': Array<'text'>;
163
+
164
+ /**
165
+ * The applied input type(s) for the category 'self-harm'.
166
+ */
167
+ 'self-harm': Array<'text' | 'image'>;
168
+
169
+ /**
170
+ * The applied input type(s) for the category 'self-harm/instructions'.
171
+ */
172
+ 'self-harm/instructions': Array<'text' | 'image'>;
173
+
174
+ /**
175
+ * The applied input type(s) for the category 'self-harm/intent'.
176
+ */
177
+ 'self-harm/intent': Array<'text' | 'image'>;
178
+
179
+ /**
180
+ * The applied input type(s) for the category 'sexual'.
181
+ */
182
+ sexual: Array<'text' | 'image'>;
183
+
184
+ /**
185
+ * The applied input type(s) for the category 'sexual/minors'.
186
+ */
187
+ 'sexual/minors': Array<'text'>;
188
+
189
+ /**
190
+ * The applied input type(s) for the category 'violence'.
191
+ */
192
+ violence: Array<'text' | 'image'>;
193
+
194
+ /**
195
+ * The applied input type(s) for the category 'violence/graphic'.
196
+ */
197
+ 'violence/graphic': Array<'text' | 'image'>;
198
+ }
199
+
110
200
  /**
111
201
  * A list of the categories along with their scores as predicted by model.
112
202
  */
@@ -131,6 +221,16 @@ export namespace Moderation {
131
221
  */
132
222
  'hate/threatening': number;
133
223
 
224
+ /**
225
+ * The score for the category 'illicit'.
226
+ */
227
+ illicit: number;
228
+
229
+ /**
230
+ * The score for the category 'illicit/violent'.
231
+ */
232
+ 'illicit/violent': number;
233
+
134
234
  /**
135
235
  * The score for the category 'self-harm'.
136
236
  */
@@ -168,7 +268,58 @@ export namespace Moderation {
168
268
  }
169
269
  }
170
270
 
171
- export type ModerationModel = 'text-moderation-latest' | 'text-moderation-stable';
271
+ /**
272
+ * An object describing an image to classify.
273
+ */
274
+ export interface ModerationImageURLInput {
275
+ /**
276
+ * Contains either an image URL or a data URL for a base64 encoded image.
277
+ */
278
+ image_url: ModerationImageURLInput.ImageURL;
279
+
280
+ /**
281
+ * Always `image_url`.
282
+ */
283
+ type: 'image_url';
284
+ }
285
+
286
+ export namespace ModerationImageURLInput {
287
+ /**
288
+ * Contains either an image URL or a data URL for a base64 encoded image.
289
+ */
290
+ export interface ImageURL {
291
+ /**
292
+ * Either a URL of the image or the base64 encoded image data.
293
+ */
294
+ url: string;
295
+ }
296
+ }
297
+
298
+ export type ModerationModel =
299
+ | 'omni-moderation-latest'
300
+ | 'omni-moderation-2024-09-26'
301
+ | 'text-moderation-latest'
302
+ | 'text-moderation-stable';
303
+
304
+ /**
305
+ * An object describing an image to classify.
306
+ */
307
+ export type ModerationMultiModalInput = ModerationImageURLInput | ModerationTextInput;
308
+
309
+ /**
310
+ * An object describing text to classify.
311
+ */
312
+ export interface ModerationTextInput {
313
+ /**
314
+ * A string of text to classify.
315
+ */
316
+ text: string;
317
+
318
+ /**
319
+ * Always `text`.
320
+ */
321
+ type: 'text';
322
+ }
172
323
 
173
324
  /**
174
325
  * Represents if a given text input is potentially harmful.
@@ -192,26 +343,26 @@ export interface ModerationCreateResponse {
192
343
 
193
344
  export interface ModerationCreateParams {
194
345
  /**
195
- * The input text to classify
346
+ * Input (or inputs) to classify. Can be a single string, an array of strings, or
347
+ * an array of multi-modal input objects similar to other models.
196
348
  */
197
- input: string | Array<string>;
349
+ input: string | Array<string> | Array<ModerationMultiModalInput>;
198
350
 
199
351
  /**
200
- * Two content moderations models are available: `text-moderation-stable` and
201
- * `text-moderation-latest`.
202
- *
203
- * The default is `text-moderation-latest` which will be automatically upgraded
204
- * over time. This ensures you are always using our most accurate model. If you use
205
- * `text-moderation-stable`, we will provide advanced notice before updating the
206
- * model. Accuracy of `text-moderation-stable` may be slightly lower than for
207
- * `text-moderation-latest`.
352
+ * The content moderation model you would like to use. Learn more in
353
+ * [the moderation guide](https://platform.openai.com/docs/guides/moderation), and
354
+ * learn about available models
355
+ * [here](https://platform.openai.com/docs/models/moderation).
208
356
  */
209
357
  model?: (string & {}) | ModerationModel;
210
358
  }
211
359
 
212
360
  export namespace Moderations {
213
361
  export import Moderation = ModerationsAPI.Moderation;
362
+ export import ModerationImageURLInput = ModerationsAPI.ModerationImageURLInput;
214
363
  export import ModerationModel = ModerationsAPI.ModerationModel;
364
+ export import ModerationMultiModalInput = ModerationsAPI.ModerationMultiModalInput;
365
+ export import ModerationTextInput = ModerationsAPI.ModerationTextInput;
215
366
  export import ModerationCreateResponse = ModerationsAPI.ModerationCreateResponse;
216
367
  export import ModerationCreateParams = ModerationsAPI.ModerationCreateParams;
217
368
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '4.63.0'; // x-release-please-version
1
+ export const VERSION = '4.65.0'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "4.63.0";
1
+ export declare const VERSION = "4.65.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '4.63.0'; // x-release-please-version
4
+ exports.VERSION = '4.65.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '4.63.0'; // x-release-please-version
1
+ export const VERSION = '4.65.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map