openai 3.0.1 → 3.2.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/.github/ISSUE_TEMPLATE/bug_report.yml +56 -0
- package/.github/ISSUE_TEMPLATE/config.yml +7 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +20 -0
- package/.github/workflows/test.yml +25 -0
- package/.openapi-generator/VERSION +1 -1
- package/README.md +9 -4
- package/api.ts +941 -41
- package/base.ts +5 -4
- package/common.ts +6 -4
- package/configuration.ts +1 -1
- package/dist/api.d.ts +606 -32
- package/dist/api.js +557 -6
- package/dist/base.d.ts +3 -4
- package/dist/base.js +1 -3
- package/dist/common.d.ts +4 -4
- package/dist/common.js +3 -1
- package/dist/configuration.d.ts +1 -1
- package/dist/configuration.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/index.ts +1 -1
- package/package.json +5 -5
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
|
|
8
|
+
* The version of the OpenAPI document: 1.1.0
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -22,13 +22,32 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
22
22
|
});
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.OpenAIApi = exports.OpenAIApiFactory = exports.OpenAIApiFp = exports.OpenAIApiAxiosParamCreator = void 0;
|
|
25
|
+
exports.OpenAIApi = exports.OpenAIApiFactory = exports.OpenAIApiFp = exports.OpenAIApiAxiosParamCreator = exports.CreateImageRequestResponseFormatEnum = exports.CreateImageRequestSizeEnum = exports.ChatCompletionResponseMessageRoleEnum = exports.ChatCompletionRequestMessageRoleEnum = void 0;
|
|
26
26
|
const axios_1 = require("axios");
|
|
27
27
|
// Some imports not used depending on template conditions
|
|
28
28
|
// @ts-ignore
|
|
29
29
|
const common_1 = require("./common");
|
|
30
30
|
// @ts-ignore
|
|
31
31
|
const base_1 = require("./base");
|
|
32
|
+
exports.ChatCompletionRequestMessageRoleEnum = {
|
|
33
|
+
System: 'system',
|
|
34
|
+
User: 'user',
|
|
35
|
+
Assistant: 'assistant'
|
|
36
|
+
};
|
|
37
|
+
exports.ChatCompletionResponseMessageRoleEnum = {
|
|
38
|
+
System: 'system',
|
|
39
|
+
User: 'user',
|
|
40
|
+
Assistant: 'assistant'
|
|
41
|
+
};
|
|
42
|
+
exports.CreateImageRequestSizeEnum = {
|
|
43
|
+
_256x256: '256x256',
|
|
44
|
+
_512x512: '512x512',
|
|
45
|
+
_1024x1024: '1024x1024'
|
|
46
|
+
};
|
|
47
|
+
exports.CreateImageRequestResponseFormatEnum = {
|
|
48
|
+
Url: 'url',
|
|
49
|
+
B64Json: 'b64_json'
|
|
50
|
+
};
|
|
32
51
|
/**
|
|
33
52
|
* OpenAIApi - axios parameter creator
|
|
34
53
|
* @export
|
|
@@ -95,6 +114,36 @@ exports.OpenAIApiAxiosParamCreator = function (configuration) {
|
|
|
95
114
|
options: localVarRequestOptions,
|
|
96
115
|
};
|
|
97
116
|
}),
|
|
117
|
+
/**
|
|
118
|
+
*
|
|
119
|
+
* @summary Creates a completion for the chat message
|
|
120
|
+
* @param {CreateChatCompletionRequest} createChatCompletionRequest
|
|
121
|
+
* @param {*} [options] Override http request option.
|
|
122
|
+
* @throws {RequiredError}
|
|
123
|
+
*/
|
|
124
|
+
createChatCompletion: (createChatCompletionRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
// verify required parameter 'createChatCompletionRequest' is not null or undefined
|
|
126
|
+
common_1.assertParamExists('createChatCompletion', 'createChatCompletionRequest', createChatCompletionRequest);
|
|
127
|
+
const localVarPath = `/chat/completions`;
|
|
128
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
129
|
+
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
130
|
+
let baseOptions;
|
|
131
|
+
if (configuration) {
|
|
132
|
+
baseOptions = configuration.baseOptions;
|
|
133
|
+
}
|
|
134
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
|
|
135
|
+
const localVarHeaderParameter = {};
|
|
136
|
+
const localVarQueryParameter = {};
|
|
137
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
138
|
+
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
139
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
140
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
|
141
|
+
localVarRequestOptions.data = common_1.serializeDataIfNeeded(createChatCompletionRequest, localVarRequestOptions, configuration);
|
|
142
|
+
return {
|
|
143
|
+
url: common_1.toPathString(localVarUrlObj),
|
|
144
|
+
options: localVarRequestOptions,
|
|
145
|
+
};
|
|
146
|
+
}),
|
|
98
147
|
/**
|
|
99
148
|
*
|
|
100
149
|
* @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.
|
|
@@ -158,7 +207,7 @@ exports.OpenAIApiAxiosParamCreator = function (configuration) {
|
|
|
158
207
|
}),
|
|
159
208
|
/**
|
|
160
209
|
*
|
|
161
|
-
* @summary Creates a new edit for the provided input, instruction, and parameters
|
|
210
|
+
* @summary Creates a new edit for the provided input, instruction, and parameters.
|
|
162
211
|
* @param {CreateEditRequest} createEditRequest
|
|
163
212
|
* @param {*} [options] Override http request option.
|
|
164
213
|
* @throws {RequiredError}
|
|
@@ -286,6 +335,146 @@ exports.OpenAIApiAxiosParamCreator = function (configuration) {
|
|
|
286
335
|
options: localVarRequestOptions,
|
|
287
336
|
};
|
|
288
337
|
}),
|
|
338
|
+
/**
|
|
339
|
+
*
|
|
340
|
+
* @summary Creates an image given a prompt.
|
|
341
|
+
* @param {CreateImageRequest} createImageRequest
|
|
342
|
+
* @param {*} [options] Override http request option.
|
|
343
|
+
* @throws {RequiredError}
|
|
344
|
+
*/
|
|
345
|
+
createImage: (createImageRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
346
|
+
// verify required parameter 'createImageRequest' is not null or undefined
|
|
347
|
+
common_1.assertParamExists('createImage', 'createImageRequest', createImageRequest);
|
|
348
|
+
const localVarPath = `/images/generations`;
|
|
349
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
350
|
+
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
351
|
+
let baseOptions;
|
|
352
|
+
if (configuration) {
|
|
353
|
+
baseOptions = configuration.baseOptions;
|
|
354
|
+
}
|
|
355
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
|
|
356
|
+
const localVarHeaderParameter = {};
|
|
357
|
+
const localVarQueryParameter = {};
|
|
358
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
359
|
+
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
360
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
361
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
|
362
|
+
localVarRequestOptions.data = common_1.serializeDataIfNeeded(createImageRequest, localVarRequestOptions, configuration);
|
|
363
|
+
return {
|
|
364
|
+
url: common_1.toPathString(localVarUrlObj),
|
|
365
|
+
options: localVarRequestOptions,
|
|
366
|
+
};
|
|
367
|
+
}),
|
|
368
|
+
/**
|
|
369
|
+
*
|
|
370
|
+
* @summary Creates an edited or extended image given an original image and a prompt.
|
|
371
|
+
* @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask.
|
|
372
|
+
* @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters.
|
|
373
|
+
* @param {File} [mask] An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.
|
|
374
|
+
* @param {number} [n] The number of images to generate. Must be between 1 and 10.
|
|
375
|
+
* @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
|
|
376
|
+
* @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`.
|
|
377
|
+
* @param {string} [user] A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
|
|
378
|
+
* @param {*} [options] Override http request option.
|
|
379
|
+
* @throws {RequiredError}
|
|
380
|
+
*/
|
|
381
|
+
createImageEdit: (image, prompt, mask, n, size, responseFormat, user, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
382
|
+
// verify required parameter 'image' is not null or undefined
|
|
383
|
+
common_1.assertParamExists('createImageEdit', 'image', image);
|
|
384
|
+
// verify required parameter 'prompt' is not null or undefined
|
|
385
|
+
common_1.assertParamExists('createImageEdit', 'prompt', prompt);
|
|
386
|
+
const localVarPath = `/images/edits`;
|
|
387
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
388
|
+
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
389
|
+
let baseOptions;
|
|
390
|
+
if (configuration) {
|
|
391
|
+
baseOptions = configuration.baseOptions;
|
|
392
|
+
}
|
|
393
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
|
|
394
|
+
const localVarHeaderParameter = {};
|
|
395
|
+
const localVarQueryParameter = {};
|
|
396
|
+
const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
|
|
397
|
+
if (image !== undefined) {
|
|
398
|
+
localVarFormParams.append('image', image);
|
|
399
|
+
}
|
|
400
|
+
if (mask !== undefined) {
|
|
401
|
+
localVarFormParams.append('mask', mask);
|
|
402
|
+
}
|
|
403
|
+
if (prompt !== undefined) {
|
|
404
|
+
localVarFormParams.append('prompt', prompt);
|
|
405
|
+
}
|
|
406
|
+
if (n !== undefined) {
|
|
407
|
+
localVarFormParams.append('n', n);
|
|
408
|
+
}
|
|
409
|
+
if (size !== undefined) {
|
|
410
|
+
localVarFormParams.append('size', size);
|
|
411
|
+
}
|
|
412
|
+
if (responseFormat !== undefined) {
|
|
413
|
+
localVarFormParams.append('response_format', responseFormat);
|
|
414
|
+
}
|
|
415
|
+
if (user !== undefined) {
|
|
416
|
+
localVarFormParams.append('user', user);
|
|
417
|
+
}
|
|
418
|
+
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
|
|
419
|
+
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
420
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
421
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), localVarFormParams.getHeaders()), headersFromBaseOptions), options.headers);
|
|
422
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
423
|
+
return {
|
|
424
|
+
url: common_1.toPathString(localVarUrlObj),
|
|
425
|
+
options: localVarRequestOptions,
|
|
426
|
+
};
|
|
427
|
+
}),
|
|
428
|
+
/**
|
|
429
|
+
*
|
|
430
|
+
* @summary Creates a variation of a given image.
|
|
431
|
+
* @param {File} image The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.
|
|
432
|
+
* @param {number} [n] The number of images to generate. Must be between 1 and 10.
|
|
433
|
+
* @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
|
|
434
|
+
* @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`.
|
|
435
|
+
* @param {string} [user] A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
|
|
436
|
+
* @param {*} [options] Override http request option.
|
|
437
|
+
* @throws {RequiredError}
|
|
438
|
+
*/
|
|
439
|
+
createImageVariation: (image, n, size, responseFormat, user, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
440
|
+
// verify required parameter 'image' is not null or undefined
|
|
441
|
+
common_1.assertParamExists('createImageVariation', 'image', image);
|
|
442
|
+
const localVarPath = `/images/variations`;
|
|
443
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
444
|
+
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
445
|
+
let baseOptions;
|
|
446
|
+
if (configuration) {
|
|
447
|
+
baseOptions = configuration.baseOptions;
|
|
448
|
+
}
|
|
449
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
|
|
450
|
+
const localVarHeaderParameter = {};
|
|
451
|
+
const localVarQueryParameter = {};
|
|
452
|
+
const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
|
|
453
|
+
if (image !== undefined) {
|
|
454
|
+
localVarFormParams.append('image', image);
|
|
455
|
+
}
|
|
456
|
+
if (n !== undefined) {
|
|
457
|
+
localVarFormParams.append('n', n);
|
|
458
|
+
}
|
|
459
|
+
if (size !== undefined) {
|
|
460
|
+
localVarFormParams.append('size', size);
|
|
461
|
+
}
|
|
462
|
+
if (responseFormat !== undefined) {
|
|
463
|
+
localVarFormParams.append('response_format', responseFormat);
|
|
464
|
+
}
|
|
465
|
+
if (user !== undefined) {
|
|
466
|
+
localVarFormParams.append('user', user);
|
|
467
|
+
}
|
|
468
|
+
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
|
|
469
|
+
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
470
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
471
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), localVarFormParams.getHeaders()), headersFromBaseOptions), options.headers);
|
|
472
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
473
|
+
return {
|
|
474
|
+
url: common_1.toPathString(localVarUrlObj),
|
|
475
|
+
options: localVarRequestOptions,
|
|
476
|
+
};
|
|
477
|
+
}),
|
|
289
478
|
/**
|
|
290
479
|
*
|
|
291
480
|
* @summary Classifies if text violates OpenAI\'s Content Policy
|
|
@@ -351,6 +540,110 @@ exports.OpenAIApiAxiosParamCreator = function (configuration) {
|
|
|
351
540
|
options: localVarRequestOptions,
|
|
352
541
|
};
|
|
353
542
|
}),
|
|
543
|
+
/**
|
|
544
|
+
*
|
|
545
|
+
* @summary Transcribes audio into the input language.
|
|
546
|
+
* @param {File} file The audio file to transcribe, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.
|
|
547
|
+
* @param {string} model ID of the model to use. Only `whisper-1` is currently available.
|
|
548
|
+
* @param {string} [prompt] An optional text to guide the model\\\'s style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should match the audio language.
|
|
549
|
+
* @param {string} [responseFormat] The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt.
|
|
550
|
+
* @param {number} [temperature] The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.
|
|
551
|
+
* @param {*} [options] Override http request option.
|
|
552
|
+
* @throws {RequiredError}
|
|
553
|
+
*/
|
|
554
|
+
createTranscription: (file, model, prompt, responseFormat, temperature, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
555
|
+
// verify required parameter 'file' is not null or undefined
|
|
556
|
+
common_1.assertParamExists('createTranscription', 'file', file);
|
|
557
|
+
// verify required parameter 'model' is not null or undefined
|
|
558
|
+
common_1.assertParamExists('createTranscription', 'model', model);
|
|
559
|
+
const localVarPath = `/audio/transcriptions`;
|
|
560
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
561
|
+
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
562
|
+
let baseOptions;
|
|
563
|
+
if (configuration) {
|
|
564
|
+
baseOptions = configuration.baseOptions;
|
|
565
|
+
}
|
|
566
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
|
|
567
|
+
const localVarHeaderParameter = {};
|
|
568
|
+
const localVarQueryParameter = {};
|
|
569
|
+
const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
|
|
570
|
+
if (file !== undefined) {
|
|
571
|
+
localVarFormParams.append('file', file);
|
|
572
|
+
}
|
|
573
|
+
if (model !== undefined) {
|
|
574
|
+
localVarFormParams.append('model', model);
|
|
575
|
+
}
|
|
576
|
+
if (prompt !== undefined) {
|
|
577
|
+
localVarFormParams.append('prompt', prompt);
|
|
578
|
+
}
|
|
579
|
+
if (responseFormat !== undefined) {
|
|
580
|
+
localVarFormParams.append('response_format', responseFormat);
|
|
581
|
+
}
|
|
582
|
+
if (temperature !== undefined) {
|
|
583
|
+
localVarFormParams.append('temperature', temperature);
|
|
584
|
+
}
|
|
585
|
+
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
|
|
586
|
+
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
587
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
588
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), localVarFormParams.getHeaders()), headersFromBaseOptions), options.headers);
|
|
589
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
590
|
+
return {
|
|
591
|
+
url: common_1.toPathString(localVarUrlObj),
|
|
592
|
+
options: localVarRequestOptions,
|
|
593
|
+
};
|
|
594
|
+
}),
|
|
595
|
+
/**
|
|
596
|
+
*
|
|
597
|
+
* @summary Translates audio into into English.
|
|
598
|
+
* @param {File} file The audio file to translate, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.
|
|
599
|
+
* @param {string} model ID of the model to use. Only `whisper-1` is currently available.
|
|
600
|
+
* @param {string} [prompt] An optional text to guide the model\\\'s style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should be in English.
|
|
601
|
+
* @param {string} [responseFormat] The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt.
|
|
602
|
+
* @param {number} [temperature] The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.
|
|
603
|
+
* @param {*} [options] Override http request option.
|
|
604
|
+
* @throws {RequiredError}
|
|
605
|
+
*/
|
|
606
|
+
createTranslation: (file, model, prompt, responseFormat, temperature, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
607
|
+
// verify required parameter 'file' is not null or undefined
|
|
608
|
+
common_1.assertParamExists('createTranslation', 'file', file);
|
|
609
|
+
// verify required parameter 'model' is not null or undefined
|
|
610
|
+
common_1.assertParamExists('createTranslation', 'model', model);
|
|
611
|
+
const localVarPath = `/audio/translations`;
|
|
612
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
613
|
+
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
614
|
+
let baseOptions;
|
|
615
|
+
if (configuration) {
|
|
616
|
+
baseOptions = configuration.baseOptions;
|
|
617
|
+
}
|
|
618
|
+
const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
|
|
619
|
+
const localVarHeaderParameter = {};
|
|
620
|
+
const localVarQueryParameter = {};
|
|
621
|
+
const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
|
|
622
|
+
if (file !== undefined) {
|
|
623
|
+
localVarFormParams.append('file', file);
|
|
624
|
+
}
|
|
625
|
+
if (model !== undefined) {
|
|
626
|
+
localVarFormParams.append('model', model);
|
|
627
|
+
}
|
|
628
|
+
if (prompt !== undefined) {
|
|
629
|
+
localVarFormParams.append('prompt', prompt);
|
|
630
|
+
}
|
|
631
|
+
if (responseFormat !== undefined) {
|
|
632
|
+
localVarFormParams.append('response_format', responseFormat);
|
|
633
|
+
}
|
|
634
|
+
if (temperature !== undefined) {
|
|
635
|
+
localVarFormParams.append('temperature', temperature);
|
|
636
|
+
}
|
|
637
|
+
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
|
|
638
|
+
common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
639
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
640
|
+
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), localVarFormParams.getHeaders()), headersFromBaseOptions), options.headers);
|
|
641
|
+
localVarRequestOptions.data = localVarFormParams;
|
|
642
|
+
return {
|
|
643
|
+
url: common_1.toPathString(localVarUrlObj),
|
|
644
|
+
options: localVarRequestOptions,
|
|
645
|
+
};
|
|
646
|
+
}),
|
|
354
647
|
/**
|
|
355
648
|
*
|
|
356
649
|
* @summary Delete a file.
|
|
@@ -725,6 +1018,19 @@ exports.OpenAIApiFp = function (configuration) {
|
|
|
725
1018
|
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
|
|
726
1019
|
});
|
|
727
1020
|
},
|
|
1021
|
+
/**
|
|
1022
|
+
*
|
|
1023
|
+
* @summary Creates a completion for the chat message
|
|
1024
|
+
* @param {CreateChatCompletionRequest} createChatCompletionRequest
|
|
1025
|
+
* @param {*} [options] Override http request option.
|
|
1026
|
+
* @throws {RequiredError}
|
|
1027
|
+
*/
|
|
1028
|
+
createChatCompletion(createChatCompletionRequest, options) {
|
|
1029
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1030
|
+
const localVarAxiosArgs = yield localVarAxiosParamCreator.createChatCompletion(createChatCompletionRequest, options);
|
|
1031
|
+
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
|
|
1032
|
+
});
|
|
1033
|
+
},
|
|
728
1034
|
/**
|
|
729
1035
|
*
|
|
730
1036
|
* @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.
|
|
@@ -754,7 +1060,7 @@ exports.OpenAIApiFp = function (configuration) {
|
|
|
754
1060
|
},
|
|
755
1061
|
/**
|
|
756
1062
|
*
|
|
757
|
-
* @summary Creates a new edit for the provided input, instruction, and parameters
|
|
1063
|
+
* @summary Creates a new edit for the provided input, instruction, and parameters.
|
|
758
1064
|
* @param {CreateEditRequest} createEditRequest
|
|
759
1065
|
* @param {*} [options] Override http request option.
|
|
760
1066
|
* @throws {RequiredError}
|
|
@@ -805,6 +1111,55 @@ exports.OpenAIApiFp = function (configuration) {
|
|
|
805
1111
|
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
|
|
806
1112
|
});
|
|
807
1113
|
},
|
|
1114
|
+
/**
|
|
1115
|
+
*
|
|
1116
|
+
* @summary Creates an image given a prompt.
|
|
1117
|
+
* @param {CreateImageRequest} createImageRequest
|
|
1118
|
+
* @param {*} [options] Override http request option.
|
|
1119
|
+
* @throws {RequiredError}
|
|
1120
|
+
*/
|
|
1121
|
+
createImage(createImageRequest, options) {
|
|
1122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1123
|
+
const localVarAxiosArgs = yield localVarAxiosParamCreator.createImage(createImageRequest, options);
|
|
1124
|
+
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
|
|
1125
|
+
});
|
|
1126
|
+
},
|
|
1127
|
+
/**
|
|
1128
|
+
*
|
|
1129
|
+
* @summary Creates an edited or extended image given an original image and a prompt.
|
|
1130
|
+
* @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask.
|
|
1131
|
+
* @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters.
|
|
1132
|
+
* @param {File} [mask] An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.
|
|
1133
|
+
* @param {number} [n] The number of images to generate. Must be between 1 and 10.
|
|
1134
|
+
* @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
|
|
1135
|
+
* @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`.
|
|
1136
|
+
* @param {string} [user] A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
|
|
1137
|
+
* @param {*} [options] Override http request option.
|
|
1138
|
+
* @throws {RequiredError}
|
|
1139
|
+
*/
|
|
1140
|
+
createImageEdit(image, prompt, mask, n, size, responseFormat, user, options) {
|
|
1141
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1142
|
+
const localVarAxiosArgs = yield localVarAxiosParamCreator.createImageEdit(image, prompt, mask, n, size, responseFormat, user, options);
|
|
1143
|
+
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
|
|
1144
|
+
});
|
|
1145
|
+
},
|
|
1146
|
+
/**
|
|
1147
|
+
*
|
|
1148
|
+
* @summary Creates a variation of a given image.
|
|
1149
|
+
* @param {File} image The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.
|
|
1150
|
+
* @param {number} [n] The number of images to generate. Must be between 1 and 10.
|
|
1151
|
+
* @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
|
|
1152
|
+
* @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`.
|
|
1153
|
+
* @param {string} [user] A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
|
|
1154
|
+
* @param {*} [options] Override http request option.
|
|
1155
|
+
* @throws {RequiredError}
|
|
1156
|
+
*/
|
|
1157
|
+
createImageVariation(image, n, size, responseFormat, user, options) {
|
|
1158
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1159
|
+
const localVarAxiosArgs = yield localVarAxiosParamCreator.createImageVariation(image, n, size, responseFormat, user, options);
|
|
1160
|
+
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
|
|
1161
|
+
});
|
|
1162
|
+
},
|
|
808
1163
|
/**
|
|
809
1164
|
*
|
|
810
1165
|
* @summary Classifies if text violates OpenAI\'s Content Policy
|
|
@@ -833,6 +1188,40 @@ exports.OpenAIApiFp = function (configuration) {
|
|
|
833
1188
|
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
|
|
834
1189
|
});
|
|
835
1190
|
},
|
|
1191
|
+
/**
|
|
1192
|
+
*
|
|
1193
|
+
* @summary Transcribes audio into the input language.
|
|
1194
|
+
* @param {File} file The audio file to transcribe, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.
|
|
1195
|
+
* @param {string} model ID of the model to use. Only `whisper-1` is currently available.
|
|
1196
|
+
* @param {string} [prompt] An optional text to guide the model\\\'s style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should match the audio language.
|
|
1197
|
+
* @param {string} [responseFormat] The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt.
|
|
1198
|
+
* @param {number} [temperature] The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.
|
|
1199
|
+
* @param {*} [options] Override http request option.
|
|
1200
|
+
* @throws {RequiredError}
|
|
1201
|
+
*/
|
|
1202
|
+
createTranscription(file, model, prompt, responseFormat, temperature, options) {
|
|
1203
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1204
|
+
const localVarAxiosArgs = yield localVarAxiosParamCreator.createTranscription(file, model, prompt, responseFormat, temperature, options);
|
|
1205
|
+
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
|
|
1206
|
+
});
|
|
1207
|
+
},
|
|
1208
|
+
/**
|
|
1209
|
+
*
|
|
1210
|
+
* @summary Translates audio into into English.
|
|
1211
|
+
* @param {File} file The audio file to translate, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.
|
|
1212
|
+
* @param {string} model ID of the model to use. Only `whisper-1` is currently available.
|
|
1213
|
+
* @param {string} [prompt] An optional text to guide the model\\\'s style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should be in English.
|
|
1214
|
+
* @param {string} [responseFormat] The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt.
|
|
1215
|
+
* @param {number} [temperature] The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.
|
|
1216
|
+
* @param {*} [options] Override http request option.
|
|
1217
|
+
* @throws {RequiredError}
|
|
1218
|
+
*/
|
|
1219
|
+
createTranslation(file, model, prompt, responseFormat, temperature, options) {
|
|
1220
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1221
|
+
const localVarAxiosArgs = yield localVarAxiosParamCreator.createTranslation(file, model, prompt, responseFormat, temperature, options);
|
|
1222
|
+
return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
|
|
1223
|
+
});
|
|
1224
|
+
},
|
|
836
1225
|
/**
|
|
837
1226
|
*
|
|
838
1227
|
* @summary Delete a file.
|
|
@@ -1018,6 +1407,16 @@ exports.OpenAIApiFactory = function (configuration, basePath, axios) {
|
|
|
1018
1407
|
createAnswer(createAnswerRequest, options) {
|
|
1019
1408
|
return localVarFp.createAnswer(createAnswerRequest, options).then((request) => request(axios, basePath));
|
|
1020
1409
|
},
|
|
1410
|
+
/**
|
|
1411
|
+
*
|
|
1412
|
+
* @summary Creates a completion for the chat message
|
|
1413
|
+
* @param {CreateChatCompletionRequest} createChatCompletionRequest
|
|
1414
|
+
* @param {*} [options] Override http request option.
|
|
1415
|
+
* @throws {RequiredError}
|
|
1416
|
+
*/
|
|
1417
|
+
createChatCompletion(createChatCompletionRequest, options) {
|
|
1418
|
+
return localVarFp.createChatCompletion(createChatCompletionRequest, options).then((request) => request(axios, basePath));
|
|
1419
|
+
},
|
|
1021
1420
|
/**
|
|
1022
1421
|
*
|
|
1023
1422
|
* @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.
|
|
@@ -1041,7 +1440,7 @@ exports.OpenAIApiFactory = function (configuration, basePath, axios) {
|
|
|
1041
1440
|
},
|
|
1042
1441
|
/**
|
|
1043
1442
|
*
|
|
1044
|
-
* @summary Creates a new edit for the provided input, instruction, and parameters
|
|
1443
|
+
* @summary Creates a new edit for the provided input, instruction, and parameters.
|
|
1045
1444
|
* @param {CreateEditRequest} createEditRequest
|
|
1046
1445
|
* @param {*} [options] Override http request option.
|
|
1047
1446
|
* @throws {RequiredError}
|
|
@@ -1080,6 +1479,46 @@ exports.OpenAIApiFactory = function (configuration, basePath, axios) {
|
|
|
1080
1479
|
createFineTune(createFineTuneRequest, options) {
|
|
1081
1480
|
return localVarFp.createFineTune(createFineTuneRequest, options).then((request) => request(axios, basePath));
|
|
1082
1481
|
},
|
|
1482
|
+
/**
|
|
1483
|
+
*
|
|
1484
|
+
* @summary Creates an image given a prompt.
|
|
1485
|
+
* @param {CreateImageRequest} createImageRequest
|
|
1486
|
+
* @param {*} [options] Override http request option.
|
|
1487
|
+
* @throws {RequiredError}
|
|
1488
|
+
*/
|
|
1489
|
+
createImage(createImageRequest, options) {
|
|
1490
|
+
return localVarFp.createImage(createImageRequest, options).then((request) => request(axios, basePath));
|
|
1491
|
+
},
|
|
1492
|
+
/**
|
|
1493
|
+
*
|
|
1494
|
+
* @summary Creates an edited or extended image given an original image and a prompt.
|
|
1495
|
+
* @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask.
|
|
1496
|
+
* @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters.
|
|
1497
|
+
* @param {File} [mask] An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.
|
|
1498
|
+
* @param {number} [n] The number of images to generate. Must be between 1 and 10.
|
|
1499
|
+
* @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
|
|
1500
|
+
* @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`.
|
|
1501
|
+
* @param {string} [user] A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
|
|
1502
|
+
* @param {*} [options] Override http request option.
|
|
1503
|
+
* @throws {RequiredError}
|
|
1504
|
+
*/
|
|
1505
|
+
createImageEdit(image, prompt, mask, n, size, responseFormat, user, options) {
|
|
1506
|
+
return localVarFp.createImageEdit(image, prompt, mask, n, size, responseFormat, user, options).then((request) => request(axios, basePath));
|
|
1507
|
+
},
|
|
1508
|
+
/**
|
|
1509
|
+
*
|
|
1510
|
+
* @summary Creates a variation of a given image.
|
|
1511
|
+
* @param {File} image The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.
|
|
1512
|
+
* @param {number} [n] The number of images to generate. Must be between 1 and 10.
|
|
1513
|
+
* @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
|
|
1514
|
+
* @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`.
|
|
1515
|
+
* @param {string} [user] A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
|
|
1516
|
+
* @param {*} [options] Override http request option.
|
|
1517
|
+
* @throws {RequiredError}
|
|
1518
|
+
*/
|
|
1519
|
+
createImageVariation(image, n, size, responseFormat, user, options) {
|
|
1520
|
+
return localVarFp.createImageVariation(image, n, size, responseFormat, user, options).then((request) => request(axios, basePath));
|
|
1521
|
+
},
|
|
1083
1522
|
/**
|
|
1084
1523
|
*
|
|
1085
1524
|
* @summary Classifies if text violates OpenAI\'s Content Policy
|
|
@@ -1102,6 +1541,34 @@ exports.OpenAIApiFactory = function (configuration, basePath, axios) {
|
|
|
1102
1541
|
createSearch(engineId, createSearchRequest, options) {
|
|
1103
1542
|
return localVarFp.createSearch(engineId, createSearchRequest, options).then((request) => request(axios, basePath));
|
|
1104
1543
|
},
|
|
1544
|
+
/**
|
|
1545
|
+
*
|
|
1546
|
+
* @summary Transcribes audio into the input language.
|
|
1547
|
+
* @param {File} file The audio file to transcribe, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.
|
|
1548
|
+
* @param {string} model ID of the model to use. Only `whisper-1` is currently available.
|
|
1549
|
+
* @param {string} [prompt] An optional text to guide the model\\\'s style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should match the audio language.
|
|
1550
|
+
* @param {string} [responseFormat] The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt.
|
|
1551
|
+
* @param {number} [temperature] The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.
|
|
1552
|
+
* @param {*} [options] Override http request option.
|
|
1553
|
+
* @throws {RequiredError}
|
|
1554
|
+
*/
|
|
1555
|
+
createTranscription(file, model, prompt, responseFormat, temperature, options) {
|
|
1556
|
+
return localVarFp.createTranscription(file, model, prompt, responseFormat, temperature, options).then((request) => request(axios, basePath));
|
|
1557
|
+
},
|
|
1558
|
+
/**
|
|
1559
|
+
*
|
|
1560
|
+
* @summary Translates audio into into English.
|
|
1561
|
+
* @param {File} file The audio file to translate, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.
|
|
1562
|
+
* @param {string} model ID of the model to use. Only `whisper-1` is currently available.
|
|
1563
|
+
* @param {string} [prompt] An optional text to guide the model\\\'s style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should be in English.
|
|
1564
|
+
* @param {string} [responseFormat] The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt.
|
|
1565
|
+
* @param {number} [temperature] The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.
|
|
1566
|
+
* @param {*} [options] Override http request option.
|
|
1567
|
+
* @throws {RequiredError}
|
|
1568
|
+
*/
|
|
1569
|
+
createTranslation(file, model, prompt, responseFormat, temperature, options) {
|
|
1570
|
+
return localVarFp.createTranslation(file, model, prompt, responseFormat, temperature, options).then((request) => request(axios, basePath));
|
|
1571
|
+
},
|
|
1105
1572
|
/**
|
|
1106
1573
|
*
|
|
1107
1574
|
* @summary Delete a file.
|
|
@@ -1253,6 +1720,17 @@ class OpenAIApi extends base_1.BaseAPI {
|
|
|
1253
1720
|
createAnswer(createAnswerRequest, options) {
|
|
1254
1721
|
return exports.OpenAIApiFp(this.configuration).createAnswer(createAnswerRequest, options).then((request) => request(this.axios, this.basePath));
|
|
1255
1722
|
}
|
|
1723
|
+
/**
|
|
1724
|
+
*
|
|
1725
|
+
* @summary Creates a completion for the chat message
|
|
1726
|
+
* @param {CreateChatCompletionRequest} createChatCompletionRequest
|
|
1727
|
+
* @param {*} [options] Override http request option.
|
|
1728
|
+
* @throws {RequiredError}
|
|
1729
|
+
* @memberof OpenAIApi
|
|
1730
|
+
*/
|
|
1731
|
+
createChatCompletion(createChatCompletionRequest, options) {
|
|
1732
|
+
return exports.OpenAIApiFp(this.configuration).createChatCompletion(createChatCompletionRequest, options).then((request) => request(this.axios, this.basePath));
|
|
1733
|
+
}
|
|
1256
1734
|
/**
|
|
1257
1735
|
*
|
|
1258
1736
|
* @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.
|
|
@@ -1278,7 +1756,7 @@ class OpenAIApi extends base_1.BaseAPI {
|
|
|
1278
1756
|
}
|
|
1279
1757
|
/**
|
|
1280
1758
|
*
|
|
1281
|
-
* @summary Creates a new edit for the provided input, instruction, and parameters
|
|
1759
|
+
* @summary Creates a new edit for the provided input, instruction, and parameters.
|
|
1282
1760
|
* @param {CreateEditRequest} createEditRequest
|
|
1283
1761
|
* @param {*} [options] Override http request option.
|
|
1284
1762
|
* @throws {RequiredError}
|
|
@@ -1321,6 +1799,49 @@ class OpenAIApi extends base_1.BaseAPI {
|
|
|
1321
1799
|
createFineTune(createFineTuneRequest, options) {
|
|
1322
1800
|
return exports.OpenAIApiFp(this.configuration).createFineTune(createFineTuneRequest, options).then((request) => request(this.axios, this.basePath));
|
|
1323
1801
|
}
|
|
1802
|
+
/**
|
|
1803
|
+
*
|
|
1804
|
+
* @summary Creates an image given a prompt.
|
|
1805
|
+
* @param {CreateImageRequest} createImageRequest
|
|
1806
|
+
* @param {*} [options] Override http request option.
|
|
1807
|
+
* @throws {RequiredError}
|
|
1808
|
+
* @memberof OpenAIApi
|
|
1809
|
+
*/
|
|
1810
|
+
createImage(createImageRequest, options) {
|
|
1811
|
+
return exports.OpenAIApiFp(this.configuration).createImage(createImageRequest, options).then((request) => request(this.axios, this.basePath));
|
|
1812
|
+
}
|
|
1813
|
+
/**
|
|
1814
|
+
*
|
|
1815
|
+
* @summary Creates an edited or extended image given an original image and a prompt.
|
|
1816
|
+
* @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask.
|
|
1817
|
+
* @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters.
|
|
1818
|
+
* @param {File} [mask] An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.
|
|
1819
|
+
* @param {number} [n] The number of images to generate. Must be between 1 and 10.
|
|
1820
|
+
* @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
|
|
1821
|
+
* @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`.
|
|
1822
|
+
* @param {string} [user] A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
|
|
1823
|
+
* @param {*} [options] Override http request option.
|
|
1824
|
+
* @throws {RequiredError}
|
|
1825
|
+
* @memberof OpenAIApi
|
|
1826
|
+
*/
|
|
1827
|
+
createImageEdit(image, prompt, mask, n, size, responseFormat, user, options) {
|
|
1828
|
+
return exports.OpenAIApiFp(this.configuration).createImageEdit(image, prompt, mask, n, size, responseFormat, user, options).then((request) => request(this.axios, this.basePath));
|
|
1829
|
+
}
|
|
1830
|
+
/**
|
|
1831
|
+
*
|
|
1832
|
+
* @summary Creates a variation of a given image.
|
|
1833
|
+
* @param {File} image The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.
|
|
1834
|
+
* @param {number} [n] The number of images to generate. Must be between 1 and 10.
|
|
1835
|
+
* @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
|
|
1836
|
+
* @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`.
|
|
1837
|
+
* @param {string} [user] A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
|
|
1838
|
+
* @param {*} [options] Override http request option.
|
|
1839
|
+
* @throws {RequiredError}
|
|
1840
|
+
* @memberof OpenAIApi
|
|
1841
|
+
*/
|
|
1842
|
+
createImageVariation(image, n, size, responseFormat, user, options) {
|
|
1843
|
+
return exports.OpenAIApiFp(this.configuration).createImageVariation(image, n, size, responseFormat, user, options).then((request) => request(this.axios, this.basePath));
|
|
1844
|
+
}
|
|
1324
1845
|
/**
|
|
1325
1846
|
*
|
|
1326
1847
|
* @summary Classifies if text violates OpenAI\'s Content Policy
|
|
@@ -1345,6 +1866,36 @@ class OpenAIApi extends base_1.BaseAPI {
|
|
|
1345
1866
|
createSearch(engineId, createSearchRequest, options) {
|
|
1346
1867
|
return exports.OpenAIApiFp(this.configuration).createSearch(engineId, createSearchRequest, options).then((request) => request(this.axios, this.basePath));
|
|
1347
1868
|
}
|
|
1869
|
+
/**
|
|
1870
|
+
*
|
|
1871
|
+
* @summary Transcribes audio into the input language.
|
|
1872
|
+
* @param {File} file The audio file to transcribe, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.
|
|
1873
|
+
* @param {string} model ID of the model to use. Only `whisper-1` is currently available.
|
|
1874
|
+
* @param {string} [prompt] An optional text to guide the model\\\'s style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should match the audio language.
|
|
1875
|
+
* @param {string} [responseFormat] The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt.
|
|
1876
|
+
* @param {number} [temperature] The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.
|
|
1877
|
+
* @param {*} [options] Override http request option.
|
|
1878
|
+
* @throws {RequiredError}
|
|
1879
|
+
* @memberof OpenAIApi
|
|
1880
|
+
*/
|
|
1881
|
+
createTranscription(file, model, prompt, responseFormat, temperature, options) {
|
|
1882
|
+
return exports.OpenAIApiFp(this.configuration).createTranscription(file, model, prompt, responseFormat, temperature, options).then((request) => request(this.axios, this.basePath));
|
|
1883
|
+
}
|
|
1884
|
+
/**
|
|
1885
|
+
*
|
|
1886
|
+
* @summary Translates audio into into English.
|
|
1887
|
+
* @param {File} file The audio file to translate, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.
|
|
1888
|
+
* @param {string} model ID of the model to use. Only `whisper-1` is currently available.
|
|
1889
|
+
* @param {string} [prompt] An optional text to guide the model\\\'s style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should be in English.
|
|
1890
|
+
* @param {string} [responseFormat] The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt.
|
|
1891
|
+
* @param {number} [temperature] The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.
|
|
1892
|
+
* @param {*} [options] Override http request option.
|
|
1893
|
+
* @throws {RequiredError}
|
|
1894
|
+
* @memberof OpenAIApi
|
|
1895
|
+
*/
|
|
1896
|
+
createTranslation(file, model, prompt, responseFormat, temperature, options) {
|
|
1897
|
+
return exports.OpenAIApiFp(this.configuration).createTranslation(file, model, prompt, responseFormat, temperature, options).then((request) => request(this.axios, this.basePath));
|
|
1898
|
+
}
|
|
1348
1899
|
/**
|
|
1349
1900
|
*
|
|
1350
1901
|
* @summary Delete a file.
|