openai 3.0.0 → 3.1.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.
package/dist/api.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * OpenAI API
6
6
  * APIs for sampling from and fine-tuning language models
7
7
  *
8
- * The version of the OpenAPI document: 1.0.5
8
+ * The version of the OpenAPI document: 1.1.0
9
9
  *
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -22,13 +22,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  });
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.OpenAIApi = exports.OpenAIApiFactory = exports.OpenAIApiFp = exports.OpenAIApiAxiosParamCreator = void 0;
25
+ exports.OpenAIApi = exports.OpenAIApiFactory = exports.OpenAIApiFp = exports.OpenAIApiAxiosParamCreator = exports.CreateImageRequestResponseFormatEnum = exports.CreateImageRequestSizeEnum = void 0;
26
26
  const axios_1 = require("axios");
27
27
  // Some imports not used depending on template conditions
28
28
  // @ts-ignore
29
29
  const common_1 = require("./common");
30
30
  // @ts-ignore
31
31
  const base_1 = require("./base");
32
+ exports.CreateImageRequestSizeEnum = {
33
+ _256x256: '256x256',
34
+ _512x512: '512x512',
35
+ _1024x1024: '1024x1024'
36
+ };
37
+ exports.CreateImageRequestResponseFormatEnum = {
38
+ Url: 'url',
39
+ B64Json: 'b64_json'
40
+ };
32
41
  /**
33
42
  * OpenAIApi - axios parameter creator
34
43
  * @export
@@ -219,7 +228,7 @@ exports.OpenAIApiAxiosParamCreator = function (configuration) {
219
228
  /**
220
229
  *
221
230
  * @summary Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.
222
- * @param {any} file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. If the `purpose` is set to \\\"fine-tune\\\", each line is a JSON record with \\\"prompt\\\" and \\\"completion\\\" fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data).
231
+ * @param {File} file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. If the `purpose` is set to \\\"fine-tune\\\", each line is a JSON record with \\\"prompt\\\" and \\\"completion\\\" fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data).
223
232
  * @param {string} purpose The intended purpose of the uploaded documents. Use \\\"fine-tune\\\" for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file.
224
233
  * @param {*} [options] Override http request option.
225
234
  * @throws {RequiredError}
@@ -286,6 +295,178 @@ exports.OpenAIApiAxiosParamCreator = function (configuration) {
286
295
  options: localVarRequestOptions,
287
296
  };
288
297
  }),
298
+ /**
299
+ *
300
+ * @summary Creates an image given a prompt.
301
+ * @param {CreateImageRequest} createImageRequest
302
+ * @param {*} [options] Override http request option.
303
+ * @throws {RequiredError}
304
+ */
305
+ createImage: (createImageRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
306
+ // verify required parameter 'createImageRequest' is not null or undefined
307
+ common_1.assertParamExists('createImage', 'createImageRequest', createImageRequest);
308
+ const localVarPath = `/images/generations`;
309
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
310
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
311
+ let baseOptions;
312
+ if (configuration) {
313
+ baseOptions = configuration.baseOptions;
314
+ }
315
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
316
+ const localVarHeaderParameter = {};
317
+ const localVarQueryParameter = {};
318
+ localVarHeaderParameter['Content-Type'] = 'application/json';
319
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
320
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
321
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
322
+ localVarRequestOptions.data = common_1.serializeDataIfNeeded(createImageRequest, localVarRequestOptions, configuration);
323
+ return {
324
+ url: common_1.toPathString(localVarUrlObj),
325
+ options: localVarRequestOptions,
326
+ };
327
+ }),
328
+ /**
329
+ *
330
+ * @summary Creates an edited or extended image given an original image and a prompt.
331
+ * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square.
332
+ * @param {File} mask An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.
333
+ * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters.
334
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
335
+ * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
336
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`.
337
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
338
+ * @param {*} [options] Override http request option.
339
+ * @throws {RequiredError}
340
+ */
341
+ createImageEdit: (image, mask, prompt, n, size, responseFormat, user, options = {}) => __awaiter(this, void 0, void 0, function* () {
342
+ // verify required parameter 'image' is not null or undefined
343
+ common_1.assertParamExists('createImageEdit', 'image', image);
344
+ // verify required parameter 'mask' is not null or undefined
345
+ common_1.assertParamExists('createImageEdit', 'mask', mask);
346
+ // verify required parameter 'prompt' is not null or undefined
347
+ common_1.assertParamExists('createImageEdit', 'prompt', prompt);
348
+ const localVarPath = `/images/edits`;
349
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
350
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
351
+ let baseOptions;
352
+ if (configuration) {
353
+ baseOptions = configuration.baseOptions;
354
+ }
355
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
356
+ const localVarHeaderParameter = {};
357
+ const localVarQueryParameter = {};
358
+ const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
359
+ if (image !== undefined) {
360
+ localVarFormParams.append('image', image);
361
+ }
362
+ if (mask !== undefined) {
363
+ localVarFormParams.append('mask', mask);
364
+ }
365
+ if (prompt !== undefined) {
366
+ localVarFormParams.append('prompt', prompt);
367
+ }
368
+ if (n !== undefined) {
369
+ localVarFormParams.append('n', n);
370
+ }
371
+ if (size !== undefined) {
372
+ localVarFormParams.append('size', size);
373
+ }
374
+ if (responseFormat !== undefined) {
375
+ localVarFormParams.append('response_format', responseFormat);
376
+ }
377
+ if (user !== undefined) {
378
+ localVarFormParams.append('user', user);
379
+ }
380
+ localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
381
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
382
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
383
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), localVarFormParams.getHeaders()), headersFromBaseOptions), options.headers);
384
+ localVarRequestOptions.data = localVarFormParams;
385
+ return {
386
+ url: common_1.toPathString(localVarUrlObj),
387
+ options: localVarRequestOptions,
388
+ };
389
+ }),
390
+ /**
391
+ *
392
+ * @summary Creates a variation of a given image.
393
+ * @param {File} image The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.
394
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
395
+ * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
396
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`.
397
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
398
+ * @param {*} [options] Override http request option.
399
+ * @throws {RequiredError}
400
+ */
401
+ createImageVariation: (image, n, size, responseFormat, user, options = {}) => __awaiter(this, void 0, void 0, function* () {
402
+ // verify required parameter 'image' is not null or undefined
403
+ common_1.assertParamExists('createImageVariation', 'image', image);
404
+ const localVarPath = `/images/variations`;
405
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
406
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
407
+ let baseOptions;
408
+ if (configuration) {
409
+ baseOptions = configuration.baseOptions;
410
+ }
411
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
412
+ const localVarHeaderParameter = {};
413
+ const localVarQueryParameter = {};
414
+ const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
415
+ if (image !== undefined) {
416
+ localVarFormParams.append('image', image);
417
+ }
418
+ if (n !== undefined) {
419
+ localVarFormParams.append('n', n);
420
+ }
421
+ if (size !== undefined) {
422
+ localVarFormParams.append('size', size);
423
+ }
424
+ if (responseFormat !== undefined) {
425
+ localVarFormParams.append('response_format', responseFormat);
426
+ }
427
+ if (user !== undefined) {
428
+ localVarFormParams.append('user', user);
429
+ }
430
+ localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
431
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
432
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
433
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), localVarFormParams.getHeaders()), headersFromBaseOptions), options.headers);
434
+ localVarRequestOptions.data = localVarFormParams;
435
+ return {
436
+ url: common_1.toPathString(localVarUrlObj),
437
+ options: localVarRequestOptions,
438
+ };
439
+ }),
440
+ /**
441
+ *
442
+ * @summary Classifies if text violates OpenAI\'s Content Policy
443
+ * @param {CreateModerationRequest} createModerationRequest
444
+ * @param {*} [options] Override http request option.
445
+ * @throws {RequiredError}
446
+ */
447
+ createModeration: (createModerationRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
448
+ // verify required parameter 'createModerationRequest' is not null or undefined
449
+ common_1.assertParamExists('createModeration', 'createModerationRequest', createModerationRequest);
450
+ const localVarPath = `/moderations`;
451
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
452
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
453
+ let baseOptions;
454
+ if (configuration) {
455
+ baseOptions = configuration.baseOptions;
456
+ }
457
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
458
+ const localVarHeaderParameter = {};
459
+ const localVarQueryParameter = {};
460
+ localVarHeaderParameter['Content-Type'] = 'application/json';
461
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
462
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
463
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
464
+ localVarRequestOptions.data = common_1.serializeDataIfNeeded(createModerationRequest, localVarRequestOptions, configuration);
465
+ return {
466
+ url: common_1.toPathString(localVarUrlObj),
467
+ options: localVarRequestOptions,
468
+ };
469
+ }),
289
470
  /**
290
471
  *
291
472
  * @summary The search endpoint computes similarity scores between provided query and documents. Documents can be passed directly to the API if there are no more than 200 of them. To go beyond the 200 document limit, documents can be processed offline and then used for efficient retrieval at query time. When `file` is set, the search endpoint searches over all the documents in the given file and returns up to the `max_rerank` number of documents. These documents will be returned along with their search scores. The similarity score is a positive score that usually ranges from 0 to 300 (but can sometimes go higher), where a score above 200 usually means the document is semantically similar to the query.
@@ -751,7 +932,7 @@ exports.OpenAIApiFp = function (configuration) {
751
932
  /**
752
933
  *
753
934
  * @summary Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.
754
- * @param {any} file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. If the `purpose` is set to \\\"fine-tune\\\", each line is a JSON record with \\\"prompt\\\" and \\\"completion\\\" fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data).
935
+ * @param {File} file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. If the `purpose` is set to \\\"fine-tune\\\", each line is a JSON record with \\\"prompt\\\" and \\\"completion\\\" fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data).
755
936
  * @param {string} purpose The intended purpose of the uploaded documents. Use \\\"fine-tune\\\" for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file.
756
937
  * @param {*} [options] Override http request option.
757
938
  * @throws {RequiredError}
@@ -775,6 +956,68 @@ exports.OpenAIApiFp = function (configuration) {
775
956
  return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
776
957
  });
777
958
  },
959
+ /**
960
+ *
961
+ * @summary Creates an image given a prompt.
962
+ * @param {CreateImageRequest} createImageRequest
963
+ * @param {*} [options] Override http request option.
964
+ * @throws {RequiredError}
965
+ */
966
+ createImage(createImageRequest, options) {
967
+ return __awaiter(this, void 0, void 0, function* () {
968
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createImage(createImageRequest, options);
969
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
970
+ });
971
+ },
972
+ /**
973
+ *
974
+ * @summary Creates an edited or extended image given an original image and a prompt.
975
+ * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square.
976
+ * @param {File} mask An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.
977
+ * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters.
978
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
979
+ * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
980
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`.
981
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
982
+ * @param {*} [options] Override http request option.
983
+ * @throws {RequiredError}
984
+ */
985
+ createImageEdit(image, mask, prompt, n, size, responseFormat, user, options) {
986
+ return __awaiter(this, void 0, void 0, function* () {
987
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createImageEdit(image, mask, prompt, n, size, responseFormat, user, options);
988
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
989
+ });
990
+ },
991
+ /**
992
+ *
993
+ * @summary Creates a variation of a given image.
994
+ * @param {File} image The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.
995
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
996
+ * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
997
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`.
998
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
999
+ * @param {*} [options] Override http request option.
1000
+ * @throws {RequiredError}
1001
+ */
1002
+ createImageVariation(image, n, size, responseFormat, user, options) {
1003
+ return __awaiter(this, void 0, void 0, function* () {
1004
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createImageVariation(image, n, size, responseFormat, user, options);
1005
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
1006
+ });
1007
+ },
1008
+ /**
1009
+ *
1010
+ * @summary Classifies if text violates OpenAI\'s Content Policy
1011
+ * @param {CreateModerationRequest} createModerationRequest
1012
+ * @param {*} [options] Override http request option.
1013
+ * @throws {RequiredError}
1014
+ */
1015
+ createModeration(createModerationRequest, options) {
1016
+ return __awaiter(this, void 0, void 0, function* () {
1017
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createModeration(createModerationRequest, options);
1018
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
1019
+ });
1020
+ },
778
1021
  /**
779
1022
  *
780
1023
  * @summary The search endpoint computes similarity scores between provided query and documents. Documents can be passed directly to the API if there are no more than 200 of them. To go beyond the 200 document limit, documents can be processed offline and then used for efficient retrieval at query time. When `file` is set, the search endpoint searches over all the documents in the given file and returns up to the `max_rerank` number of documents. These documents will be returned along with their search scores. The similarity score is a positive score that usually ranges from 0 to 300 (but can sometimes go higher), where a score above 200 usually means the document is semantically similar to the query.
@@ -1019,7 +1262,7 @@ exports.OpenAIApiFactory = function (configuration, basePath, axios) {
1019
1262
  /**
1020
1263
  *
1021
1264
  * @summary Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.
1022
- * @param {any} file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. If the `purpose` is set to \\\"fine-tune\\\", each line is a JSON record with \\\"prompt\\\" and \\\"completion\\\" fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data).
1265
+ * @param {File} file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. If the `purpose` is set to \\\"fine-tune\\\", each line is a JSON record with \\\"prompt\\\" and \\\"completion\\\" fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data).
1023
1266
  * @param {string} purpose The intended purpose of the uploaded documents. Use \\\"fine-tune\\\" for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file.
1024
1267
  * @param {*} [options] Override http request option.
1025
1268
  * @throws {RequiredError}
@@ -1037,6 +1280,56 @@ exports.OpenAIApiFactory = function (configuration, basePath, axios) {
1037
1280
  createFineTune(createFineTuneRequest, options) {
1038
1281
  return localVarFp.createFineTune(createFineTuneRequest, options).then((request) => request(axios, basePath));
1039
1282
  },
1283
+ /**
1284
+ *
1285
+ * @summary Creates an image given a prompt.
1286
+ * @param {CreateImageRequest} createImageRequest
1287
+ * @param {*} [options] Override http request option.
1288
+ * @throws {RequiredError}
1289
+ */
1290
+ createImage(createImageRequest, options) {
1291
+ return localVarFp.createImage(createImageRequest, options).then((request) => request(axios, basePath));
1292
+ },
1293
+ /**
1294
+ *
1295
+ * @summary Creates an edited or extended image given an original image and a prompt.
1296
+ * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square.
1297
+ * @param {File} mask An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.
1298
+ * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters.
1299
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
1300
+ * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
1301
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`.
1302
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
1303
+ * @param {*} [options] Override http request option.
1304
+ * @throws {RequiredError}
1305
+ */
1306
+ createImageEdit(image, mask, prompt, n, size, responseFormat, user, options) {
1307
+ return localVarFp.createImageEdit(image, mask, prompt, n, size, responseFormat, user, options).then((request) => request(axios, basePath));
1308
+ },
1309
+ /**
1310
+ *
1311
+ * @summary Creates a variation of a given image.
1312
+ * @param {File} image The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.
1313
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
1314
+ * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
1315
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`.
1316
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
1317
+ * @param {*} [options] Override http request option.
1318
+ * @throws {RequiredError}
1319
+ */
1320
+ createImageVariation(image, n, size, responseFormat, user, options) {
1321
+ return localVarFp.createImageVariation(image, n, size, responseFormat, user, options).then((request) => request(axios, basePath));
1322
+ },
1323
+ /**
1324
+ *
1325
+ * @summary Classifies if text violates OpenAI\'s Content Policy
1326
+ * @param {CreateModerationRequest} createModerationRequest
1327
+ * @param {*} [options] Override http request option.
1328
+ * @throws {RequiredError}
1329
+ */
1330
+ createModeration(createModerationRequest, options) {
1331
+ return localVarFp.createModeration(createModerationRequest, options).then((request) => request(axios, basePath));
1332
+ },
1040
1333
  /**
1041
1334
  *
1042
1335
  * @summary The search endpoint computes similarity scores between provided query and documents. Documents can be passed directly to the API if there are no more than 200 of them. To go beyond the 200 document limit, documents can be processed offline and then used for efficient retrieval at query time. When `file` is set, the search endpoint searches over all the documents in the given file and returns up to the `max_rerank` number of documents. These documents will be returned along with their search scores. The similarity score is a positive score that usually ranges from 0 to 300 (but can sometimes go higher), where a score above 200 usually means the document is semantically similar to the query.
@@ -1248,7 +1541,7 @@ class OpenAIApi extends base_1.BaseAPI {
1248
1541
  /**
1249
1542
  *
1250
1543
  * @summary Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.
1251
- * @param {any} file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. If the `purpose` is set to \\\"fine-tune\\\", each line is a JSON record with \\\"prompt\\\" and \\\"completion\\\" fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data).
1544
+ * @param {File} file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. If the `purpose` is set to \\\"fine-tune\\\", each line is a JSON record with \\\"prompt\\\" and \\\"completion\\\" fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data).
1252
1545
  * @param {string} purpose The intended purpose of the uploaded documents. Use \\\"fine-tune\\\" for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file.
1253
1546
  * @param {*} [options] Override http request option.
1254
1547
  * @throws {RequiredError}
@@ -1268,6 +1561,60 @@ class OpenAIApi extends base_1.BaseAPI {
1268
1561
  createFineTune(createFineTuneRequest, options) {
1269
1562
  return exports.OpenAIApiFp(this.configuration).createFineTune(createFineTuneRequest, options).then((request) => request(this.axios, this.basePath));
1270
1563
  }
1564
+ /**
1565
+ *
1566
+ * @summary Creates an image given a prompt.
1567
+ * @param {CreateImageRequest} createImageRequest
1568
+ * @param {*} [options] Override http request option.
1569
+ * @throws {RequiredError}
1570
+ * @memberof OpenAIApi
1571
+ */
1572
+ createImage(createImageRequest, options) {
1573
+ return exports.OpenAIApiFp(this.configuration).createImage(createImageRequest, options).then((request) => request(this.axios, this.basePath));
1574
+ }
1575
+ /**
1576
+ *
1577
+ * @summary Creates an edited or extended image given an original image and a prompt.
1578
+ * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square.
1579
+ * @param {File} mask An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.
1580
+ * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters.
1581
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
1582
+ * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
1583
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`.
1584
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
1585
+ * @param {*} [options] Override http request option.
1586
+ * @throws {RequiredError}
1587
+ * @memberof OpenAIApi
1588
+ */
1589
+ createImageEdit(image, mask, prompt, n, size, responseFormat, user, options) {
1590
+ return exports.OpenAIApiFp(this.configuration).createImageEdit(image, mask, prompt, n, size, responseFormat, user, options).then((request) => request(this.axios, this.basePath));
1591
+ }
1592
+ /**
1593
+ *
1594
+ * @summary Creates a variation of a given image.
1595
+ * @param {File} image The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.
1596
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
1597
+ * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
1598
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`.
1599
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
1600
+ * @param {*} [options] Override http request option.
1601
+ * @throws {RequiredError}
1602
+ * @memberof OpenAIApi
1603
+ */
1604
+ createImageVariation(image, n, size, responseFormat, user, options) {
1605
+ return exports.OpenAIApiFp(this.configuration).createImageVariation(image, n, size, responseFormat, user, options).then((request) => request(this.axios, this.basePath));
1606
+ }
1607
+ /**
1608
+ *
1609
+ * @summary Classifies if text violates OpenAI\'s Content Policy
1610
+ * @param {CreateModerationRequest} createModerationRequest
1611
+ * @param {*} [options] Override http request option.
1612
+ * @throws {RequiredError}
1613
+ * @memberof OpenAIApi
1614
+ */
1615
+ createModeration(createModerationRequest, options) {
1616
+ return exports.OpenAIApiFp(this.configuration).createModeration(createModerationRequest, options).then((request) => request(this.axios, this.basePath));
1617
+ }
1271
1618
  /**
1272
1619
  *
1273
1620
  * @summary The search endpoint computes similarity scores between provided query and documents. Documents can be passed directly to the API if there are no more than 200 of them. To go beyond the 200 document limit, documents can be processed offline and then used for efficient retrieval at query time. When `file` is set, the search endpoint searches over all the documents in the given file and returns up to the `max_rerank` number of documents. These documents will be returned along with their search scores. The similarity score is a positive score that usually ranges from 0 to 300 (but can sometimes go higher), where a score above 200 usually means the document is semantically similar to the query.
package/dist/base.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * OpenAI API
3
3
  * APIs for sampling from and fine-tuning language models
4
4
  *
5
- * The version of the OpenAPI document: 1.0.5
5
+ * The version of the OpenAPI document: 1.1.0
6
6
  *
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
package/dist/base.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * OpenAI API
6
6
  * APIs for sampling from and fine-tuning language models
7
7
  *
8
- * The version of the OpenAPI document: 1.0.5
8
+ * The version of the OpenAPI document: 1.1.0
9
9
  *
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
package/dist/common.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * OpenAI API
3
3
  * APIs for sampling from and fine-tuning language models
4
4
  *
5
- * The version of the OpenAPI document: 1.0.5
5
+ * The version of the OpenAPI document: 1.1.0
6
6
  *
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
package/dist/common.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * OpenAI API
6
6
  * APIs for sampling from and fine-tuning language models
7
7
  *
8
- * The version of the OpenAPI document: 1.0.5
8
+ * The version of the OpenAPI document: 1.1.0
9
9
  *
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -90,25 +90,31 @@ exports.setOAuthToObject = function (object, name, scopes, configuration) {
90
90
  }
91
91
  });
92
92
  };
93
+ function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
94
+ if (typeof parameter === "object") {
95
+ if (Array.isArray(parameter)) {
96
+ parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
97
+ }
98
+ else {
99
+ Object.keys(parameter).forEach(currentKey => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`));
100
+ }
101
+ }
102
+ else {
103
+ if (urlSearchParams.has(key)) {
104
+ urlSearchParams.append(key, parameter);
105
+ }
106
+ else {
107
+ urlSearchParams.set(key, parameter);
108
+ }
109
+ }
110
+ }
93
111
  /**
94
112
  *
95
113
  * @export
96
114
  */
