openai 1.0.0 → 2.0.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 ADDED
@@ -0,0 +1,1164 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * OpenAI API
6
+ * APIs for sampling from and fine-tuning language models
7
+ *
8
+ * The version of the OpenAPI document: 1.0.0
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.OpenAIApi = exports.OpenAIApiFactory = exports.OpenAIApiFp = exports.OpenAIApiAxiosParamCreator = void 0;
26
+ const axios_1 = require("axios");
27
+ // Some imports not used depending on template conditions
28
+ // @ts-ignore
29
+ const common_1 = require("./common");
30
+ // @ts-ignore
31
+ const base_1 = require("./base");
32
+ /**
33
+ * OpenAIApi - axios parameter creator
34
+ * @export
35
+ */
36
+ exports.OpenAIApiAxiosParamCreator = function (configuration) {
37
+ return {
38
+ /**
39
+ *
40
+ * @summary Immediately cancel a fine-tune job.
41
+ * @param {string} fineTuneId The ID of the fine-tune job to cancel
42
+ * @param {*} [options] Override http request option.
43
+ * @throws {RequiredError}
44
+ */
45
+ cancelFineTune: (fineTuneId, options = {}) => __awaiter(this, void 0, void 0, function* () {
46
+ // verify required parameter 'fineTuneId' is not null or undefined
47
+ common_1.assertParamExists('cancelFineTune', 'fineTuneId', fineTuneId);
48
+ const localVarPath = `/fine-tunes/{fine_tune_id}/cancel`
49
+ .replace(`{${"fine_tune_id"}}`, encodeURIComponent(String(fineTuneId)));
50
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
51
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
52
+ let baseOptions;
53
+ if (configuration) {
54
+ baseOptions = configuration.baseOptions;
55
+ }
56
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
57
+ const localVarHeaderParameter = {};
58
+ const localVarQueryParameter = {};
59
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
60
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
61
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
62
+ return {
63
+ url: common_1.toPathString(localVarUrlObj),
64
+ options: localVarRequestOptions,
65
+ };
66
+ }),
67
+ /**
68
+ *
69
+ * @summary Answers the specified question using the provided documents and examples. The endpoint first [searches](/docs/api-reference/searches) over provided documents or files to find relevant context. The relevant context is combined with the provided examples and question to create the prompt for [completion](/docs/api-reference/completions).
70
+ * @param {CreateAnswerRequest} createAnswerRequest
71
+ * @param {*} [options] Override http request option.
72
+ * @throws {RequiredError}
73
+ */
74
+ createAnswer: (createAnswerRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
75
+ // verify required parameter 'createAnswerRequest' is not null or undefined
76
+ common_1.assertParamExists('createAnswer', 'createAnswerRequest', createAnswerRequest);
77
+ const localVarPath = `/answers`;
78
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
79
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
80
+ let baseOptions;
81
+ if (configuration) {
82
+ baseOptions = configuration.baseOptions;
83
+ }
84
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
85
+ const localVarHeaderParameter = {};
86
+ const localVarQueryParameter = {};
87
+ localVarHeaderParameter['Content-Type'] = 'application/json';
88
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
89
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
90
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
91
+ localVarRequestOptions.data = common_1.serializeDataIfNeeded(createAnswerRequest, localVarRequestOptions, configuration);
92
+ return {
93
+ url: common_1.toPathString(localVarUrlObj),
94
+ options: localVarRequestOptions,
95
+ };
96
+ }),
97
+ /**
98
+ *
99
+ * @summary Classifies the specified `query` using provided examples. The endpoint first [searches](/docs/api-reference/searches) over the labeled examples to select the ones most relevant for the particular query. Then, the relevant examples are combined with the query to construct a prompt to produce the final label via the [completions](/docs/api-reference/completions) endpoint. Labeled examples can be provided via an uploaded `file`, or explicitly listed in the request using the `examples` parameter for quick tests and small scale use cases.
100
+ * @param {CreateClassificationRequest} createClassificationRequest
101
+ * @param {*} [options] Override http request option.
102
+ * @throws {RequiredError}
103
+ */
104
+ createClassification: (createClassificationRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
105
+ // verify required parameter 'createClassificationRequest' is not null or undefined
106
+ common_1.assertParamExists('createClassification', 'createClassificationRequest', createClassificationRequest);
107
+ const localVarPath = `/classifications`;
108
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
109
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
110
+ let baseOptions;
111
+ if (configuration) {
112
+ baseOptions = configuration.baseOptions;
113
+ }
114
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
115
+ const localVarHeaderParameter = {};
116
+ const localVarQueryParameter = {};
117
+ localVarHeaderParameter['Content-Type'] = 'application/json';
118
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
119
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
120
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
121
+ localVarRequestOptions.data = common_1.serializeDataIfNeeded(createClassificationRequest, localVarRequestOptions, configuration);
122
+ return {
123
+ url: common_1.toPathString(localVarUrlObj),
124
+ options: localVarRequestOptions,
125
+ };
126
+ }),
127
+ /**
128
+ *
129
+ * @summary Creates a new completion for the provided prompt and parameters
130
+ * @param {string} engineId The ID of the engine to use for this request
131
+ * @param {CreateCompletionRequest} createCompletionRequest
132
+ * @param {*} [options] Override http request option.
133
+ * @throws {RequiredError}
134
+ */
135
+ createCompletion: (engineId, createCompletionRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
136
+ // verify required parameter 'engineId' is not null or undefined
137
+ common_1.assertParamExists('createCompletion', 'engineId', engineId);
138
+ // verify required parameter 'createCompletionRequest' is not null or undefined
139
+ common_1.assertParamExists('createCompletion', 'createCompletionRequest', createCompletionRequest);
140
+ const localVarPath = `/engines/{engine_id}/completions`
141
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
142
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
143
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
144
+ let baseOptions;
145
+ if (configuration) {
146
+ baseOptions = configuration.baseOptions;
147
+ }
148
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
149
+ const localVarHeaderParameter = {};
150
+ const localVarQueryParameter = {};
151
+ localVarHeaderParameter['Content-Type'] = 'application/json';
152
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
153
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
154
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
155
+ localVarRequestOptions.data = common_1.serializeDataIfNeeded(createCompletionRequest, localVarRequestOptions, configuration);
156
+ return {
157
+ url: common_1.toPathString(localVarUrlObj),
158
+ options: localVarRequestOptions,
159
+ };
160
+ }),
161
+ /**
162
+ *
163
+ * @summary Creates an embedding vector representing the input text.
164
+ * @param {string} engineId The ID of the engine to use for this request
165
+ * @param {CreateEmbeddingRequest} createEmbeddingRequest
166
+ * @param {*} [options] Override http request option.
167
+ * @throws {RequiredError}
168
+ */
169
+ createEmbedding: (engineId, createEmbeddingRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
170
+ // verify required parameter 'engineId' is not null or undefined
171
+ common_1.assertParamExists('createEmbedding', 'engineId', engineId);
172
+ // verify required parameter 'createEmbeddingRequest' is not null or undefined
173
+ common_1.assertParamExists('createEmbedding', 'createEmbeddingRequest', createEmbeddingRequest);
174
+ const localVarPath = `/engines/{engine_id}/embeddings`
175
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
176
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
177
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
178
+ let baseOptions;
179
+ if (configuration) {
180
+ baseOptions = configuration.baseOptions;
181
+ }
182
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
183
+ const localVarHeaderParameter = {};
184
+ const localVarQueryParameter = {};
185
+ localVarHeaderParameter['Content-Type'] = 'application/json';
186
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
187
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
188
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
189
+ localVarRequestOptions.data = common_1.serializeDataIfNeeded(createEmbeddingRequest, localVarRequestOptions, configuration);
190
+ return {
191
+ url: common_1.toPathString(localVarUrlObj),
192
+ options: localVarRequestOptions,
193
+ };
194
+ }),
195
+ /**
196
+ *
197
+ * @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.
198
+ * @param {any} file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. If the `purpose` is set to \\\"search\\\" or \\\"answers\\\", each line is a JSON record with a \\\"text\\\" field and an optional \\\"metadata\\\" field. Only \\\"text\\\" field will be used for search. Specially, when the `purpose` is \\\"answers\\\", \\\"\\\\n\\\" is used as a delimiter to chunk contents in the \\\"text\\\" field into multiple documents for finer-grained matching. If the `purpose` is set to \\\"classifications\\\", each line is a JSON record representing a single training example with \\\"text\\\" and \\\"label\\\" fields along with an optional \\\"metadata\\\" field. 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).
199
+ * @param {string} purpose The intended purpose of the uploaded documents. Use \\\"search\\\" for [Search](/docs/api-reference/searches), \\\"answers\\\" for [Answers](/docs/api-reference/answers), \\\"classifications\\\" for [Classifications](/docs/api-reference/classifications) and \\\"fine-tune\\\" for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file.
200
+ * @param {*} [options] Override http request option.
201
+ * @throws {RequiredError}
202
+ */
203
+ createFile: (file, purpose, options = {}) => __awaiter(this, void 0, void 0, function* () {
204
+ // verify required parameter 'file' is not null or undefined
205
+ common_1.assertParamExists('createFile', 'file', file);
206
+ // verify required parameter 'purpose' is not null or undefined
207
+ common_1.assertParamExists('createFile', 'purpose', purpose);
208
+ const localVarPath = `/files`;
209
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
210
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
211
+ let baseOptions;
212
+ if (configuration) {
213
+ baseOptions = configuration.baseOptions;
214
+ }
215
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
216
+ const localVarHeaderParameter = {};
217
+ const localVarQueryParameter = {};
218
+ const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
219
+ if (file !== undefined) {
220
+ localVarFormParams.append('file', file);
221
+ }
222
+ if (purpose !== undefined) {
223
+ localVarFormParams.append('purpose', purpose);
224
+ }
225
+ localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
226
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
227
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
228
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), localVarFormParams.getHeaders()), headersFromBaseOptions), options.headers);
229
+ localVarRequestOptions.data = localVarFormParams;
230
+ return {
231
+ url: common_1.toPathString(localVarUrlObj),
232
+ options: localVarRequestOptions,
233
+ };
234
+ }),
235
+ /**
236
+ *
237
+ * @summary Creates a job that fine-tunes a specified model from a given dataset. Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
238
+ * @param {CreateFineTuneRequest} createFineTuneRequest
239
+ * @param {*} [options] Override http request option.
240
+ * @throws {RequiredError}
241
+ */
242
+ createFineTune: (createFineTuneRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
243
+ // verify required parameter 'createFineTuneRequest' is not null or undefined
244
+ common_1.assertParamExists('createFineTune', 'createFineTuneRequest', createFineTuneRequest);
245
+ const localVarPath = `/fine-tunes`;
246
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
247
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
248
+ let baseOptions;
249
+ if (configuration) {
250
+ baseOptions = configuration.baseOptions;
251
+ }
252
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
253
+ const localVarHeaderParameter = {};
254
+ const localVarQueryParameter = {};
255
+ localVarHeaderParameter['Content-Type'] = 'application/json';
256
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
257
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
258
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
259
+ localVarRequestOptions.data = common_1.serializeDataIfNeeded(createFineTuneRequest, localVarRequestOptions, configuration);
260
+ return {
261
+ url: common_1.toPathString(localVarUrlObj),
262
+ options: localVarRequestOptions,
263
+ };
264
+ }),
265
+ /**
266
+ *
267
+ * @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
269
+ * @param {CreateSearchRequest} createSearchRequest
270
+ * @param {*} [options] Override http request option.
271
+ * @throws {RequiredError}
272
+ */
273
+ createSearch: (engineId, createSearchRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
274
+ // verify required parameter 'engineId' is not null or undefined
275
+ common_1.assertParamExists('createSearch', 'engineId', engineId);
276
+ // verify required parameter 'createSearchRequest' is not null or undefined
277
+ common_1.assertParamExists('createSearch', 'createSearchRequest', createSearchRequest);
278
+ const localVarPath = `/engines/{engine_id}/search`
279
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
280
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
281
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
282
+ let baseOptions;
283
+ if (configuration) {
284
+ baseOptions = configuration.baseOptions;
285
+ }
286
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
287
+ const localVarHeaderParameter = {};
288
+ const localVarQueryParameter = {};
289
+ localVarHeaderParameter['Content-Type'] = 'application/json';
290
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
291
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
292
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
293
+ localVarRequestOptions.data = common_1.serializeDataIfNeeded(createSearchRequest, localVarRequestOptions, configuration);
294
+ return {
295
+ url: common_1.toPathString(localVarUrlObj),
296
+ options: localVarRequestOptions,
297
+ };
298
+ }),
299
+ /**
300
+ *
301
+ * @summary Delete a file.
302
+ * @param {string} fileId The ID of the file to use for this request
303
+ * @param {*} [options] Override http request option.
304
+ * @throws {RequiredError}
305
+ */
306
+ deleteFile: (fileId, options = {}) => __awaiter(this, void 0, void 0, function* () {
307
+ // verify required parameter 'fileId' is not null or undefined
308
+ common_1.assertParamExists('deleteFile', 'fileId', fileId);
309
+ const localVarPath = `/files/{file_id}`
310
+ .replace(`{${"file_id"}}`, encodeURIComponent(String(fileId)));
311
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
312
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
313
+ let baseOptions;
314
+ if (configuration) {
315
+ baseOptions = configuration.baseOptions;
316
+ }
317
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'DELETE' }, baseOptions), options);
318
+ const localVarHeaderParameter = {};
319
+ const localVarQueryParameter = {};
320
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
321
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
322
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
323
+ return {
324
+ url: common_1.toPathString(localVarUrlObj),
325
+ options: localVarRequestOptions,
326
+ };
327
+ }),
328
+ /**
329
+ *
330
+ * @summary Returns the contents of the specified file
331
+ * @param {string} fileId The ID of the file to use for this request
332
+ * @param {*} [options] Override http request option.
333
+ * @throws {RequiredError}
334
+ */
335
+ downloadFile: (fileId, options = {}) => __awaiter(this, void 0, void 0, function* () {
336
+ // verify required parameter 'fileId' is not null or undefined
337
+ common_1.assertParamExists('downloadFile', 'fileId', fileId);
338
+ const localVarPath = `/files/{file_id}/content`
339
+ .replace(`{${"file_id"}}`, encodeURIComponent(String(fileId)));
340
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
341
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
342
+ let baseOptions;
343
+ if (configuration) {
344
+ baseOptions = configuration.baseOptions;
345
+ }
346
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
347
+ const localVarHeaderParameter = {};
348
+ const localVarQueryParameter = {};
349
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
350
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
351
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
352
+ return {
353
+ url: common_1.toPathString(localVarUrlObj),
354
+ options: localVarRequestOptions,
355
+ };
356
+ }),
357
+ /**
358
+ *
359
+ * @summary Lists the currently available engines, and provides basic information about each one such as the owner and availability.
360
+ * @param {*} [options] Override http request option.
361
+ * @throws {RequiredError}
362
+ */
363
+ listEngines: (options = {}) => __awaiter(this, void 0, void 0, function* () {
364
+ const localVarPath = `/engines`;
365
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
366
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
367
+ let baseOptions;
368
+ if (configuration) {
369
+ baseOptions = configuration.baseOptions;
370
+ }
371
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
372
+ const localVarHeaderParameter = {};
373
+ const localVarQueryParameter = {};
374
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
375
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
376
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
377
+ return {
378
+ url: common_1.toPathString(localVarUrlObj),
379
+ options: localVarRequestOptions,
380
+ };
381
+ }),
382
+ /**
383
+ *
384
+ * @summary Returns a list of files that belong to the user\'s organization.
385
+ * @param {*} [options] Override http request option.
386
+ * @throws {RequiredError}
387
+ */
388
+ listFiles: (options = {}) => __awaiter(this, void 0, void 0, function* () {
389
+ const localVarPath = `/files`;
390
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
391
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
392
+ let baseOptions;
393
+ if (configuration) {
394
+ baseOptions = configuration.baseOptions;
395
+ }
396
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
397
+ const localVarHeaderParameter = {};
398
+ const localVarQueryParameter = {};
399
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
400
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
401
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
402
+ return {
403
+ url: common_1.toPathString(localVarUrlObj),
404
+ options: localVarRequestOptions,
405
+ };
406
+ }),
407
+ /**
408
+ *
409
+ * @summary Get fine-grained status updates for a fine-tune job.
410
+ * @param {string} fineTuneId The ID of the fine-tune job to get events for.
411
+ * @param {boolean} [stream] Whether to stream events for the fine-tune job. If set to true, events will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available. The stream will terminate with a `data: [DONE]` message when the job is finished (succeeded, cancelled, or failed). If set to false, only events generated so far will be returned.
412
+ * @param {*} [options] Override http request option.
413
+ * @throws {RequiredError}
414
+ */
415
+ listFineTuneEvents: (fineTuneId, stream, options = {}) => __awaiter(this, void 0, void 0, function* () {
416
+ // verify required parameter 'fineTuneId' is not null or undefined
417
+ common_1.assertParamExists('listFineTuneEvents', 'fineTuneId', fineTuneId);
418
+ const localVarPath = `/fine-tunes/{fine_tune_id}/events`
419
+ .replace(`{${"fine_tune_id"}}`, encodeURIComponent(String(fineTuneId)));
420
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
421
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
422
+ let baseOptions;
423
+ if (configuration) {
424
+ baseOptions = configuration.baseOptions;
425
+ }
426
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
427
+ const localVarHeaderParameter = {};
428
+ const localVarQueryParameter = {};
429
+ if (stream !== undefined) {
430
+ localVarQueryParameter['stream'] = stream;
431
+ }
432
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
433
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
434
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
435
+ return {
436
+ url: common_1.toPathString(localVarUrlObj),
437
+ options: localVarRequestOptions,
438
+ };
439
+ }),
440
+ /**
441
+ *
442
+ * @summary List your organization\'s fine-tuning jobs
443
+ * @param {*} [options] Override http request option.
444
+ * @throws {RequiredError}
445
+ */
446
+ listFineTunes: (options = {}) => __awaiter(this, void 0, void 0, function* () {
447
+ const localVarPath = `/fine-tunes`;
448
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
449
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
450
+ let baseOptions;
451
+ if (configuration) {
452
+ baseOptions = configuration.baseOptions;
453
+ }
454
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
455
+ const localVarHeaderParameter = {};
456
+ const localVarQueryParameter = {};
457
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
458
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
459
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
460
+ return {
461
+ url: common_1.toPathString(localVarUrlObj),
462
+ options: localVarRequestOptions,
463
+ };
464
+ }),
465
+ /**
466
+ *
467
+ * @summary Retrieves an engine instance, providing basic information about the engine such as the owner and availability.
468
+ * @param {string} engineId The ID of the engine to use for this request
469
+ * @param {*} [options] Override http request option.
470
+ * @throws {RequiredError}
471
+ */
472
+ retrieveEngine: (engineId, options = {}) => __awaiter(this, void 0, void 0, function* () {
473
+ // verify required parameter 'engineId' is not null or undefined
474
+ common_1.assertParamExists('retrieveEngine', 'engineId', engineId);
475
+ const localVarPath = `/engines/{engine_id}`
476
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
477
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
478
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
479
+ let baseOptions;
480
+ if (configuration) {
481
+ baseOptions = configuration.baseOptions;
482
+ }
483
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
484
+ const localVarHeaderParameter = {};
485
+ const localVarQueryParameter = {};
486
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
487
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
488
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
489
+ return {
490
+ url: common_1.toPathString(localVarUrlObj),
491
+ options: localVarRequestOptions,
492
+ };
493
+ }),
494
+ /**
495
+ *
496
+ * @summary Returns information about a specific file.
497
+ * @param {string} fileId The ID of the file to use for this request
498
+ * @param {*} [options] Override http request option.
499
+ * @throws {RequiredError}
500
+ */
501
+ retrieveFile: (fileId, options = {}) => __awaiter(this, void 0, void 0, function* () {
502
+ // verify required parameter 'fileId' is not null or undefined
503
+ common_1.assertParamExists('retrieveFile', 'fileId', fileId);
504
+ const localVarPath = `/files/{file_id}`
505
+ .replace(`{${"file_id"}}`, encodeURIComponent(String(fileId)));
506
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
507
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
508
+ let baseOptions;
509
+ if (configuration) {
510
+ baseOptions = configuration.baseOptions;
511
+ }
512
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
513
+ const localVarHeaderParameter = {};
514
+ const localVarQueryParameter = {};
515
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
516
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
517
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
518
+ return {
519
+ url: common_1.toPathString(localVarUrlObj),
520
+ options: localVarRequestOptions,
521
+ };
522
+ }),
523
+ /**
524
+ *
525
+ * @summary Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
526
+ * @param {string} fineTuneId The ID of the fine-tune job
527
+ * @param {*} [options] Override http request option.
528
+ * @throws {RequiredError}
529
+ */
530
+ retrieveFineTune: (fineTuneId, options = {}) => __awaiter(this, void 0, void 0, function* () {
531
+ // verify required parameter 'fineTuneId' is not null or undefined
532
+ common_1.assertParamExists('retrieveFineTune', 'fineTuneId', fineTuneId);
533
+ const localVarPath = `/fine-tunes/{fine_tune_id}`
534
+ .replace(`{${"fine_tune_id"}}`, encodeURIComponent(String(fineTuneId)));
535
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
536
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
537
+ let baseOptions;
538
+ if (configuration) {
539
+ baseOptions = configuration.baseOptions;
540
+ }
541
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
542
+ const localVarHeaderParameter = {};
543
+ const localVarQueryParameter = {};
544
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
545
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
546
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
547
+ return {
548
+ url: common_1.toPathString(localVarUrlObj),
549
+ options: localVarRequestOptions,
550
+ };
551
+ }),
552
+ };
553
+ };
554
+ /**
555
+ * OpenAIApi - functional programming interface
556
+ * @export
557
+ */
558
+ exports.OpenAIApiFp = function (configuration) {
559
+ const localVarAxiosParamCreator = exports.OpenAIApiAxiosParamCreator(configuration);
560
+ return {
561
+ /**
562
+ *
563
+ * @summary Immediately cancel a fine-tune job.
564
+ * @param {string} fineTuneId The ID of the fine-tune job to cancel
565
+ * @param {*} [options] Override http request option.
566
+ * @throws {RequiredError}
567
+ */
568
+ cancelFineTune(fineTuneId, options) {
569
+ return __awaiter(this, void 0, void 0, function* () {
570
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.cancelFineTune(fineTuneId, options);
571
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
572
+ });
573
+ },
574
+ /**
575
+ *
576
+ * @summary Answers the specified question using the provided documents and examples. The endpoint first [searches](/docs/api-reference/searches) over provided documents or files to find relevant context. The relevant context is combined with the provided examples and question to create the prompt for [completion](/docs/api-reference/completions).
577
+ * @param {CreateAnswerRequest} createAnswerRequest
578
+ * @param {*} [options] Override http request option.
579
+ * @throws {RequiredError}
580
+ */
581
+ createAnswer(createAnswerRequest, options) {
582
+ return __awaiter(this, void 0, void 0, function* () {
583
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createAnswer(createAnswerRequest, options);
584
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
585
+ });
586
+ },
587
+ /**
588
+ *
589
+ * @summary Classifies the specified `query` using provided examples. The endpoint first [searches](/docs/api-reference/searches) over the labeled examples to select the ones most relevant for the particular query. Then, the relevant examples are combined with the query to construct a prompt to produce the final label via the [completions](/docs/api-reference/completions) endpoint. Labeled examples can be provided via an uploaded `file`, or explicitly listed in the request using the `examples` parameter for quick tests and small scale use cases.
590
+ * @param {CreateClassificationRequest} createClassificationRequest
591
+ * @param {*} [options] Override http request option.
592
+ * @throws {RequiredError}
593
+ */
594
+ createClassification(createClassificationRequest, options) {
595
+ return __awaiter(this, void 0, void 0, function* () {
596
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createClassification(createClassificationRequest, options);
597
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
598
+ });
599
+ },
600
+ /**
601
+ *
602
+ * @summary Creates a new completion for the provided prompt and parameters
603
+ * @param {string} engineId The ID of the engine to use for this request
604
+ * @param {CreateCompletionRequest} createCompletionRequest
605
+ * @param {*} [options] Override http request option.
606
+ * @throws {RequiredError}
607
+ */
608
+ createCompletion(engineId, createCompletionRequest, options) {
609
+ return __awaiter(this, void 0, void 0, function* () {
610
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createCompletion(engineId, createCompletionRequest, options);
611
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
612
+ });
613
+ },
614
+ /**
615
+ *
616
+ * @summary Creates an embedding vector representing the input text.
617
+ * @param {string} engineId The ID of the engine to use for this request
618
+ * @param {CreateEmbeddingRequest} createEmbeddingRequest
619
+ * @param {*} [options] Override http request option.
620
+ * @throws {RequiredError}
621
+ */
622
+ createEmbedding(engineId, createEmbeddingRequest, options) {
623
+ return __awaiter(this, void 0, void 0, function* () {
624
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createEmbedding(engineId, createEmbeddingRequest, options);
625
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
626
+ });
627
+ },
628
+ /**
629
+ *
630
+ * @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.
631
+ * @param {any} file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. If the `purpose` is set to \\\"search\\\" or \\\"answers\\\", each line is a JSON record with a \\\"text\\\" field and an optional \\\"metadata\\\" field. Only \\\"text\\\" field will be used for search. Specially, when the `purpose` is \\\"answers\\\", \\\"\\\\n\\\" is used as a delimiter to chunk contents in the \\\"text\\\" field into multiple documents for finer-grained matching. If the `purpose` is set to \\\"classifications\\\", each line is a JSON record representing a single training example with \\\"text\\\" and \\\"label\\\" fields along with an optional \\\"metadata\\\" field. 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).
632
+ * @param {string} purpose The intended purpose of the uploaded documents. Use \\\"search\\\" for [Search](/docs/api-reference/searches), \\\"answers\\\" for [Answers](/docs/api-reference/answers), \\\"classifications\\\" for [Classifications](/docs/api-reference/classifications) and \\\"fine-tune\\\" for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file.
633
+ * @param {*} [options] Override http request option.
634
+ * @throws {RequiredError}
635
+ */
636
+ createFile(file, purpose, options) {
637
+ return __awaiter(this, void 0, void 0, function* () {
638
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createFile(file, purpose, options);
639
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
640
+ });
641
+ },
642
+ /**
643
+ *
644
+ * @summary Creates a job that fine-tunes a specified model from a given dataset. Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
645
+ * @param {CreateFineTuneRequest} createFineTuneRequest
646
+ * @param {*} [options] Override http request option.
647
+ * @throws {RequiredError}
648
+ */
649
+ createFineTune(createFineTuneRequest, options) {
650
+ return __awaiter(this, void 0, void 0, function* () {
651
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createFineTune(createFineTuneRequest, options);
652
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
653
+ });
654
+ },
655
+ /**
656
+ *
657
+ * @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
659
+ * @param {CreateSearchRequest} createSearchRequest
660
+ * @param {*} [options] Override http request option.
661
+ * @throws {RequiredError}
662
+ */
663
+ createSearch(engineId, createSearchRequest, options) {
664
+ return __awaiter(this, void 0, void 0, function* () {
665
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createSearch(engineId, createSearchRequest, options);
666
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
667
+ });
668
+ },
669
+ /**
670
+ *
671
+ * @summary Delete a file.
672
+ * @param {string} fileId The ID of the file to use for this request
673
+ * @param {*} [options] Override http request option.
674
+ * @throws {RequiredError}
675
+ */
676
+ deleteFile(fileId, options) {
677
+ return __awaiter(this, void 0, void 0, function* () {
678
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.deleteFile(fileId, options);
679
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
680
+ });
681
+ },
682
+ /**
683
+ *
684
+ * @summary Returns the contents of the specified file
685
+ * @param {string} fileId The ID of the file to use for this request
686
+ * @param {*} [options] Override http request option.
687
+ * @throws {RequiredError}
688
+ */
689
+ downloadFile(fileId, options) {
690
+ return __awaiter(this, void 0, void 0, function* () {
691
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.downloadFile(fileId, options);
692
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
693
+ });
694
+ },
695
+ /**
696
+ *
697
+ * @summary Lists the currently available engines, and provides basic information about each one such as the owner and availability.
698
+ * @param {*} [options] Override http request option.
699
+ * @throws {RequiredError}
700
+ */
701
+ listEngines(options) {
702
+ return __awaiter(this, void 0, void 0, function* () {
703
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.listEngines(options);
704
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
705
+ });
706
+ },
707
+ /**
708
+ *
709
+ * @summary Returns a list of files that belong to the user\'s organization.
710
+ * @param {*} [options] Override http request option.
711
+ * @throws {RequiredError}
712
+ */
713
+ listFiles(options) {
714
+ return __awaiter(this, void 0, void 0, function* () {
715
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.listFiles(options);
716
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
717
+ });
718
+ },
719
+ /**
720
+ *
721
+ * @summary Get fine-grained status updates for a fine-tune job.
722
+ * @param {string} fineTuneId The ID of the fine-tune job to get events for.
723
+ * @param {boolean} [stream] Whether to stream events for the fine-tune job. If set to true, events will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available. The stream will terminate with a `data: [DONE]` message when the job is finished (succeeded, cancelled, or failed). If set to false, only events generated so far will be returned.
724
+ * @param {*} [options] Override http request option.
725
+ * @throws {RequiredError}
726
+ */
727
+ listFineTuneEvents(fineTuneId, stream, options) {
728
+ return __awaiter(this, void 0, void 0, function* () {
729
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.listFineTuneEvents(fineTuneId, stream, options);
730
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
731
+ });
732
+ },
733
+ /**
734
+ *
735
+ * @summary List your organization\'s fine-tuning jobs
736
+ * @param {*} [options] Override http request option.
737
+ * @throws {RequiredError}
738
+ */
739
+ listFineTunes(options) {
740
+ return __awaiter(this, void 0, void 0, function* () {
741
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.listFineTunes(options);
742
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
743
+ });
744
+ },
745
+ /**
746
+ *
747
+ * @summary Retrieves an engine instance, providing basic information about the engine such as the owner and availability.
748
+ * @param {string} engineId The ID of the engine to use for this request
749
+ * @param {*} [options] Override http request option.
750
+ * @throws {RequiredError}
751
+ */
752
+ retrieveEngine(engineId, options) {
753
+ return __awaiter(this, void 0, void 0, function* () {
754
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.retrieveEngine(engineId, options);
755
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
756
+ });
757
+ },
758
+ /**
759
+ *
760
+ * @summary Returns information about a specific file.
761
+ * @param {string} fileId The ID of the file to use for this request
762
+ * @param {*} [options] Override http request option.
763
+ * @throws {RequiredError}
764
+ */
765
+ retrieveFile(fileId, options) {
766
+ return __awaiter(this, void 0, void 0, function* () {
767
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.retrieveFile(fileId, options);
768
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
769
+ });
770
+ },
771
+ /**
772
+ *
773
+ * @summary Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
774
+ * @param {string} fineTuneId The ID of the fine-tune job
775
+ * @param {*} [options] Override http request option.
776
+ * @throws {RequiredError}
777
+ */
778
+ retrieveFineTune(fineTuneId, options) {
779
+ return __awaiter(this, void 0, void 0, function* () {
780
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.retrieveFineTune(fineTuneId, options);
781
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
782
+ });
783
+ },
784
+ };
785
+ };
786
+ /**
787
+ * OpenAIApi - factory interface
788
+ * @export
789
+ */
790
+ exports.OpenAIApiFactory = function (configuration, basePath, axios) {
791
+ const localVarFp = exports.OpenAIApiFp(configuration);
792
+ return {
793
+ /**
794
+ *
795
+ * @summary Immediately cancel a fine-tune job.
796
+ * @param {string} fineTuneId The ID of the fine-tune job to cancel
797
+ * @param {*} [options] Override http request option.
798
+ * @throws {RequiredError}
799
+ */
800
+ cancelFineTune(fineTuneId, options) {
801
+ return localVarFp.cancelFineTune(fineTuneId, options).then((request) => request(axios, basePath));
802
+ },
803
+ /**
804
+ *
805
+ * @summary Answers the specified question using the provided documents and examples. The endpoint first [searches](/docs/api-reference/searches) over provided documents or files to find relevant context. The relevant context is combined with the provided examples and question to create the prompt for [completion](/docs/api-reference/completions).
806
+ * @param {CreateAnswerRequest} createAnswerRequest
807
+ * @param {*} [options] Override http request option.
808
+ * @throws {RequiredError}
809
+ */
810
+ createAnswer(createAnswerRequest, options) {
811
+ return localVarFp.createAnswer(createAnswerRequest, options).then((request) => request(axios, basePath));
812
+ },
813
+ /**
814
+ *
815
+ * @summary Classifies the specified `query` using provided examples. The endpoint first [searches](/docs/api-reference/searches) over the labeled examples to select the ones most relevant for the particular query. Then, the relevant examples are combined with the query to construct a prompt to produce the final label via the [completions](/docs/api-reference/completions) endpoint. Labeled examples can be provided via an uploaded `file`, or explicitly listed in the request using the `examples` parameter for quick tests and small scale use cases.
816
+ * @param {CreateClassificationRequest} createClassificationRequest
817
+ * @param {*} [options] Override http request option.
818
+ * @throws {RequiredError}
819
+ */
820
+ createClassification(createClassificationRequest, options) {
821
+ return localVarFp.createClassification(createClassificationRequest, options).then((request) => request(axios, basePath));
822
+ },
823
+ /**
824
+ *
825
+ * @summary Creates a new completion for the provided prompt and parameters
826
+ * @param {string} engineId The ID of the engine to use for this request
827
+ * @param {CreateCompletionRequest} createCompletionRequest
828
+ * @param {*} [options] Override http request option.
829
+ * @throws {RequiredError}
830
+ */
831
+ createCompletion(engineId, createCompletionRequest, options) {
832
+ return localVarFp.createCompletion(engineId, createCompletionRequest, options).then((request) => request(axios, basePath));
833
+ },
834
+ /**
835
+ *
836
+ * @summary Creates an embedding vector representing the input text.
837
+ * @param {string} engineId The ID of the engine to use for this request
838
+ * @param {CreateEmbeddingRequest} createEmbeddingRequest
839
+ * @param {*} [options] Override http request option.
840
+ * @throws {RequiredError}
841
+ */
842
+ createEmbedding(engineId, createEmbeddingRequest, options) {
843
+ return localVarFp.createEmbedding(engineId, createEmbeddingRequest, options).then((request) => request(axios, basePath));
844
+ },
845
+ /**
846
+ *
847
+ * @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.
848
+ * @param {any} file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. If the `purpose` is set to \\\"search\\\" or \\\"answers\\\", each line is a JSON record with a \\\"text\\\" field and an optional \\\"metadata\\\" field. Only \\\"text\\\" field will be used for search. Specially, when the `purpose` is \\\"answers\\\", \\\"\\\\n\\\" is used as a delimiter to chunk contents in the \\\"text\\\" field into multiple documents for finer-grained matching. If the `purpose` is set to \\\"classifications\\\", each line is a JSON record representing a single training example with \\\"text\\\" and \\\"label\\\" fields along with an optional \\\"metadata\\\" field. 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).
849
+ * @param {string} purpose The intended purpose of the uploaded documents. Use \\\"search\\\" for [Search](/docs/api-reference/searches), \\\"answers\\\" for [Answers](/docs/api-reference/answers), \\\"classifications\\\" for [Classifications](/docs/api-reference/classifications) and \\\"fine-tune\\\" for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file.
850
+ * @param {*} [options] Override http request option.
851
+ * @throws {RequiredError}
852
+ */
853
+ createFile(file, purpose, options) {
854
+ return localVarFp.createFile(file, purpose, options).then((request) => request(axios, basePath));
855
+ },
856
+ /**
857
+ *
858
+ * @summary Creates a job that fine-tunes a specified model from a given dataset. Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
859
+ * @param {CreateFineTuneRequest} createFineTuneRequest
860
+ * @param {*} [options] Override http request option.
861
+ * @throws {RequiredError}
862
+ */
863
+ createFineTune(createFineTuneRequest, options) {
864
+ return localVarFp.createFineTune(createFineTuneRequest, options).then((request) => request(axios, basePath));
865
+ },
866
+ /**
867
+ *
868
+ * @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
870
+ * @param {CreateSearchRequest} createSearchRequest
871
+ * @param {*} [options] Override http request option.
872
+ * @throws {RequiredError}
873
+ */
874
+ createSearch(engineId, createSearchRequest, options) {
875
+ return localVarFp.createSearch(engineId, createSearchRequest, options).then((request) => request(axios, basePath));
876
+ },
877
+ /**
878
+ *
879
+ * @summary Delete a file.
880
+ * @param {string} fileId The ID of the file to use for this request
881
+ * @param {*} [options] Override http request option.
882
+ * @throws {RequiredError}
883
+ */
884
+ deleteFile(fileId, options) {
885
+ return localVarFp.deleteFile(fileId, options).then((request) => request(axios, basePath));
886
+ },
887
+ /**
888
+ *
889
+ * @summary Returns the contents of the specified file
890
+ * @param {string} fileId The ID of the file to use for this request
891
+ * @param {*} [options] Override http request option.
892
+ * @throws {RequiredError}
893
+ */
894
+ downloadFile(fileId, options) {
895
+ return localVarFp.downloadFile(fileId, options).then((request) => request(axios, basePath));
896
+ },
897
+ /**
898
+ *
899
+ * @summary Lists the currently available engines, and provides basic information about each one such as the owner and availability.
900
+ * @param {*} [options] Override http request option.
901
+ * @throws {RequiredError}
902
+ */
903
+ listEngines(options) {
904
+ return localVarFp.listEngines(options).then((request) => request(axios, basePath));
905
+ },
906
+ /**
907
+ *
908
+ * @summary Returns a list of files that belong to the user\'s organization.
909
+ * @param {*} [options] Override http request option.
910
+ * @throws {RequiredError}
911
+ */
912
+ listFiles(options) {
913
+ return localVarFp.listFiles(options).then((request) => request(axios, basePath));
914
+ },
915
+ /**
916
+ *
917
+ * @summary Get fine-grained status updates for a fine-tune job.
918
+ * @param {string} fineTuneId The ID of the fine-tune job to get events for.
919
+ * @param {boolean} [stream] Whether to stream events for the fine-tune job. If set to true, events will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available. The stream will terminate with a `data: [DONE]` message when the job is finished (succeeded, cancelled, or failed). If set to false, only events generated so far will be returned.
920
+ * @param {*} [options] Override http request option.
921
+ * @throws {RequiredError}
922
+ */
923
+ listFineTuneEvents(fineTuneId, stream, options) {
924
+ return localVarFp.listFineTuneEvents(fineTuneId, stream, options).then((request) => request(axios, basePath));
925
+ },
926
+ /**
927
+ *
928
+ * @summary List your organization\'s fine-tuning jobs
929
+ * @param {*} [options] Override http request option.
930
+ * @throws {RequiredError}
931
+ */
932
+ listFineTunes(options) {
933
+ return localVarFp.listFineTunes(options).then((request) => request(axios, basePath));
934
+ },
935
+ /**
936
+ *
937
+ * @summary Retrieves an engine instance, providing basic information about the engine such as the owner and availability.
938
+ * @param {string} engineId The ID of the engine to use for this request
939
+ * @param {*} [options] Override http request option.
940
+ * @throws {RequiredError}
941
+ */
942
+ retrieveEngine(engineId, options) {
943
+ return localVarFp.retrieveEngine(engineId, options).then((request) => request(axios, basePath));
944
+ },
945
+ /**
946
+ *
947
+ * @summary Returns information about a specific file.
948
+ * @param {string} fileId The ID of the file to use for this request
949
+ * @param {*} [options] Override http request option.
950
+ * @throws {RequiredError}
951
+ */
952
+ retrieveFile(fileId, options) {
953
+ return localVarFp.retrieveFile(fileId, options).then((request) => request(axios, basePath));
954
+ },
955
+ /**
956
+ *
957
+ * @summary Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
958
+ * @param {string} fineTuneId The ID of the fine-tune job
959
+ * @param {*} [options] Override http request option.
960
+ * @throws {RequiredError}
961
+ */
962
+ retrieveFineTune(fineTuneId, options) {
963
+ return localVarFp.retrieveFineTune(fineTuneId, options).then((request) => request(axios, basePath));
964
+ },
965
+ };
966
+ };
967
+ /**
968
+ * OpenAIApi - object-oriented interface
969
+ * @export
970
+ * @class OpenAIApi
971
+ * @extends {BaseAPI}
972
+ */
973
+ class OpenAIApi extends base_1.BaseAPI {
974
+ /**
975
+ *
976
+ * @summary Immediately cancel a fine-tune job.
977
+ * @param {string} fineTuneId The ID of the fine-tune job to cancel
978
+ * @param {*} [options] Override http request option.
979
+ * @throws {RequiredError}
980
+ * @memberof OpenAIApi
981
+ */
982
+ cancelFineTune(fineTuneId, options) {
983
+ return exports.OpenAIApiFp(this.configuration).cancelFineTune(fineTuneId, options).then((request) => request(this.axios, this.basePath));
984
+ }
985
+ /**
986
+ *
987
+ * @summary Answers the specified question using the provided documents and examples. The endpoint first [searches](/docs/api-reference/searches) over provided documents or files to find relevant context. The relevant context is combined with the provided examples and question to create the prompt for [completion](/docs/api-reference/completions).
988
+ * @param {CreateAnswerRequest} createAnswerRequest
989
+ * @param {*} [options] Override http request option.
990
+ * @throws {RequiredError}
991
+ * @memberof OpenAIApi
992
+ */
993
+ createAnswer(createAnswerRequest, options) {
994
+ return exports.OpenAIApiFp(this.configuration).createAnswer(createAnswerRequest, options).then((request) => request(this.axios, this.basePath));
995
+ }
996
+ /**
997
+ *
998
+ * @summary Classifies the specified `query` using provided examples. The endpoint first [searches](/docs/api-reference/searches) over the labeled examples to select the ones most relevant for the particular query. Then, the relevant examples are combined with the query to construct a prompt to produce the final label via the [completions](/docs/api-reference/completions) endpoint. Labeled examples can be provided via an uploaded `file`, or explicitly listed in the request using the `examples` parameter for quick tests and small scale use cases.
999
+ * @param {CreateClassificationRequest} createClassificationRequest
1000
+ * @param {*} [options] Override http request option.
1001
+ * @throws {RequiredError}
1002
+ * @memberof OpenAIApi
1003
+ */
1004
+ createClassification(createClassificationRequest, options) {
1005
+ return exports.OpenAIApiFp(this.configuration).createClassification(createClassificationRequest, options).then((request) => request(this.axios, this.basePath));
1006
+ }
1007
+ /**
1008
+ *
1009
+ * @summary Creates a new completion for the provided prompt and parameters
1010
+ * @param {string} engineId The ID of the engine to use for this request
1011
+ * @param {CreateCompletionRequest} createCompletionRequest
1012
+ * @param {*} [options] Override http request option.
1013
+ * @throws {RequiredError}
1014
+ * @memberof OpenAIApi
1015
+ */
1016
+ createCompletion(engineId, createCompletionRequest, options) {
1017
+ return exports.OpenAIApiFp(this.configuration).createCompletion(engineId, createCompletionRequest, options).then((request) => request(this.axios, this.basePath));
1018
+ }
1019
+ /**
1020
+ *
1021
+ * @summary Creates an embedding vector representing the input text.
1022
+ * @param {string} engineId The ID of the engine to use for this request
1023
+ * @param {CreateEmbeddingRequest} createEmbeddingRequest
1024
+ * @param {*} [options] Override http request option.
1025
+ * @throws {RequiredError}
1026
+ * @memberof OpenAIApi
1027
+ */
1028
+ createEmbedding(engineId, createEmbeddingRequest, options) {
1029
+ return exports.OpenAIApiFp(this.configuration).createEmbedding(engineId, createEmbeddingRequest, options).then((request) => request(this.axios, this.basePath));
1030
+ }
1031
+ /**
1032
+ *
1033
+ * @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.
1034
+ * @param {any} file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. If the `purpose` is set to \\\"search\\\" or \\\"answers\\\", each line is a JSON record with a \\\"text\\\" field and an optional \\\"metadata\\\" field. Only \\\"text\\\" field will be used for search. Specially, when the `purpose` is \\\"answers\\\", \\\"\\\\n\\\" is used as a delimiter to chunk contents in the \\\"text\\\" field into multiple documents for finer-grained matching. If the `purpose` is set to \\\"classifications\\\", each line is a JSON record representing a single training example with \\\"text\\\" and \\\"label\\\" fields along with an optional \\\"metadata\\\" field. 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).
1035
+ * @param {string} purpose The intended purpose of the uploaded documents. Use \\\"search\\\" for [Search](/docs/api-reference/searches), \\\"answers\\\" for [Answers](/docs/api-reference/answers), \\\"classifications\\\" for [Classifications](/docs/api-reference/classifications) and \\\"fine-tune\\\" for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file.
1036
+ * @param {*} [options] Override http request option.
1037
+ * @throws {RequiredError}
1038
+ * @memberof OpenAIApi
1039
+ */
1040
+ createFile(file, purpose, options) {
1041
+ return exports.OpenAIApiFp(this.configuration).createFile(file, purpose, options).then((request) => request(this.axios, this.basePath));
1042
+ }
1043
+ /**
1044
+ *
1045
+ * @summary Creates a job that fine-tunes a specified model from a given dataset. Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
1046
+ * @param {CreateFineTuneRequest} createFineTuneRequest
1047
+ * @param {*} [options] Override http request option.
1048
+ * @throws {RequiredError}
1049
+ * @memberof OpenAIApi
1050
+ */
1051
+ createFineTune(createFineTuneRequest, options) {
1052
+ return exports.OpenAIApiFp(this.configuration).createFineTune(createFineTuneRequest, options).then((request) => request(this.axios, this.basePath));
1053
+ }
1054
+ /**
1055
+ *
1056
+ * @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
1058
+ * @param {CreateSearchRequest} createSearchRequest
1059
+ * @param {*} [options] Override http request option.
1060
+ * @throws {RequiredError}
1061
+ * @memberof OpenAIApi
1062
+ */
1063
+ createSearch(engineId, createSearchRequest, options) {
1064
+ return exports.OpenAIApiFp(this.configuration).createSearch(engineId, createSearchRequest, options).then((request) => request(this.axios, this.basePath));
1065
+ }
1066
+ /**
1067
+ *
1068
+ * @summary Delete a file.
1069
+ * @param {string} fileId The ID of the file to use for this request
1070
+ * @param {*} [options] Override http request option.
1071
+ * @throws {RequiredError}
1072
+ * @memberof OpenAIApi
1073
+ */
1074
+ deleteFile(fileId, options) {
1075
+ return exports.OpenAIApiFp(this.configuration).deleteFile(fileId, options).then((request) => request(this.axios, this.basePath));
1076
+ }
1077
+ /**
1078
+ *
1079
+ * @summary Returns the contents of the specified file
1080
+ * @param {string} fileId The ID of the file to use for this request
1081
+ * @param {*} [options] Override http request option.
1082
+ * @throws {RequiredError}
1083
+ * @memberof OpenAIApi
1084
+ */
1085
+ downloadFile(fileId, options) {
1086
+ return exports.OpenAIApiFp(this.configuration).downloadFile(fileId, options).then((request) => request(this.axios, this.basePath));
1087
+ }
1088
+ /**
1089
+ *
1090
+ * @summary Lists the currently available engines, and provides basic information about each one such as the owner and availability.
1091
+ * @param {*} [options] Override http request option.
1092
+ * @throws {RequiredError}
1093
+ * @memberof OpenAIApi
1094
+ */
1095
+ listEngines(options) {
1096
+ return exports.OpenAIApiFp(this.configuration).listEngines(options).then((request) => request(this.axios, this.basePath));
1097
+ }
1098
+ /**
1099
+ *
1100
+ * @summary Returns a list of files that belong to the user\'s organization.
1101
+ * @param {*} [options] Override http request option.
1102
+ * @throws {RequiredError}
1103
+ * @memberof OpenAIApi
1104
+ */
1105
+ listFiles(options) {
1106
+ return exports.OpenAIApiFp(this.configuration).listFiles(options).then((request) => request(this.axios, this.basePath));
1107
+ }
1108
+ /**
1109
+ *
1110
+ * @summary Get fine-grained status updates for a fine-tune job.
1111
+ * @param {string} fineTuneId The ID of the fine-tune job to get events for.
1112
+ * @param {boolean} [stream] Whether to stream events for the fine-tune job. If set to true, events will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available. The stream will terminate with a `data: [DONE]` message when the job is finished (succeeded, cancelled, or failed). If set to false, only events generated so far will be returned.
1113
+ * @param {*} [options] Override http request option.
1114
+ * @throws {RequiredError}
1115
+ * @memberof OpenAIApi
1116
+ */
1117
+ listFineTuneEvents(fineTuneId, stream, options) {
1118
+ return exports.OpenAIApiFp(this.configuration).listFineTuneEvents(fineTuneId, stream, options).then((request) => request(this.axios, this.basePath));
1119
+ }
1120
+ /**
1121
+ *
1122
+ * @summary List your organization\'s fine-tuning jobs
1123
+ * @param {*} [options] Override http request option.
1124
+ * @throws {RequiredError}
1125
+ * @memberof OpenAIApi
1126
+ */
1127
+ listFineTunes(options) {
1128
+ return exports.OpenAIApiFp(this.configuration).listFineTunes(options).then((request) => request(this.axios, this.basePath));
1129
+ }
1130
+ /**
1131
+ *
1132
+ * @summary Retrieves an engine instance, providing basic information about the engine such as the owner and availability.
1133
+ * @param {string} engineId The ID of the engine to use for this request
1134
+ * @param {*} [options] Override http request option.
1135
+ * @throws {RequiredError}
1136
+ * @memberof OpenAIApi
1137
+ */
1138
+ retrieveEngine(engineId, options) {
1139
+ return exports.OpenAIApiFp(this.configuration).retrieveEngine(engineId, options).then((request) => request(this.axios, this.basePath));
1140
+ }
1141
+ /**
1142
+ *
1143
+ * @summary Returns information about a specific file.
1144
+ * @param {string} fileId The ID of the file to use for this request
1145
+ * @param {*} [options] Override http request option.
1146
+ * @throws {RequiredError}
1147
+ * @memberof OpenAIApi
1148
+ */
1149
+ retrieveFile(fileId, options) {
1150
+ return exports.OpenAIApiFp(this.configuration).retrieveFile(fileId, options).then((request) => request(this.axios, this.basePath));
1151
+ }
1152
+ /**
1153
+ *
1154
+ * @summary Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
1155
+ * @param {string} fineTuneId The ID of the fine-tune job
1156
+ * @param {*} [options] Override http request option.
1157
+ * @throws {RequiredError}
1158
+ * @memberof OpenAIApi
1159
+ */
1160
+ retrieveFineTune(fineTuneId, options) {
1161
+ return exports.OpenAIApiFp(this.configuration).retrieveFineTune(fineTuneId, options).then((request) => request(this.axios, this.basePath));
1162
+ }
1163
+ }
1164
+ exports.OpenAIApi = OpenAIApi;