openai 3.0.0 → 3.0.1

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.0.6
9
9
  *
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -219,7 +219,7 @@ exports.OpenAIApiAxiosParamCreator = function (configuration) {
219
219
  /**
220
220
  *
221
221
  * @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).
222
+ * @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
223
  * @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
224
  * @param {*} [options] Override http request option.
225
225
  * @throws {RequiredError}
@@ -286,6 +286,36 @@ exports.OpenAIApiAxiosParamCreator = function (configuration) {
286
286
  options: localVarRequestOptions,
287
287
  };
288
288
  }),
289
+ /**
290
+ *
291
+ * @summary Classifies if text violates OpenAI\'s Content Policy
292
+ * @param {CreateModerationRequest} createModerationRequest
293
+ * @param {*} [options] Override http request option.
294
+ * @throws {RequiredError}
295
+ */
296
+ createModeration: (createModerationRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
297
+ // verify required parameter 'createModerationRequest' is not null or undefined
298
+ common_1.assertParamExists('createModeration', 'createModerationRequest', createModerationRequest);
299
+ const localVarPath = `/moderations`;
300
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
301
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
302
+ let baseOptions;
303
+ if (configuration) {
304
+ baseOptions = configuration.baseOptions;
305
+ }
306
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
307
+ const localVarHeaderParameter = {};
308
+ const localVarQueryParameter = {};
309
+ localVarHeaderParameter['Content-Type'] = 'application/json';
310
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
311
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
312
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
313
+ localVarRequestOptions.data = common_1.serializeDataIfNeeded(createModerationRequest, localVarRequestOptions, configuration);
314
+ return {
315
+ url: common_1.toPathString(localVarUrlObj),
316
+ options: localVarRequestOptions,
317
+ };
318
+ }),
289
319
  /**
290
320
  *
291
321
  * @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 +781,7 @@ exports.OpenAIApiFp = function (configuration) {
751
781
  /**
752
782
  *
753
783
  * @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).
784
+ * @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
785
  * @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
786
  * @param {*} [options] Override http request option.
757
787
  * @throws {RequiredError}
@@ -775,6 +805,19 @@ exports.OpenAIApiFp = function (configuration) {
775
805
  return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
776
806
  });
777
807
  },
808
+ /**
809
+ *
810
+ * @summary Classifies if text violates OpenAI\'s Content Policy
811
+ * @param {CreateModerationRequest} createModerationRequest
812
+ * @param {*} [options] Override http request option.
813
+ * @throws {RequiredError}
814
+ */
815
+ createModeration(createModerationRequest, options) {
816
+ return __awaiter(this, void 0, void 0, function* () {
817
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createModeration(createModerationRequest, options);
818
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
819
+ });
820
+ },
778
821
  /**
779
822
  *
780
823
  * @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 +1062,7 @@ exports.OpenAIApiFactory = function (configuration, basePath, axios) {
1019
1062
  /**
1020
1063
  *
1021
1064
  * @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).
1065
+ * @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
1066
  * @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
1067
  * @param {*} [options] Override http request option.
1025
1068
  * @throws {RequiredError}
@@ -1037,6 +1080,16 @@ exports.OpenAIApiFactory = function (configuration, basePath, axios) {
1037
1080
  createFineTune(createFineTuneRequest, options) {
1038
1081
  return localVarFp.createFineTune(createFineTuneRequest, options).then((request) => request(axios, basePath));
1039
1082
  },
1083
+ /**
1084
+ *
1085
+ * @summary Classifies if text violates OpenAI\'s Content Policy
1086
+ * @param {CreateModerationRequest} createModerationRequest
1087
+ * @param {*} [options] Override http request option.
1088
+ * @throws {RequiredError}
1089
+ */
1090
+ createModeration(createModerationRequest, options) {
1091
+ return localVarFp.createModeration(createModerationRequest, options).then((request) => request(axios, basePath));
1092
+ },
1040
1093
  /**
1041
1094
  *
1042
1095
  * @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 +1301,7 @@ class OpenAIApi extends base_1.BaseAPI {
1248
1301
  /**
1249
1302
  *
1250
1303
  * @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).
1304
+ * @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
1305
  * @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
1306
  * @param {*} [options] Override http request option.
1254
1307
  * @throws {RequiredError}
@@ -1268,6 +1321,17 @@ class OpenAIApi extends base_1.BaseAPI {
1268
1321
  createFineTune(createFineTuneRequest, options) {
1269
1322
  return exports.OpenAIApiFp(this.configuration).createFineTune(createFineTuneRequest, options).then((request) => request(this.axios, this.basePath));
1270
1323
  }
1324
+ /**
1325
+ *
1326
+ * @summary Classifies if text violates OpenAI\'s Content Policy
1327
+ * @param {CreateModerationRequest} createModerationRequest
1328
+ * @param {*} [options] Override http request option.
1329
+ * @throws {RequiredError}
1330
+ * @memberof OpenAIApi
1331
+ */
1332
+ createModeration(createModerationRequest, options) {
1333
+ return exports.OpenAIApiFp(this.configuration).createModeration(createModerationRequest, options).then((request) => request(this.axios, this.basePath));
1334
+ }
1271
1335
  /**
1272
1336
  *
1273
1337
  * @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.0.6
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.0.6
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.0.6
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.0.6
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.0.6
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.0.6
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.0.6
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.0.6
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.0.6
8
8
  *
9
9
  *
10
10
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openai",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Node.js library for the OpenAI API",
5
5
  "keywords": [
6
6
  "openai",