97
115
  exports.setSearchParams = function (url, ...objects) {
98
116
  const searchParams = new URLSearchParams(url.search);
99
- for (const object of objects) {
100
- for (const key in object) {
101
- if (Array.isArray(object[key])) {
102
- searchParams.delete(key);
103
- for (const item of object[key]) {
104
- searchParams.append(key, item);
105
- }
106
- }
107
- else {
108
- searchParams.set(key, object[key]);
109
- }
110
- }
111
- }
117
+ setFlattenedQueryParams(searchParams, objects);
112
118
  url.search = searchParams.toString();
113
119
  };
114
120
  /**
@@ -2,7 +2,7 @@
2
2
  * OpenAI API
3
3
  * APIs for sampling from and fine-tuning language models
4
4
  *
5
- * The version of the OpenAPI document: 1.0.5
5
+ * The version of the OpenAPI document: 1.1.0
6
6
  *
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -5,7 +5,7 @@
5
5
  * OpenAI API
6
6
  * APIs for sampling from and fine-tuning language models
7
7
  *
8
- * The version of the OpenAPI document: 1.0.5
8
+ * The version of the OpenAPI document: 1.1.0
9
9
  *
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * OpenAI API
3
3
  * APIs for sampling from and fine-tuning language models
4
4
  *
5
- * The version of the OpenAPI document: 1.0.5
5
+ * The version of the OpenAPI document: 1.1.0
6
6
  *
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * OpenAI API
6
6
  * APIs for sampling from and fine-tuning language models
7
7
  *
8
- * The version of the OpenAPI document: 1.0.5
8
+ * The version of the OpenAPI document: 1.1.0
9
9
  *
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
package/index.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * OpenAI API
5
5
  * APIs for sampling from and fine-tuning language models
6
6
  *
7
- * The version of the OpenAPI document: 1.0.5
7
+ * The version of the OpenAPI document: 1.1.0
8
8
  *
9
9
  *
10
10
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "openai",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Node.js library for the OpenAI API",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git@github.com:openai/openai-node.git"
8
+ },
5
9
  "keywords": [
6
10
  "openai",
7
11
  "open",
@@ -9,10 +13,6 @@
9
13
  "gpt-3",
10
14
  "gpt3"
11
15
  ],
12
- "repository": {
13
- "type": "git",
14
- "url": "git@github.com:openai/openai-node.git"
15
- },
16
16
  "author": "OpenAI",
17
17
  "license": "MIT",
18
18
  "main": "./dist/index.js",