openai 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * OpenAI API
3
3
  * APIs for sampling from and fine-tuning language models
4
4
  *
5
- * The version of the OpenAPI document: 1.0.6
5
+ * The version of the OpenAPI document: 1.1.0
6
6
  *
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -121,7 +121,7 @@ export interface CreateAnswerRequest {
121
121
  */
122
122
  'expand'?: Array<any> | null;
123
123
  /**
124
- * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse.
124
+ * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
125
125
  * @type {string}
126
126
  * @memberof CreateAnswerRequest
127
127
  */
@@ -280,7 +280,7 @@ export interface CreateClassificationRequest {
280
280
  */
281
281
  'expand'?: Array<any> | null;
282
282
  /**
283
- * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse.
283
+ * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
284
284
  * @type {string}
285
285
  * @memberof CreateClassificationRequest
286
286
  */
@@ -451,7 +451,7 @@ export interface CreateCompletionRequest {
451
451
  */
452
452
  'logit_bias'?: object | null;
453
453
  /**
454
- * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse.
454
+ * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
455
455
  * @type {string}
456
456
  * @memberof CreateCompletionRequest
457
457
  */
@@ -704,7 +704,7 @@ export interface CreateEmbeddingRequest {
704
704
  */
705
705
  'input': CreateEmbeddingRequestInput;
706
706
  /**
707
- * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse.
707
+ * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
708
708
  * @type {string}
709
709
  * @memberof CreateEmbeddingRequest
710
710
  */
@@ -870,6 +870,54 @@ export interface CreateFineTuneRequest {
870
870
  */
871
871
  'suffix'?: string | null;
872
872
  }
873
+ /**
874
+ *
875
+ * @export
876
+ * @interface CreateImageRequest
877
+ */
878
+ export interface CreateImageRequest {
879
+ /**
880
+ * A text description of the desired image(s). The maximum length is 1000 characters.
881
+ * @type {string}
882
+ * @memberof CreateImageRequest
883
+ */
884
+ 'prompt': string;
885
+ /**
886
+ * The number of images to generate. Must be between 1 and 10.
887
+ * @type {number}
888
+ * @memberof CreateImageRequest
889
+ */
890
+ 'n'?: number | null;
891
+ /**
892
+ * The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
893
+ * @type {string}
894
+ * @memberof CreateImageRequest
895
+ */
896
+ 'size'?: CreateImageRequestSizeEnum;
897
+ /**
898
+ * The format in which the generated images are returned. Must be one of `url` or `b64_json`.
899
+ * @type {string}
900
+ * @memberof CreateImageRequest
901
+ */
902
+ 'response_format'?: CreateImageRequestResponseFormatEnum;
903
+ /**
904
+ * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
905
+ * @type {string}
906
+ * @memberof CreateImageRequest
907
+ */
908
+ 'user'?: string;
909
+ }
910
+ export declare const CreateImageRequestSizeEnum: {
911
+ readonly _256x256: "256x256";
912
+ readonly _512x512: "512x512";
913
+ readonly _1024x1024: "1024x1024";
914
+ };
915
+ export declare type CreateImageRequestSizeEnum = typeof CreateImageRequestSizeEnum[keyof typeof CreateImageRequestSizeEnum];
916
+ export declare const CreateImageRequestResponseFormatEnum: {
917
+ readonly Url: "url";
918
+ readonly B64Json: "b64_json";
919
+ };
920
+ export declare type CreateImageRequestResponseFormatEnum = typeof CreateImageRequestResponseFormatEnum[keyof typeof CreateImageRequestResponseFormatEnum];
873
921
  /**
874
922
  *
875
923
  * @export
@@ -1080,7 +1128,7 @@ export interface CreateSearchRequest {
1080
1128
  */
1081
1129
  'return_metadata'?: boolean | null;
1082
1130
  /**
1083
- * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse.
1131
+ * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
1084
1132
  * @type {string}
1085
1133
  * @memberof CreateSearchRequest
1086
1134
  */
@@ -1333,6 +1381,44 @@ export interface FineTuneEvent {
1333
1381
  */
1334
1382
  'message': string;
1335
1383
  }
1384
+ /**
1385
+ *
1386
+ * @export
1387
+ * @interface ImagesResponse
1388
+ */
1389
+ export interface ImagesResponse {
1390
+ /**
1391
+ *
1392
+ * @type {number}
1393
+ * @memberof ImagesResponse
1394
+ */
1395
+ 'created': number;
1396
+ /**
1397
+ *
1398
+ * @type {Array<ImagesResponseDataInner>}
1399
+ * @memberof ImagesResponse
1400
+ */
1401
+ 'data': Array<ImagesResponseDataInner>;
1402
+ }
1403
+ /**
1404
+ *
1405
+ * @export
1406
+ * @interface ImagesResponseDataInner
1407
+ */
1408
+ export interface ImagesResponseDataInner {
1409
+ /**
1410
+ *
1411
+ * @type {string}
1412
+ * @memberof ImagesResponseDataInner
1413
+ */
1414
+ 'url'?: string;
1415
+ /**
1416
+ *
1417
+ * @type {string}
1418
+ * @memberof ImagesResponseDataInner
1419
+ */
1420
+ 'b64_json'?: string;
1421
+ }
1336
1422
  /**
1337
1423
  *
1338
1424
  * @export
@@ -1586,6 +1672,40 @@ export declare const OpenAIApiAxiosParamCreator: (configuration?: Configuration)
1586
1672
  * @throws {RequiredError}
1587
1673
  */
1588
1674
  createFineTune: (createFineTuneRequest: CreateFineTuneRequest, options?: AxiosRequestConfig) => Promise<RequestArgs>;
1675
+ /**
1676
+ *
1677
+ * @summary Creates an image given a prompt.
1678
+ * @param {CreateImageRequest} createImageRequest
1679
+ * @param {*} [options] Override http request option.
1680
+ * @throws {RequiredError}
1681
+ */
1682
+ createImage: (createImageRequest: CreateImageRequest, options?: AxiosRequestConfig) => Promise<RequestArgs>;
1683
+ /**
1684
+ *
1685
+ * @summary Creates an edited or extended image given an original image and a prompt.
1686
+ * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square.
1687
+ * @param {File} mask An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where &#x60;image&#x60; should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as &#x60;image&#x60;.
1688
+ * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters.
1689
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
1690
+ * @param {string} [size] The size of the generated images. Must be one of &#x60;256x256&#x60;, &#x60;512x512&#x60;, or &#x60;1024x1024&#x60;.
1691
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of &#x60;url&#x60; or &#x60;b64_json&#x60;.
1692
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
1693
+ * @param {*} [options] Override http request option.
1694
+ * @throws {RequiredError}
1695
+ */
1696
+ createImageEdit: (image: File, mask: File, prompt: string, n?: number, size?: string, responseFormat?: string, user?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
1697
+ /**
1698
+ *
1699
+ * @summary Creates a variation of a given image.
1700
+ * @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.
1701
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
1702
+ * @param {string} [size] The size of the generated images. Must be one of &#x60;256x256&#x60;, &#x60;512x512&#x60;, or &#x60;1024x1024&#x60;.
1703
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of &#x60;url&#x60; or &#x60;b64_json&#x60;.
1704
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
1705
+ * @param {*} [options] Override http request option.
1706
+ * @throws {RequiredError}
1707
+ */
1708
+ createImageVariation: (image: File, n?: number, size?: string, responseFormat?: string, user?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
1589
1709
  /**
1590
1710
  *
1591
1711
  * @summary Classifies if text violates OpenAI\'s Content Policy
@@ -1772,6 +1892,40 @@ export declare const OpenAIApiFp: (configuration?: Configuration) => {
1772
1892
  * @throws {RequiredError}
1773
1893
  */
1774
1894
  createFineTune(createFineTuneRequest: CreateFineTuneRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<FineTune>>;
1895
+ /**
1896
+ *
1897
+ * @summary Creates an image given a prompt.
1898
+ * @param {CreateImageRequest} createImageRequest
1899
+ * @param {*} [options] Override http request option.
1900
+ * @throws {RequiredError}
1901
+ */
1902
+ createImage(createImageRequest: CreateImageRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ImagesResponse>>;
1903
+ /**
1904
+ *
1905
+ * @summary Creates an edited or extended image given an original image and a prompt.
1906
+ * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square.
1907
+ * @param {File} mask An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where &#x60;image&#x60; should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as &#x60;image&#x60;.
1908
+ * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters.
1909
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
1910
+ * @param {string} [size] The size of the generated images. Must be one of &#x60;256x256&#x60;, &#x60;512x512&#x60;, or &#x60;1024x1024&#x60;.
1911
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of &#x60;url&#x60; or &#x60;b64_json&#x60;.
1912
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
1913
+ * @param {*} [options] Override http request option.
1914
+ * @throws {RequiredError}
1915
+ */
1916
+ createImageEdit(image: File, mask: File, prompt: string, n?: number, size?: string, responseFormat?: string, user?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ImagesResponse>>;
1917
+ /**
1918
+ *
1919
+ * @summary Creates a variation of a given image.
1920
+ * @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.
1921
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
1922
+ * @param {string} [size] The size of the generated images. Must be one of &#x60;256x256&#x60;, &#x60;512x512&#x60;, or &#x60;1024x1024&#x60;.
1923
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of &#x60;url&#x60; or &#x60;b64_json&#x60;.
1924
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
1925
+ * @param {*} [options] Override http request option.
1926
+ * @throws {RequiredError}
1927
+ */
1928
+ createImageVariation(image: File, n?: number, size?: string, responseFormat?: string, user?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ImagesResponse>>;
1775
1929
  /**
1776
1930
  *
1777
1931
  * @summary Classifies if text violates OpenAI\'s Content Policy
@@ -1958,6 +2112,40 @@ export declare const OpenAIApiFactory: (configuration?: Configuration, basePath?
1958
2112
  * @throws {RequiredError}
1959
2113
  */
1960
2114
  createFineTune(createFineTuneRequest: CreateFineTuneRequest, options?: any): AxiosPromise<FineTune>;
2115
+ /**
2116
+ *
2117
+ * @summary Creates an image given a prompt.
2118
+ * @param {CreateImageRequest} createImageRequest
2119
+ * @param {*} [options] Override http request option.
2120
+ * @throws {RequiredError}
2121
+ */
2122
+ createImage(createImageRequest: CreateImageRequest, options?: any): AxiosPromise<ImagesResponse>;
2123
+ /**
2124
+ *
2125
+ * @summary Creates an edited or extended image given an original image and a prompt.
2126
+ * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square.
2127
+ * @param {File} mask An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where &#x60;image&#x60; should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as &#x60;image&#x60;.
2128
+ * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters.
2129
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
2130
+ * @param {string} [size] The size of the generated images. Must be one of &#x60;256x256&#x60;, &#x60;512x512&#x60;, or &#x60;1024x1024&#x60;.
2131
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of &#x60;url&#x60; or &#x60;b64_json&#x60;.
2132
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
2133
+ * @param {*} [options] Override http request option.
2134
+ * @throws {RequiredError}
2135
+ */
2136
+ createImageEdit(image: File, mask: File, prompt: string, n?: number, size?: string, responseFormat?: string, user?: string, options?: any): AxiosPromise<ImagesResponse>;
2137
+ /**
2138
+ *
2139
+ * @summary Creates a variation of a given image.
2140
+ * @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.
2141
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
2142
+ * @param {string} [size] The size of the generated images. Must be one of &#x60;256x256&#x60;, &#x60;512x512&#x60;, or &#x60;1024x1024&#x60;.
2143
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of &#x60;url&#x60; or &#x60;b64_json&#x60;.
2144
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
2145
+ * @param {*} [options] Override http request option.
2146
+ * @throws {RequiredError}
2147
+ */
2148
+ createImageVariation(image: File, n?: number, size?: string, responseFormat?: string, user?: string, options?: any): AxiosPromise<ImagesResponse>;
1961
2149
  /**
1962
2150
  *
1963
2151
  * @summary Classifies if text violates OpenAI\'s Content Policy
@@ -2154,6 +2342,43 @@ export declare class OpenAIApi extends BaseAPI {
2154
2342
  * @memberof OpenAIApi
2155
2343
  */
2156
2344
  createFineTune(createFineTuneRequest: CreateFineTuneRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<FineTune, any>>;
2345
+ /**
2346
+ *
2347
+ * @summary Creates an image given a prompt.
2348
+ * @param {CreateImageRequest} createImageRequest
2349
+ * @param {*} [options] Override http request option.
2350
+ * @throws {RequiredError}
2351
+ * @memberof OpenAIApi
2352
+ */
2353
+ createImage(createImageRequest: CreateImageRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ImagesResponse, any>>;
2354
+ /**
2355
+ *
2356
+ * @summary Creates an edited or extended image given an original image and a prompt.
2357
+ * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square.
2358
+ * @param {File} mask An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where &#x60;image&#x60; should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as &#x60;image&#x60;.
2359
+ * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters.
2360
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
2361
+ * @param {string} [size] The size of the generated images. Must be one of &#x60;256x256&#x60;, &#x60;512x512&#x60;, or &#x60;1024x1024&#x60;.
2362
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of &#x60;url&#x60; or &#x60;b64_json&#x60;.
2363
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
2364
+ * @param {*} [options] Override http request option.
2365
+ * @throws {RequiredError}
2366
+ * @memberof OpenAIApi
2367
+ */
2368
+ createImageEdit(image: File, mask: File, prompt: string, n?: number, size?: string, responseFormat?: string, user?: string, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ImagesResponse, any>>;
2369
+ /**
2370
+ *
2371
+ * @summary Creates a variation of a given image.
2372
+ * @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.
2373
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
2374
+ * @param {string} [size] The size of the generated images. Must be one of &#x60;256x256&#x60;, &#x60;512x512&#x60;, or &#x60;1024x1024&#x60;.
2375
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of &#x60;url&#x60; or &#x60;b64_json&#x60;.
2376
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
2377
+ * @param {*} [options] Override http request option.
2378
+ * @throws {RequiredError}
2379
+ * @memberof OpenAIApi
2380
+ */
2381
+ createImageVariation(image: File, n?: number, size?: string, responseFormat?: string, user?: string, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ImagesResponse, any>>;
2157
2382
  /**
2158
2383
  *
2159
2384
  * @summary Classifies if text violates OpenAI\'s Content Policy
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.6
8
+ * The version of the OpenAPI document: 1.1.0
9
9
  *
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -22,13 +22,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  });
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.OpenAIApi = exports.OpenAIApiFactory = exports.OpenAIApiFp = exports.OpenAIApiAxiosParamCreator = void 0;
25
+ exports.OpenAIApi = exports.OpenAIApiFactory = exports.OpenAIApiFp = exports.OpenAIApiAxiosParamCreator = exports.CreateImageRequestResponseFormatEnum = exports.CreateImageRequestSizeEnum = void 0;
26
26
  const axios_1 = require("axios");
27
27
  // Some imports not used depending on template conditions
28
28
  // @ts-ignore
29
29
  const common_1 = require("./common");
30
30
  // @ts-ignore
31
31
  const base_1 = require("./base");
32
+ exports.CreateImageRequestSizeEnum = {
33
+ _256x256: '256x256',
34
+ _512x512: '512x512',
35
+ _1024x1024: '1024x1024'
36
+ };
37
+ exports.CreateImageRequestResponseFormatEnum = {
38
+ Url: 'url',
39
+ B64Json: 'b64_json'
40
+ };
32
41
  /**
33
42
  * OpenAIApi - axios parameter creator
34
43
  * @export
@@ -286,6 +295,148 @@ exports.OpenAIApiAxiosParamCreator = function (configuration) {
286
295
  options: localVarRequestOptions,
287
296
  };
288
297
  }),
298
+ /**
299
+ *
300
+ * @summary Creates an image given a prompt.
301
+ * @param {CreateImageRequest} createImageRequest
302
+ * @param {*} [options] Override http request option.
303
+ * @throws {RequiredError}
304
+ */
305
+ createImage: (createImageRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
306
+ // verify required parameter 'createImageRequest' is not null or undefined
307
+ common_1.assertParamExists('createImage', 'createImageRequest', createImageRequest);
308
+ const localVarPath = `/images/generations`;
309
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
310
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
311
+ let baseOptions;
312
+ if (configuration) {
313
+ baseOptions = configuration.baseOptions;
314
+ }
315
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
316
+ const localVarHeaderParameter = {};
317
+ const localVarQueryParameter = {};
318
+ localVarHeaderParameter['Content-Type'] = 'application/json';
319
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
320
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
321
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
322
+ localVarRequestOptions.data = common_1.serializeDataIfNeeded(createImageRequest, localVarRequestOptions, configuration);
323
+ return {
324
+ url: common_1.toPathString(localVarUrlObj),
325
+ options: localVarRequestOptions,
326
+ };
327
+ }),
328
+ /**
329
+ *
330
+ * @summary Creates an edited or extended image given an original image and a prompt.
331
+ * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square.
332
+ * @param {File} mask An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where &#x60;image&#x60; should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as &#x60;image&#x60;.
333
+ * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters.
334
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
335
+ * @param {string} [size] The size of the generated images. Must be one of &#x60;256x256&#x60;, &#x60;512x512&#x60;, or &#x60;1024x1024&#x60;.
336
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of &#x60;url&#x60; or &#x60;b64_json&#x60;.
337
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
338
+ * @param {*} [options] Override http request option.
339
+ * @throws {RequiredError}
340
+ */
341
+ createImageEdit: (image, mask, prompt, n, size, responseFormat, user, options = {}) => __awaiter(this, void 0, void 0, function* () {
342
+ // verify required parameter 'image' is not null or undefined
343
+ common_1.assertParamExists('createImageEdit', 'image', image);
344
+ // verify required parameter 'mask' is not null or undefined
345
+ common_1.assertParamExists('createImageEdit', 'mask', mask);
346
+ // verify required parameter 'prompt' is not null or undefined
347
+ common_1.assertParamExists('createImageEdit', 'prompt', prompt);
348
+ const localVarPath = `/images/edits`;
349
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
350
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
351
+ let baseOptions;
352
+ if (configuration) {
353
+ baseOptions = configuration.baseOptions;
354
+ }
355
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
356
+ const localVarHeaderParameter = {};
357
+ const localVarQueryParameter = {};
358
+ const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
359
+ if (image !== undefined) {
360
+ localVarFormParams.append('image', image);
361
+ }
362
+ if (mask !== undefined) {
363
+ localVarFormParams.append('mask', mask);
364
+ }
365
+ if (prompt !== undefined) {
366
+ localVarFormParams.append('prompt', prompt);
367
+ }
368
+ if (n !== undefined) {
369
+ localVarFormParams.append('n', n);
370
+ }
371
+ if (size !== undefined) {
372
+ localVarFormParams.append('size', size);
373
+ }
374
+ if (responseFormat !== undefined) {
375
+ localVarFormParams.append('response_format', responseFormat);
376
+ }
377
+ if (user !== undefined) {
378
+ localVarFormParams.append('user', user);
379
+ }
380
+ localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
381
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
382
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
383
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), localVarFormParams.getHeaders()), headersFromBaseOptions), options.headers);
384
+ localVarRequestOptions.data = localVarFormParams;
385
+ return {
386
+ url: common_1.toPathString(localVarUrlObj),
387
+ options: localVarRequestOptions,
388
+ };
389
+ }),
390
+ /**
391
+ *
392
+ * @summary Creates a variation of a given image.
393
+ * @param {File} image The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.
394
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
395
+ * @param {string} [size] The size of the generated images. Must be one of &#x60;256x256&#x60;, &#x60;512x512&#x60;, or &#x60;1024x1024&#x60;.
396
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of &#x60;url&#x60; or &#x60;b64_json&#x60;.
397
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
398
+ * @param {*} [options] Override http request option.
399
+ * @throws {RequiredError}
400
+ */
401
+ createImageVariation: (image, n, size, responseFormat, user, options = {}) => __awaiter(this, void 0, void 0, function* () {
402
+ // verify required parameter 'image' is not null or undefined
403
+ common_1.assertParamExists('createImageVariation', 'image', image);
404
+ const localVarPath = `/images/variations`;
405
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
406
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
407
+ let baseOptions;
408
+ if (configuration) {
409
+ baseOptions = configuration.baseOptions;
410
+ }
411
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
412
+ const localVarHeaderParameter = {};
413
+ const localVarQueryParameter = {};
414
+ const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
415
+ if (image !== undefined) {
416
+ localVarFormParams.append('image', image);
417
+ }
418
+ if (n !== undefined) {
419
+ localVarFormParams.append('n', n);
420
+ }
421
+ if (size !== undefined) {
422
+ localVarFormParams.append('size', size);
423
+ }
424
+ if (responseFormat !== undefined) {
425
+ localVarFormParams.append('response_format', responseFormat);
426
+ }
427
+ if (user !== undefined) {
428
+ localVarFormParams.append('user', user);
429
+ }
430
+ localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
431
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
432
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
433
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), localVarFormParams.getHeaders()), headersFromBaseOptions), options.headers);
434
+ localVarRequestOptions.data = localVarFormParams;
435
+ return {
436
+ url: common_1.toPathString(localVarUrlObj),
437
+ options: localVarRequestOptions,
438
+ };
439
+ }),
289
440
  /**
290
441
  *
291
442
  * @summary Classifies if text violates OpenAI\'s Content Policy
@@ -805,6 +956,55 @@ exports.OpenAIApiFp = function (configuration) {
805
956
  return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
806
957
  });
807
958
  },
959
+ /**
960
+ *
961
+ * @summary Creates an image given a prompt.
962
+ * @param {CreateImageRequest} createImageRequest
963
+ * @param {*} [options] Override http request option.
964
+ * @throws {RequiredError}
965
+ */
966
+ createImage(createImageRequest, options) {
967
+ return __awaiter(this, void 0, void 0, function* () {
968
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createImage(createImageRequest, options);
969
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
970
+ });
971
+ },
972
+ /**
973
+ *
974
+ * @summary Creates an edited or extended image given an original image and a prompt.
975
+ * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square.
976
+ * @param {File} mask An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where &#x60;image&#x60; should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as &#x60;image&#x60;.
977
+ * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters.
978
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
979
+ * @param {string} [size] The size of the generated images. Must be one of &#x60;256x256&#x60;, &#x60;512x512&#x60;, or &#x60;1024x1024&#x60;.
980
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of &#x60;url&#x60; or &#x60;b64_json&#x60;.
981
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
982
+ * @param {*} [options] Override http request option.
983
+ * @throws {RequiredError}
984
+ */
985
+ createImageEdit(image, mask, prompt, n, size, responseFormat, user, options) {
986
+ return __awaiter(this, void 0, void 0, function* () {
987
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createImageEdit(image, mask, prompt, n, size, responseFormat, user, options);
988
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
989
+ });
990
+ },
991
+ /**
992
+ *
993
+ * @summary Creates a variation of a given image.
994
+ * @param {File} image The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.
995
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
996
+ * @param {string} [size] The size of the generated images. Must be one of &#x60;256x256&#x60;, &#x60;512x512&#x60;, or &#x60;1024x1024&#x60;.
997
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of &#x60;url&#x60; or &#x60;b64_json&#x60;.
998
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
999
+ * @param {*} [options] Override http request option.
1000
+ * @throws {RequiredError}
1001
+ */
1002
+ createImageVariation(image, n, size, responseFormat, user, options) {
1003
+ return __awaiter(this, void 0, void 0, function* () {
1004
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createImageVariation(image, n, size, responseFormat, user, options);
1005
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
1006
+ });
1007
+ },
808
1008
  /**
809
1009
  *
810
1010
  * @summary Classifies if text violates OpenAI\'s Content Policy
@@ -1080,6 +1280,46 @@ exports.OpenAIApiFactory = function (configuration, basePath, axios) {
1080
1280
  createFineTune(createFineTuneRequest, options) {
1081
1281
  return localVarFp.createFineTune(createFineTuneRequest, options).then((request) => request(axios, basePath));
1082
1282
  },
1283
+ /**
1284
+ *
1285
+ * @summary Creates an image given a prompt.
1286
+ * @param {CreateImageRequest} createImageRequest
1287
+ * @param {*} [options] Override http request option.
1288
+ * @throws {RequiredError}
1289
+ */
1290
+ createImage(createImageRequest, options) {
1291
+ return localVarFp.createImage(createImageRequest, options).then((request) => request(axios, basePath));
1292
+ },
1293
+ /**
1294
+ *
1295
+ * @summary Creates an edited or extended image given an original image and a prompt.
1296
+ * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square.
1297
+ * @param {File} mask An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where &#x60;image&#x60; should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as &#x60;image&#x60;.
1298
+ * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters.
1299
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
1300
+ * @param {string} [size] The size of the generated images. Must be one of &#x60;256x256&#x60;, &#x60;512x512&#x60;, or &#x60;1024x1024&#x60;.
1301
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of &#x60;url&#x60; or &#x60;b64_json&#x60;.
1302
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
1303
+ * @param {*} [options] Override http request option.
1304
+ * @throws {RequiredError}
1305
+ */
1306
+ createImageEdit(image, mask, prompt, n, size, responseFormat, user, options) {
1307
+ return localVarFp.createImageEdit(image, mask, prompt, n, size, responseFormat, user, options).then((request) => request(axios, basePath));
1308
+ },
1309
+ /**
1310
+ *
1311
+ * @summary Creates a variation of a given image.
1312
+ * @param {File} image The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.
1313
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
1314
+ * @param {string} [size] The size of the generated images. Must be one of &#x60;256x256&#x60;, &#x60;512x512&#x60;, or &#x60;1024x1024&#x60;.
1315
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of &#x60;url&#x60; or &#x60;b64_json&#x60;.
1316
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
1317
+ * @param {*} [options] Override http request option.
1318
+ * @throws {RequiredError}
1319
+ */
1320
+ createImageVariation(image, n, size, responseFormat, user, options) {
1321
+ return localVarFp.createImageVariation(image, n, size, responseFormat, user, options).then((request) => request(axios, basePath));
1322
+ },
1083
1323
  /**
1084
1324
  *
1085
1325
  * @summary Classifies if text violates OpenAI\'s Content Policy
@@ -1321,6 +1561,49 @@ class OpenAIApi extends base_1.BaseAPI {
1321
1561
  createFineTune(createFineTuneRequest, options) {
1322
1562
  return exports.OpenAIApiFp(this.configuration).createFineTune(createFineTuneRequest, options).then((request) => request(this.axios, this.basePath));
1323
1563
  }
1564
+ /**
1565
+ *
1566
+ * @summary Creates an image given a prompt.
1567
+ * @param {CreateImageRequest} createImageRequest
1568
+ * @param {*} [options] Override http request option.
1569
+ * @throws {RequiredError}
1570
+ * @memberof OpenAIApi
1571
+ */
1572
+ createImage(createImageRequest, options) {
1573
+ return exports.OpenAIApiFp(this.configuration).createImage(createImageRequest, options).then((request) => request(this.axios, this.basePath));
1574
+ }
1575
+ /**
1576
+ *
1577
+ * @summary Creates an edited or extended image given an original image and a prompt.
1578
+ * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square.
1579
+ * @param {File} mask An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where &#x60;image&#x60; should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as &#x60;image&#x60;.
1580
+ * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters.
1581
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
1582
+ * @param {string} [size] The size of the generated images. Must be one of &#x60;256x256&#x60;, &#x60;512x512&#x60;, or &#x60;1024x1024&#x60;.
1583
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of &#x60;url&#x60; or &#x60;b64_json&#x60;.
1584
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
1585
+ * @param {*} [options] Override http request option.
1586
+ * @throws {RequiredError}
1587
+ * @memberof OpenAIApi
1588
+ */
1589
+ createImageEdit(image, mask, prompt, n, size, responseFormat, user, options) {
1590
+ return exports.OpenAIApiFp(this.configuration).createImageEdit(image, mask, prompt, n, size, responseFormat, user, options).then((request) => request(this.axios, this.basePath));
1591
+ }
1592
+ /**
1593
+ *
1594
+ * @summary Creates a variation of a given image.
1595
+ * @param {File} image The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.
1596
+ * @param {number} [n] The number of images to generate. Must be between 1 and 10.
1597
+ * @param {string} [size] The size of the generated images. Must be one of &#x60;256x256&#x60;, &#x60;512x512&#x60;, or &#x60;1024x1024&#x60;.
1598
+ * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of &#x60;url&#x60; or &#x60;b64_json&#x60;.
1599
+ * @param {string} [user] A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids).
1600
+ * @param {*} [options] Override http request option.
1601
+ * @throws {RequiredError}
1602
+ * @memberof OpenAIApi
1603
+ */
1604
+ createImageVariation(image, n, size, responseFormat, user, options) {
1605
+ return exports.OpenAIApiFp(this.configuration).createImageVariation(image, n, size, responseFormat, user, options).then((request) => request(this.axios, this.basePath));
1606
+ }
1324
1607
  /**
1325
1608
  *
1326
1609
  * @summary Classifies if text violates OpenAI\'s Content Policy
package/dist/base.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * OpenAI API
3
3
  * APIs for sampling from and fine-tuning language models
4
4
  *
5
- * The version of the OpenAPI document: 1.0.6
5
+ * The version of the OpenAPI document: 1.1.0
6
6
  *
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).