openai 2.0.1 → 2.0.5

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.0
8
+ * The version of the OpenAPI document: 1.0.4
9
9
  *
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -158,6 +158,70 @@ exports.OpenAIApiAxiosParamCreator = function (configuration) {
158
158
  options: localVarRequestOptions,
159
159
  };
160
160
  }),
161
+ /**
162
+ *
163
+ * @summary Creates a completion using a fine-tuned model
164
+ * @param {CreateCompletionFromModelRequest} createCompletionFromModelRequest
165
+ * @param {*} [options] Override http request option.
166
+ * @throws {RequiredError}
167
+ */
168
+ createCompletionFromModel: (createCompletionFromModelRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
169
+ // verify required parameter 'createCompletionFromModelRequest' is not null or undefined
170
+ common_1.assertParamExists('createCompletionFromModel', 'createCompletionFromModelRequest', createCompletionFromModelRequest);
171
+ const localVarPath = `/completions`;
172
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
173
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
174
+ let baseOptions;
175
+ if (configuration) {
176
+ baseOptions = configuration.baseOptions;
177
+ }
178
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
179
+ const localVarHeaderParameter = {};
180
+ const localVarQueryParameter = {};
181
+ localVarHeaderParameter['Content-Type'] = 'application/json';
182
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
183
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
184
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
185
+ localVarRequestOptions.data = common_1.serializeDataIfNeeded(createCompletionFromModelRequest, localVarRequestOptions, configuration);
186
+ return {
187
+ url: common_1.toPathString(localVarUrlObj),
188
+ options: localVarRequestOptions,
189
+ };
190
+ }),
191
+ /**
192
+ *
193
+ * @summary Creates a new edit for the provided input, instruction, and parameters
194
+ * @param {string} engineId The ID of the engine to use for this request
195
+ * @param {CreateEditRequest} createEditRequest
196
+ * @param {*} [options] Override http request option.
197
+ * @throws {RequiredError}
198
+ */
199
+ createEdit: (engineId, createEditRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
200
+ // verify required parameter 'engineId' is not null or undefined
201
+ common_1.assertParamExists('createEdit', 'engineId', engineId);
202
+ // verify required parameter 'createEditRequest' is not null or undefined
203
+ common_1.assertParamExists('createEdit', 'createEditRequest', createEditRequest);
204
+ const localVarPath = `/engines/{engine_id}/edits`
205
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
206
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
207
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
208
+ let baseOptions;
209
+ if (configuration) {
210
+ baseOptions = configuration.baseOptions;
211
+ }
212
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
213
+ const localVarHeaderParameter = {};
214
+ const localVarQueryParameter = {};
215
+ localVarHeaderParameter['Content-Type'] = 'application/json';
216
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
217
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
218
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
219
+ localVarRequestOptions.data = common_1.serializeDataIfNeeded(createEditRequest, localVarRequestOptions, configuration);
220
+ return {
221
+ url: common_1.toPathString(localVarUrlObj),
222
+ options: localVarRequestOptions,
223
+ };
224
+ }),
161
225
  /**
162
226
  *
163
227
  * @summary Creates an embedding vector representing the input text.
@@ -265,7 +329,7 @@ exports.OpenAIApiAxiosParamCreator = function (configuration) {
265
329
  /**
266
330
  *
267
331
  * @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.
268
- * @param {string} engineId The ID of the engine to use for this request
332
+ * @param {string} engineId The ID of the engine to use for this request. You can select one of `ada`, `babbage`, `curie`, or `davinci`.
269
333
  * @param {CreateSearchRequest} createSearchRequest
270
334
  * @param {*} [options] Override http request option.
271
335
  * @throws {RequiredError}
@@ -325,6 +389,35 @@ exports.OpenAIApiAxiosParamCreator = function (configuration) {
325
389
  options: localVarRequestOptions,
326
390
  };
327
391
  }),
392
+ /**
393
+ *
394
+ * @summary Delete a fine-tuned model. You must have the Owner role in your organization.
395
+ * @param {string} model The model to delete
396
+ * @param {*} [options] Override http request option.
397
+ * @throws {RequiredError}
398
+ */
399
+ deleteModel: (model, options = {}) => __awaiter(this, void 0, void 0, function* () {
400
+ // verify required parameter 'model' is not null or undefined
401
+ common_1.assertParamExists('deleteModel', 'model', model);
402
+ const localVarPath = `/models/{model}`
403
+ .replace(`{${"model"}}`, encodeURIComponent(String(model)));
404
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
405
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
406
+ let baseOptions;
407
+ if (configuration) {
408
+ baseOptions = configuration.baseOptions;
409
+ }
410
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'DELETE' }, baseOptions), options);
411
+ const localVarHeaderParameter = {};
412
+ const localVarQueryParameter = {};
413
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
414
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
415
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
416
+ return {
417
+ url: common_1.toPathString(localVarUrlObj),
418
+ options: localVarRequestOptions,
419
+ };
420
+ }),
328
421
  /**
329
422
  *
330
423
  * @summary Returns the contents of the specified file
@@ -611,6 +704,33 @@ exports.OpenAIApiFp = function (configuration) {
611
704
  return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
612
705
  });
613
706
  },
707
+ /**
708
+ *
709
+ * @summary Creates a completion using a fine-tuned model
710
+ * @param {CreateCompletionFromModelRequest} createCompletionFromModelRequest
711
+ * @param {*} [options] Override http request option.
712
+ * @throws {RequiredError}
713
+ */
714
+ createCompletionFromModel(createCompletionFromModelRequest, options) {
715
+ return __awaiter(this, void 0, void 0, function* () {
716
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createCompletionFromModel(createCompletionFromModelRequest, options);
717
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
718
+ });
719
+ },
720
+ /**
721
+ *
722
+ * @summary Creates a new edit for the provided input, instruction, and parameters
723
+ * @param {string} engineId The ID of the engine to use for this request
724
+ * @param {CreateEditRequest} createEditRequest
725
+ * @param {*} [options] Override http request option.
726
+ * @throws {RequiredError}
727
+ */
728
+ createEdit(engineId, createEditRequest, options) {
729
+ return __awaiter(this, void 0, void 0, function* () {
730
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createEdit(engineId, createEditRequest, options);
731
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
732
+ });
733
+ },
614
734
  /**
615
735
  *
616
736
  * @summary Creates an embedding vector representing the input text.
@@ -655,7 +775,7 @@ exports.OpenAIApiFp = function (configuration) {
655
775
  /**
656
776
  *
657
777
  * @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.
658
- * @param {string} engineId The ID of the engine to use for this request
778
+ * @param {string} engineId The ID of the engine to use for this request. You can select one of `ada`, `babbage`, `curie`, or `davinci`.
659
779
  * @param {CreateSearchRequest} createSearchRequest
660
780
  * @param {*} [options] Override http request option.
661
781
  * @throws {RequiredError}
@@ -679,6 +799,19 @@ exports.OpenAIApiFp = function (configuration) {
679
799
  return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
680
800
  });
681
801
  },
802
+ /**
803
+ *
804
+ * @summary Delete a fine-tuned model. You must have the Owner role in your organization.
805
+ * @param {string} model The model to delete
806
+ * @param {*} [options] Override http request option.
807
+ * @throws {RequiredError}
808
+ */
809
+ deleteModel(model, options) {
810
+ return __awaiter(this, void 0, void 0, function* () {
811
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.deleteModel(model, options);
812
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
813
+ });
814
+ },
682
815
  /**
683
816
  *
684
817
  * @summary Returns the contents of the specified file
@@ -831,6 +964,27 @@ exports.OpenAIApiFactory = function (configuration, basePath, axios) {
831
964
  createCompletion(engineId, createCompletionRequest, options) {
832
965
  return localVarFp.createCompletion(engineId, createCompletionRequest, options).then((request) => request(axios, basePath));
833
966
  },
967
+ /**
968
+ *
969
+ * @summary Creates a completion using a fine-tuned model
970
+ * @param {CreateCompletionFromModelRequest} createCompletionFromModelRequest
971
+ * @param {*} [options] Override http request option.
972
+ * @throws {RequiredError}
973
+ */
974
+ createCompletionFromModel(createCompletionFromModelRequest, options) {
975
+ return localVarFp.createCompletionFromModel(createCompletionFromModelRequest, options).then((request) => request(axios, basePath));
976
+ },
977
+ /**
978
+ *
979
+ * @summary Creates a new edit for the provided input, instruction, and parameters
980
+ * @param {string} engineId The ID of the engine to use for this request
981
+ * @param {CreateEditRequest} createEditRequest
982
+ * @param {*} [options] Override http request option.
983
+ * @throws {RequiredError}
984
+ */
985
+ createEdit(engineId, createEditRequest, options) {
986
+ return localVarFp.createEdit(engineId, createEditRequest, options).then((request) => request(axios, basePath));
987
+ },
834
988
  /**
835
989
  *
836
990
  * @summary Creates an embedding vector representing the input text.
@@ -866,7 +1020,7 @@ exports.OpenAIApiFactory = function (configuration, basePath, axios) {
866
1020
  /**
867
1021
  *
868
1022
  * @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.
869
- * @param {string} engineId The ID of the engine to use for this request
1023
+ * @param {string} engineId The ID of the engine to use for this request. You can select one of `ada`, `babbage`, `curie`, or `davinci`.
870
1024
  * @param {CreateSearchRequest} createSearchRequest
871
1025
  * @param {*} [options] Override http request option.
872
1026
  * @throws {RequiredError}
@@ -884,6 +1038,16 @@ exports.OpenAIApiFactory = function (configuration, basePath, axios) {
884
1038
  deleteFile(fileId, options) {
885
1039
  return localVarFp.deleteFile(fileId, options).then((request) => request(axios, basePath));
886
1040
  },
1041
+ /**
1042
+ *
1043
+ * @summary Delete a fine-tuned model. You must have the Owner role in your organization.
1044
+ * @param {string} model The model to delete
1045
+ * @param {*} [options] Override http request option.
1046
+ * @throws {RequiredError}
1047
+ */
1048
+ deleteModel(model, options) {
1049
+ return localVarFp.deleteModel(model, options).then((request) => request(axios, basePath));
1050
+ },
887
1051
  /**
888
1052
  *
889
1053
  * @summary Returns the contents of the specified file
@@ -1016,6 +1180,29 @@ class OpenAIApi extends base_1.BaseAPI {
1016
1180
  createCompletion(engineId, createCompletionRequest, options) {
1017
1181
  return exports.OpenAIApiFp(this.configuration).createCompletion(engineId, createCompletionRequest, options).then((request) => request(this.axios, this.basePath));
1018
1182
  }
1183
+ /**
1184
+ *
1185
+ * @summary Creates a completion using a fine-tuned model
1186
+ * @param {CreateCompletionFromModelRequest} createCompletionFromModelRequest
1187
+ * @param {*} [options] Override http request option.
1188
+ * @throws {RequiredError}
1189
+ * @memberof OpenAIApi
1190
+ */
1191
+ createCompletionFromModel(createCompletionFromModelRequest, options) {
1192
+ return exports.OpenAIApiFp(this.configuration).createCompletionFromModel(createCompletionFromModelRequest, options).then((request) => request(this.axios, this.basePath));
1193
+ }
1194
+ /**
1195
+ *
1196
+ * @summary Creates a new edit for the provided input, instruction, and parameters
1197
+ * @param {string} engineId The ID of the engine to use for this request
1198
+ * @param {CreateEditRequest} createEditRequest
1199
+ * @param {*} [options] Override http request option.
1200
+ * @throws {RequiredError}
1201
+ * @memberof OpenAIApi
1202
+ */
1203
+ createEdit(engineId, createEditRequest, options) {
1204
+ return exports.OpenAIApiFp(this.configuration).createEdit(engineId, createEditRequest, options).then((request) => request(this.axios, this.basePath));
1205
+ }
1019
1206
  /**
1020
1207
  *
1021
1208
  * @summary Creates an embedding vector representing the input text.
@@ -1054,7 +1241,7 @@ class OpenAIApi extends base_1.BaseAPI {
1054
1241
  /**
1055
1242
  *
1056
1243
  * @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.
1057
- * @param {string} engineId The ID of the engine to use for this request
1244
+ * @param {string} engineId The ID of the engine to use for this request. You can select one of `ada`, `babbage`, `curie`, or `davinci`.
1058
1245
  * @param {CreateSearchRequest} createSearchRequest
1059
1246
  * @param {*} [options] Override http request option.
1060
1247
  * @throws {RequiredError}
@@ -1074,6 +1261,17 @@ class OpenAIApi extends base_1.BaseAPI {
1074
1261
  deleteFile(fileId, options) {
1075
1262
  return exports.OpenAIApiFp(this.configuration).deleteFile(fileId, options).then((request) => request(this.axios, this.basePath));
1076
1263
  }
1264
+ /**
1265
+ *
1266
+ * @summary Delete a fine-tuned model. You must have the Owner role in your organization.
1267
+ * @param {string} model The model to delete
1268
+ * @param {*} [options] Override http request option.
1269
+ * @throws {RequiredError}
1270
+ * @memberof OpenAIApi
1271
+ */
1272
+ deleteModel(model, options) {
1273
+ return exports.OpenAIApiFp(this.configuration).deleteModel(model, options).then((request) => request(this.axios, this.basePath));
1274
+ }
1077
1275
  /**
1078
1276
  *
1079
1277
  * @summary Returns the contents of the specified file
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.0
5
+ * The version of the OpenAPI document: 1.0.4
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.0
8
+ * The version of the OpenAPI document: 1.0.4
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.0
5
+ * The version of the OpenAPI document: 1.0.4
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.0
8
+ * The version of the OpenAPI document: 1.0.4
9
9
  *
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -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.0
5
+ * The version of the OpenAPI document: 1.0.4
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.0
8
+ * The version of the OpenAPI document: 1.0.4
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.0
5
+ * The version of the OpenAPI document: 1.0.4
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.0
8
+ * The version of the OpenAPI document: 1.0.4
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.0
7
+ * The version of the OpenAPI document: 1.0.4
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": "2.0.1",
3
+ "version": "2.0.5",
4
4
  "description": "Node.js library for the OpenAI API",
5
5
  "keywords": [
6
6
  "openai",
@@ -21,7 +21,7 @@
21
21
  "build": "tsc --outDir dist/"
22
22
  },
23
23
  "dependencies": {
24
- "axios": "^0.25.0",
24
+ "axios": "^0.26.0",
25
25
  "form-data": "^4.0.0"
26
26
  },
27
27
  "devDependencies": {