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
@@ -9,8 +9,14 @@ export declare class Audio extends APIResource {
9
9
  speech: SpeechAPI.Speech;
10
10
  }
11
11
  export type AudioModel = 'whisper-1';
12
+ /**
13
+ * The format of the output, in one of these options: `json`, `text`, `srt`,
14
+ * `verbose_json`, or `vtt`.
15
+ */
16
+ export type AudioResponseFormat = 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt';
12
17
  export declare namespace Audio {
13
18
  export import AudioModel = AudioAPI.AudioModel;
19
+ export import AudioResponseFormat = AudioAPI.AudioResponseFormat;
14
20
  export import Transcriptions = TranscriptionsAPI.Transcriptions;
15
21
  export import Transcription = TranscriptionsAPI.Transcription;
16
22
  export import TranscriptionCreateParams = TranscriptionsAPI.TranscriptionCreateParams;
@@ -1 +1 @@
1
- {"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../../src/resources/audio/audio.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,SAAS,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,iBAAiB,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,eAAe,MAAM,gBAAgB,CAAC;AAElD,qBAAa,KAAM,SAAQ,WAAW;IACpC,cAAc,EAAE,iBAAiB,CAAC,cAAc,CAAsD;IACtG,YAAY,EAAE,eAAe,CAAC,YAAY,CAAkD;IAC5F,MAAM,EAAE,SAAS,CAAC,MAAM,CAAsC;CAC/D;AAED,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC;AAErC,yBAAiB,KAAK,CAAC;IACrB,MAAM,QAAQ,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;IAC/C,MAAM,QAAQ,cAAc,GAAG,iBAAiB,CAAC,cAAc,CAAC;IAChE,MAAM,QAAQ,aAAa,GAAG,iBAAiB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,"file":"audio.js","sourceRoot":"","sources":["../../src/resources/audio/audio.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,gDAA6C;AAE7C,uDAAsC;AACtC,uEAAsD;AACtD,mEAAkD;AAElD,MAAa,KAAM,SAAQ,sBAAW;IAAtC;;QACE,mBAAc,GAAqC,IAAI,iBAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtG,iBAAY,GAAiC,IAAI,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5F,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;CAAA;AAJD,sBAIC;AAUD,WAAiB,KAAK;IAGN,oBAAc,GAAG,iBAAiB,CAAC,cAAc,CAAC;IAGlD,kBAAY,GAAG,eAAe,CAAC,YAAY,CAAC;IAG5C,YAAM,GAAG,SAAS,CAAC,MAAM,CAAC;AAG1C,CAAC,EAZgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAYrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"audio.mjs","sourceRoot":"","sources":["../../src/resources/audio/audio.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,KAAK,SAAS;OACd,KAAK,iBAAiB;OACtB,KAAK,eAAe;AAE3B,MAAM,OAAO,KAAM,SAAQ,WAAW;IAAtC;;QACE,mBAAc,GAAqC,IAAI,iBAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtG,iBAAY,GAAiC,IAAI,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5F,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;CAAA;AAID,WAAiB,KAAK;IAEN,oBAAc,GAAG,iBAAiB,CAAC,cAAc,CAAC;IAGlD,kBAAY,GAAG,eAAe,CAAC,YAAY,CAAC;IAG5C,YAAM,GAAG,SAAS,CAAC,MAAM,CAAC;AAG1C,CAAC,EAXgB,KAAK,KAAL,KAAK,QAWrB"}
1
+ {"version":3,"file":"audio.mjs","sourceRoot":"","sources":["../../src/resources/audio/audio.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,KAAK,SAAS;OACd,KAAK,iBAAiB;OACtB,KAAK,eAAe;AAE3B,MAAM,OAAO,KAAM,SAAQ,WAAW;IAAtC;;QACE,mBAAc,GAAqC,IAAI,iBAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtG,iBAAY,GAAiC,IAAI,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5F,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;CAAA;AAUD,WAAiB,KAAK;IAGN,oBAAc,GAAG,iBAAiB,CAAC,cAAc,CAAC;IAGlD,kBAAY,GAAG,eAAe,CAAC,YAAY,CAAC;IAG5C,YAAM,GAAG,SAAS,CAAC,MAAM,CAAC;AAG1C,CAAC,EAZgB,KAAK,KAAL,KAAK,QAYrB"}
@@ -1,4 +1,4 @@
1
- export { AudioModel, Audio } from "./audio.js";
1
+ export { AudioModel, AudioResponseFormat, Audio } from "./audio.js";
2
2
  export { SpeechModel, SpeechCreateParams, Speech } from "./speech.js";
3
3
  export { Transcription, TranscriptionCreateParams, Transcriptions } from "./transcriptions.js";
4
4
  export { Translation, TranslationCreateParams, Translations } from "./translations.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/audio/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/audio/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/audio/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,oCAA4C;AAAvB,8FAAA,KAAK,OAAA;AAC1B,sCAAmE;AAAzB,gGAAA,MAAM,OAAA;AAChD,sDAA4F;AAAzC,gHAAA,cAAc,OAAA;AACjE,kDAAoF;AAArC,4GAAA,YAAY,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/audio/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,oCAAiE;AAAvB,8FAAA,KAAK,OAAA;AAC/C,sCAAmE;AAAzB,gGAAA,MAAM,OAAA;AAChD,sDAA4F;AAAzC,gHAAA,cAAc,OAAA;AACjE,kDAAoF;AAArC,4GAAA,YAAY,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/audio/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAc,KAAK,EAAE;OACrB,EAAmC,MAAM,EAAE;OAC3C,EAA4C,cAAc,EAAE;OAC5D,EAAwC,YAAY,EAAE"}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/audio/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAmC,KAAK,EAAE;OAC1C,EAAmC,MAAM,EAAE;OAC3C,EAA4C,cAAc,EAAE;OAC5D,EAAwC,YAAY,EAAE"}
@@ -43,10 +43,10 @@ export interface TranscriptionCreateParams {
43
43
  */
44
44
  prompt?: string;
45
45
  /**
46
- * The format of the transcript output, in one of these options: `json`, `text`,
47
- * `srt`, `verbose_json`, or `vtt`.
46
+ * The format of the output, in one of these options: `json`, `text`, `srt`,
47
+ * `verbose_json`, or `vtt`.
48
48
  */
49
- response_format?: 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt';
49
+ response_format?: AudioAPI.AudioResponseFormat;
50
50
  /**
51
51
  * The sampling temperature, between 0 and 1. Higher values like 0.8 will make the
52
52
  * output more random, while lower values like 0.2 will make it more focused and
@@ -1 +1 @@
1
- {"version":3,"file":"transcriptions.d.ts","sourceRoot":"","sources":["../../src/resources/audio/transcriptions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,iBAAiB,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAC;AAEpC,qBAAa,cAAe,SAAQ,WAAW;IAC7C;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,yBAAyB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;CAGvG;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;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AAC,UAAU,CAAC;IAEtB;;;OAGG;IACH,KAAK,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC;IAE3C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,eAAe,CAAC,EAAE,QAAQ,CAAC,mBAAmB,CAAC;IAE/C;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACrD;AAED,yBAAiB,cAAc,CAAC;IAC9B,MAAM,QAAQ,aAAa,GAAG,iBAAiB,CAAC,aAAa,CAAC;IAC9D,MAAM,QAAQ,yBAAyB,GAAG,iBAAiB,CAAC,yBAAyB,CAAC;CACvF"}
@@ -30,10 +30,10 @@ export interface TranslationCreateParams {
30
30
  */
31
31
  prompt?: string;
32
32
  /**
33
- * The format of the transcript output, in one of these options: `json`, `text`,
34
- * `srt`, `verbose_json`, or `vtt`.
33
+ * The format of the output, in one of these options: `json`, `text`, `srt`,
34
+ * `verbose_json`, or `vtt`.
35
35
  */
36
- response_format?: string;
36
+ response_format?: AudioAPI.AudioResponseFormat;
37
37
  /**
38
38
  * The sampling temperature, between 0 and 1. Higher values like 0.8 will make the
39
39
  * output more random, while lower values like 0.2 will make it more focused and
@@ -1 +1 @@
1
- {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../src/resources/audio/translations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,eAAe,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAC;AAEpC,qBAAa,YAAa,SAAQ,WAAW;IAC3C;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,IAAI,CAAC,UAAU,CAAC;IAEtB;;;OAGG;IACH,KAAK,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC;IAE3C;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,eAAe,CAAC,EAAE,QAAQ,CAAC,mBAAmB,CAAC;IAE/C;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,yBAAiB,YAAY,CAAC;IAC5B,MAAM,QAAQ,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC;IACxD,MAAM,QAAQ,uBAAuB,GAAG,eAAe,CAAC,uBAAuB,CAAC;CACjF"}
@@ -1,6 +1,6 @@
1
1
  export * from "./chat/index.js";
2
2
  export * from "./shared.js";
3
- export { AudioModel, Audio } from "./audio/audio.js";
3
+ export { AudioModel, AudioResponseFormat, Audio } from "./audio/audio.js";
4
4
  export { Batch, BatchError, BatchRequestCounts, BatchCreateParams, BatchListParams, BatchesPage, Batches, } from "./batches.js";
5
5
  export { Beta } from "./beta/beta.js";
6
6
  export { Completion, CompletionChoice, CompletionUsage, CompletionCreateParams, CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming, Completions, } from "./completions.js";
@@ -9,6 +9,6 @@ export { FileContent, FileDeleted, FileObject, FilePurpose, FileCreateParams, Fi
9
9
  export { FineTuning } from "./fine-tuning/fine-tuning.js";
10
10
  export { Image, ImageModel, ImagesResponse, ImageCreateVariationParams, ImageEditParams, ImageGenerateParams, Images, } from "./images.js";
11
11
  export { Model, ModelDeleted, ModelsPage, Models } from "./models.js";
12
- export { Moderation, ModerationModel, ModerationCreateResponse, ModerationCreateParams, Moderations, } from "./moderations.js";
12
+ export { Moderation, ModerationImageURLInput, ModerationModel, ModerationMultiModalInput, ModerationTextInput, ModerationCreateResponse, ModerationCreateParams, Moderations, } from "./moderations.js";
13
13
  export { Upload, UploadCreateParams, UploadCompleteParams, Uploads } from "./uploads/uploads.js";
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAEA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,OAAO,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,kCAAkC,EAClC,+BAA+B,EAC/B,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,cAAc,EACd,qBAAqB,EACrB,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,WAAW,EACX,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,KAAK,GACN,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EACL,KAAK,EACL,UAAU,EACV,cAAc,EACd,0BAA0B,EAC1B,eAAe,EACf,mBAAmB,EACnB,MAAM,GACP,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EACL,UAAU,EACV,eAAe,EACf,wBAAwB,EACxB,sBAAsB,EACtB,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAEA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EACL,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,OAAO,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,kCAAkC,EAClC,+BAA+B,EAC/B,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,cAAc,EACd,qBAAqB,EACrB,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,WAAW,EACX,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,KAAK,GACN,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EACL,KAAK,EACL,UAAU,EACV,cAAc,EACd,0BAA0B,EAC1B,eAAe,EACf,mBAAmB,EACnB,MAAM,GACP,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EACL,UAAU,EACV,uBAAuB,EACvB,eAAe,EACf,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"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@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;;;OAI/E,EAAc,KAAK,EAAE;OACrB,EAML,WAAW,EACX,OAAO,GACR;OACM,EAAE,IAAI,EAAE;OACR,EAOL,WAAW,GACZ;OACM,EAKL,UAAU,GACX;OACM,EAOL,eAAe,EACf,KAAK,GACN;OACM,EAAE,UAAU,EAAE;OACd,EAOL,MAAM,GACP;OACM,EAAuB,UAAU,EAAE,MAAM,EAAE;OAC3C,EAKL,WAAW,GACZ;OACM,EAAoD,OAAO,EAAE"}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;;;OAI/E,EAAmC,KAAK,EAAE;OAC1C,EAML,WAAW,EACX,OAAO,GACR;OACM,EAAE,IAAI,EAAE;OACR,EAOL,WAAW,GACZ;OACM,EAKL,UAAU,GACX;OACM,EAOL,eAAe,EACf,KAAK,GACN;OACM,EAAE,UAAU,EAAE;OACd,EAOL,MAAM,GACP;OACM,EAAuB,UAAU,EAAE,MAAM,EAAE;OAC3C,EAQL,WAAW,GACZ;OACM,EAAoD,OAAO,EAAE"}
@@ -3,7 +3,8 @@ import * as Core from "../core.js";
3
3
  import * as ModerationsAPI from "./moderations.js";
4
4
  export declare class Moderations extends APIResource {
5
5
  /**
6
- * Classifies if text is potentially harmful.
6
+ * Classifies if text and/or image inputs are potentially harmful. Learn more in
7
+ * the [moderation guide](https://platform.openai.com/docs/guides/moderation).
7
8
  */
8
9
  create(body: ModerationCreateParams, options?: Core.RequestOptions): Core.APIPromise<ModerationCreateResponse>;
9
10
  }
@@ -12,6 +13,10 @@ export interface Moderation {
12
13
  * A list of the categories, and whether they are flagged or not.
13
14
  */
14
15
  categories: Moderation.Categories;
16
+ /**
17
+ * A list of the categories along with the input type(s) that the score applies to.
18
+ */
19
+ category_applied_input_types: Moderation.CategoryAppliedInputTypes;
15
20
  /**
16
21
  * A list of the categories along with their scores as predicted by model.
17
22
  */
@@ -49,6 +54,18 @@ export declare namespace Moderation {
49
54
  * orientation, disability status, or caste.
50
55
  */
51
56
  'hate/threatening': boolean;
57
+ /**
58
+ * Content that includes instructions or advice that facilitate the planning or
59
+ * execution of wrongdoing, or that gives advice or instruction on how to commit
60
+ * illicit acts. For example, "how to shoplift" would fit this category.
61
+ */
62
+ illicit: boolean;
63
+ /**
64
+ * Content that includes instructions or advice that facilitate the planning or
65
+ * execution of wrongdoing that also includes violence, or that gives advice or
66
+ * instruction on the procurement of any weapon.
67
+ */
68
+ 'illicit/violent': boolean;
52
69
  /**
53
70
  * Content that promotes, encourages, or depicts acts of self-harm, such as
54
71
  * suicide, cutting, and eating disorders.
@@ -84,6 +101,63 @@ export declare namespace Moderation {
84
101
  */
85
102
  'violence/graphic': boolean;
86
103
  }
104
+ /**
105
+ * A list of the categories along with the input type(s) that the score applies to.
106
+ */
107
+ interface CategoryAppliedInputTypes {
108
+ /**
109
+ * The applied input type(s) for the category 'harassment'.
110
+ */
111
+ harassment: Array<'text'>;
112
+ /**
113
+ * The applied input type(s) for the category 'harassment/threatening'.
114
+ */
115
+ 'harassment/threatening': Array<'text'>;
116
+ /**
117
+ * The applied input type(s) for the category 'hate'.
118
+ */
119
+ hate: Array<'text'>;
120
+ /**
121
+ * The applied input type(s) for the category 'hate/threatening'.
122
+ */
123
+ 'hate/threatening': Array<'text'>;
124
+ /**
125
+ * The applied input type(s) for the category 'illicit'.
126
+ */
127
+ illicit: Array<'text'>;
128
+ /**
129
+ * The applied input type(s) for the category 'illicit/violent'.
130
+ */
131
+ 'illicit/violent': Array<'text'>;
132
+ /**
133
+ * The applied input type(s) for the category 'self-harm'.
134
+ */
135
+ 'self-harm': Array<'text' | 'image'>;
136
+ /**
137
+ * The applied input type(s) for the category 'self-harm/instructions'.
138
+ */
139
+ 'self-harm/instructions': Array<'text' | 'image'>;
140
+ /**
141
+ * The applied input type(s) for the category 'self-harm/intent'.
142
+ */
143
+ 'self-harm/intent': Array<'text' | 'image'>;
144
+ /**
145
+ * The applied input type(s) for the category 'sexual'.
146
+ */
147
+ sexual: Array<'text' | 'image'>;
148
+ /**
149
+ * The applied input type(s) for the category 'sexual/minors'.
150
+ */
151
+ 'sexual/minors': Array<'text'>;
152
+ /**
153
+ * The applied input type(s) for the category 'violence'.
154
+ */
155
+ violence: Array<'text' | 'image'>;
156
+ /**
157
+ * The applied input type(s) for the category 'violence/graphic'.
158
+ */
159
+ 'violence/graphic': Array<'text' | 'image'>;
160
+ }
87
161
  /**
88
162
  * A list of the categories along with their scores as predicted by model.
89
163
  */
@@ -104,6 +178,14 @@ export declare namespace Moderation {
104
178
  * The score for the category 'hate/threatening'.
105
179
  */
106
180
  'hate/threatening': number;
181
+ /**
182
+ * The score for the category 'illicit'.
183
+ */
184
+ illicit: number;
185
+ /**
186
+ * The score for the category 'illicit/violent'.
187
+ */
188
+ 'illicit/violent': number;
107
189
  /**
108
190
  * The score for the category 'self-harm'.
109
191
  */
@@ -134,7 +216,48 @@ export declare namespace Moderation {
134
216
  'violence/graphic': number;
135
217
  }
136
218
  }
137
- export type ModerationModel = 'text-moderation-latest' | 'text-moderation-stable';
219
+ /**
220
+ * An object describing an image to classify.
221
+ */
222
+ export interface ModerationImageURLInput {
223
+ /**
224
+ * Contains either an image URL or a data URL for a base64 encoded image.
225
+ */
226
+ image_url: ModerationImageURLInput.ImageURL;
227
+ /**
228
+ * Always `image_url`.
229
+ */
230
+ type: 'image_url';
231
+ }
232
+ export declare namespace ModerationImageURLInput {
233
+ /**
234
+ * Contains either an image URL or a data URL for a base64 encoded image.
235
+ */
236
+ interface ImageURL {
237
+ /**
238
+ * Either a URL of the image or the base64 encoded image data.
239
+ */
240
+ url: string;
241
+ }
242
+ }
243
+ export type ModerationModel = 'omni-moderation-latest' | 'omni-moderation-2024-09-26' | 'text-moderation-latest' | 'text-moderation-stable';
244
+ /**
245
+ * An object describing an image to classify.
246
+ */
247
+ export type ModerationMultiModalInput = ModerationImageURLInput | ModerationTextInput;
248
+ /**
249
+ * An object describing text to classify.
250
+ */
251
+ export interface ModerationTextInput {
252
+ /**
253
+ * A string of text to classify.
254
+ */
255
+ text: string;
256
+ /**
257
+ * Always `text`.
258
+ */
259
+ type: 'text';
260
+ }
138
261
  /**
139
262
  * Represents if a given text input is potentially harmful.
140
263
  */
@@ -154,24 +277,24 @@ export interface ModerationCreateResponse {
154
277
  }
155
278
  export interface ModerationCreateParams {
156
279
  /**
157
- * The input text to classify
280
+ * Input (or inputs) to classify. Can be a single string, an array of strings, or
281
+ * an array of multi-modal input objects similar to other models.
158
282
  */
159
- input: string | Array<string>;
283
+ input: string | Array<string> | Array<ModerationMultiModalInput>;
160
284
  /**
161
- * Two content moderations models are available: `text-moderation-stable` and
162
- * `text-moderation-latest`.
163
- *
164
- * The default is `text-moderation-latest` which will be automatically upgraded
165
- * over time. This ensures you are always using our most accurate model. If you use
166
- * `text-moderation-stable`, we will provide advanced notice before updating the
167
- * model. Accuracy of `text-moderation-stable` may be slightly lower than for
168
- * `text-moderation-latest`.
285
+ * The content moderation model you would like to use. Learn more in
286
+ * [the moderation guide](https://platform.openai.com/docs/guides/moderation), and
287
+ * learn about available models
288
+ * [here](https://platform.openai.com/docs/models/moderation).
169
289
  */
170
290
  model?: (string & {}) | ModerationModel;
171
291
  }
172
292
  export declare namespace Moderations {
173
293
  export import Moderation = ModerationsAPI.Moderation;
294
+ export import ModerationImageURLInput = ModerationsAPI.ModerationImageURLInput;
174
295
  export import ModerationModel = ModerationsAPI.ModerationModel;
296
+ export import ModerationMultiModalInput = ModerationsAPI.ModerationMultiModalInput;
297
+ export import ModerationTextInput = ModerationsAPI.ModerationTextInput;
175
298
  export import ModerationCreateResponse = ModerationsAPI.ModerationCreateResponse;
176
299
  export import ModerationCreateParams = ModerationsAPI.ModerationCreateParams;
177
300
  }
@@ -1 +1 @@
1
- {"version":3,"file":"moderations.d.ts","sourceRoot":"","sources":["../src/resources/moderations.ts"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c,CAAC,UAAU,CAAC;IACrD,MAAM,QAAQ,uBAAuB,GAAG,cAAc,CAAC,uBAAuB,CAAC;IAC/E,MAAM,QAAQ,eAAe,GAAG,cAAc,CAAC,eAAe,CAAC;IAC/D,MAAM,QAAQ,yBAAyB,GAAG,cAAc,CAAC,yBAAyB,CAAC;IACnF,MAAM,QAAQ,mBAAmB,GAAG,cAAc,CAAC,mBAAmB,CAAC;IACvE,MAAM,QAAQ,wBAAwB,GAAG,cAAc,CAAC,wBAAwB,CAAC;IACjF,MAAM,QAAQ,sBAAsB,GAAG,cAAc,CAAC,sBAAsB,CAAC;CAC9E"}
@@ -5,7 +5,8 @@ exports.Moderations = void 0;
5
5
  const resource_1 = require("../resource.js");
6
6
  class Moderations extends resource_1.APIResource {
7
7
  /**
8
- * Classifies if text is potentially harmful.
8
+ * Classifies if text and/or image inputs are potentially harmful. Learn more in
9
+ * the [moderation guide](https://platform.openai.com/docs/guides/moderation).
9
10
  */
10
11
  create(body, options) {
11
12
  return this._client.post('/moderations', { body, ...options });
@@ -1 +1 @@
1
- {"version":3,"file":"moderations.js","sourceRoot":"","sources":["../src/resources/moderations.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6CAA0C;AAI1C,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,IAA4B,EAC5B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;CACF;AAVD,kCAUC;AAmMD,WAAiB,WAAW;AAK5B,CAAC,EALgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAK3B"}
1
+ {"version":3,"file":"moderations.js","sourceRoot":"","sources":["../src/resources/moderations.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6CAA0C;AAI1C,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;;OAGG;IACH,MAAM,CACJ,IAA4B,EAC5B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;CACF;AAXD,kCAWC;AAsVD,WAAiB,WAAW;AAQ5B,CAAC,EARgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAQ3B"}
@@ -2,7 +2,8 @@
2
2
  import { APIResource } from "../resource.mjs";
3
3
  export class Moderations extends APIResource {
4
4
  /**
5
- * Classifies if text is potentially harmful.
5
+ * Classifies if text and/or image inputs are potentially harmful. Learn more in
6
+ * the [moderation guide](https://platform.openai.com/docs/guides/moderation).
6
7
  */
7
8
  create(body, options) {
8
9
  return this._client.post('/moderations', { body, ...options });
@@ -1 +1 @@
1
- {"version":3,"file":"moderations.mjs","sourceRoot":"","sources":["../src/resources/moderations.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,IAA4B,EAC5B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;CACF;AAmMD,WAAiB,WAAW;AAK5B,CAAC,EALgB,WAAW,KAAX,WAAW,QAK3B"}
1
+ {"version":3,"file":"moderations.mjs","sourceRoot":"","sources":["../src/resources/moderations.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;;OAGG;IACH,MAAM,CACJ,IAA4B,EAC5B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;CACF;AAsVD,WAAiB,WAAW;AAQ5B,CAAC,EARgB,WAAW,KAAX,WAAW,QAQ3B"}
package/src/core.ts CHANGED
@@ -383,7 +383,11 @@ export abstract class APIClient {
383
383
  delete reqHeaders['content-type'];
384
384
  }
385
385
 
386
- reqHeaders['x-stainless-retry-count'] = String(retryCount);
386
+ // Don't set the retry count header if it was already set or removed by the caller. We check `headers`,
387
+ // which can contain nulls, instead of `reqHeaders` to account for the removal case.
388
+ if (getHeader(headers, 'x-stainless-retry-count') === undefined) {
389
+ reqHeaders['x-stainless-retry-count'] = String(retryCount);
390
+ }
387
391
 
388
392
  this.validateHeaders(reqHeaders, headers);
389
393
 
@@ -1170,7 +1174,15 @@ export const isHeadersProtocol = (headers: any): headers is HeadersProtocol => {
1170
1174
  return typeof headers?.get === 'function';
1171
1175
  };
1172
1176
 
1173
- export const getRequiredHeader = (headers: HeadersLike, header: string): string => {
1177
+ export const getRequiredHeader = (headers: HeadersLike | Headers, header: string): string => {
1178
+ const foundHeader = getHeader(headers, header);
1179
+ if (foundHeader === undefined) {
1180
+ throw new Error(`Could not find ${header} header`);
1181
+ }
1182
+ return foundHeader;
1183
+ };
1184
+
1185
+ export const getHeader = (headers: HeadersLike | Headers, header: string): string | undefined => {
1174
1186
  const lowerCasedHeader = header.toLowerCase();
1175
1187
  if (isHeadersProtocol(headers)) {
1176
1188
  // to deal with the case where the header looks like Stainless-Event-Id
@@ -1196,7 +1208,7 @@ export const getRequiredHeader = (headers: HeadersLike, header: string): string
1196
1208
  }
1197
1209
  }
1198
1210
 
1199
- throw new Error(`Could not find ${header} header`);
1211
+ return undefined;
1200
1212
  };
1201
1213
 
1202
1214
  /**
package/src/index.ts CHANGED
@@ -298,10 +298,14 @@ export namespace OpenAI {
298
298
 
299
299
  export import Audio = API.Audio;
300
300
  export import AudioModel = API.AudioModel;
301
+ export import AudioResponseFormat = API.AudioResponseFormat;
301
302
 
302
303
  export import Moderations = API.Moderations;
303
304
  export import Moderation = API.Moderation;
305
+ export import ModerationImageURLInput = API.ModerationImageURLInput;
304
306
  export import ModerationModel = API.ModerationModel;
307
+ export import ModerationMultiModalInput = API.ModerationMultiModalInput;
308
+ export import ModerationTextInput = API.ModerationTextInput;
305
309
  export import ModerationCreateResponse = API.ModerationCreateResponse;
306
310
  export import ModerationCreateParams = API.ModerationCreateParams;
307
311
 
@@ -14,8 +14,15 @@ export class Audio extends APIResource {
14
14
 
15
15
  export type AudioModel = 'whisper-1';
16
16
 
17
+ /**
18
+ * The format of the output, in one of these options: `json`, `text`, `srt`,
19
+ * `verbose_json`, or `vtt`.
20
+ */
21
+ export type AudioResponseFormat = 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt';
22
+
17
23
  export namespace Audio {
18
24
  export import AudioModel = AudioAPI.AudioModel;
25
+ export import AudioResponseFormat = AudioAPI.AudioResponseFormat;
19
26
  export import Transcriptions = TranscriptionsAPI.Transcriptions;
20
27
  export import Transcription = TranscriptionsAPI.Transcription;
21
28
  export import TranscriptionCreateParams = TranscriptionsAPI.TranscriptionCreateParams;
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export { AudioModel, Audio } from './audio';
3
+ export { AudioModel, AudioResponseFormat, Audio } from './audio';
4
4
  export { SpeechModel, SpeechCreateParams, Speech } from './speech';
5
5
  export { Transcription, TranscriptionCreateParams, Transcriptions } from './transcriptions';
6
6
  export { Translation, TranslationCreateParams, Translations } from './translations';
@@ -54,10 +54,10 @@ export interface TranscriptionCreateParams {
54
54
  prompt?: string;
55
55
 
56
56
  /**
57
- * The format of the transcript output, in one of these options: `json`, `text`,
58
- * `srt`, `verbose_json`, or `vtt`.
57
+ * The format of the output, in one of these options: `json`, `text`, `srt`,
58
+ * `verbose_json`, or `vtt`.
59
59
  */
60
- response_format?: 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt';
60
+ response_format?: AudioAPI.AudioResponseFormat;
61
61
 
62
62
  /**
63
63
  * The sampling temperature, between 0 and 1. Higher values like 0.8 will make the
@@ -40,10 +40,10 @@ export interface TranslationCreateParams {
40
40
  prompt?: string;
41
41
 
42
42
  /**
43
- * The format of the transcript output, in one of these options: `json`, `text`,
44
- * `srt`, `verbose_json`, or `vtt`.
43
+ * The format of the output, in one of these options: `json`, `text`, `srt`,
44
+ * `verbose_json`, or `vtt`.
45
45
  */
46
- response_format?: string;
46
+ response_format?: AudioAPI.AudioResponseFormat;
47
47
 
48
48
  /**
49
49
  * The sampling temperature, between 0 and 1. Higher values like 0.8 will make the
@@ -2,7 +2,7 @@
2
2
 
3
3
  export * from './chat/index';
4
4
  export * from './shared';
5
- export { AudioModel, Audio } from './audio/audio';
5
+ export { AudioModel, AudioResponseFormat, Audio } from './audio/audio';
6
6
  export {
7
7
  Batch,
8
8
  BatchError,
@@ -52,7 +52,10 @@ export {
52
52
  export { Model, ModelDeleted, ModelsPage, Models } from './models';
53
53
  export {
54
54
  Moderation,
55
+ ModerationImageURLInput,
55
56
  ModerationModel,
57
+ ModerationMultiModalInput,
58
+ ModerationTextInput,
56
59
  ModerationCreateResponse,
57
60
  ModerationCreateParams,
58
61
  Moderations,