From 3d4b222732fc497fba6d6a212b4460263f92d89b Mon Sep 17 00:00:00 2001 From: Rajeev Nayak Date: Wed, 2 Nov 2022 15:29:12 -0700 Subject: [PATCH] spec 1.1.0 + build --- .openapi-generator/VERSION | 2 +- api.ts | 403 ++++++++++++++++++++++++++++++++++++- base.ts | 2 +- common.ts | 2 +- configuration.ts | 2 +- dist/api.d.ts | 237 +++++++++++++++++++++- dist/api.js | 287 +++++++++++++++++++++++++- dist/base.d.ts | 2 +- dist/base.js | 2 +- dist/common.d.ts | 2 +- dist/common.js | 2 +- dist/configuration.d.ts | 2 +- dist/configuration.js | 2 +- dist/index.d.ts | 2 +- dist/index.js | 2 +- index.ts | 2 +- 16 files changed, 926 insertions(+), 27 deletions(-) diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 4ac4fded..0df17dd0 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -6.2.0 \ No newline at end of file +6.2.1 \ No newline at end of file diff --git a/api.ts b/api.ts index 01945e7c..8e83852e 100644 --- a/api.ts +++ b/api.ts @@ -4,7 +4,7 @@ * OpenAI API * APIs for sampling from and fine-tuning language models * - * The version of the OpenAPI document: 1.0.6 + * The version of the OpenAPI document: 1.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -130,7 +130,7 @@ export interface CreateAnswerRequest { */ 'expand'?: Array | null; /** - * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. + * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids). * @type {string} * @memberof CreateAnswerRequest */ @@ -290,7 +290,7 @@ export interface CreateClassificationRequest { */ 'expand'?: Array | null; /** - * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. + * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids). * @type {string} * @memberof CreateClassificationRequest */ @@ -461,7 +461,7 @@ export interface CreateCompletionRequest { */ 'logit_bias'?: object | null; /** - * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. + * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids). * @type {string} * @memberof CreateCompletionRequest */ @@ -716,7 +716,7 @@ export interface CreateEmbeddingRequest { */ 'input': CreateEmbeddingRequestInput; /** - * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. + * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids). * @type {string} * @memberof CreateEmbeddingRequest */ @@ -883,6 +883,58 @@ export interface CreateFineTuneRequest { */ 'suffix'?: string | null; } +/** + * + * @export + * @interface CreateImageRequest + */ +export interface CreateImageRequest { + /** + * A text description of the desired image(s). The maximum length is 1000 characters. + * @type {string} + * @memberof CreateImageRequest + */ + 'prompt': string; + /** + * The number of images to generate. Must be between 1 and 10. + * @type {number} + * @memberof CreateImageRequest + */ + 'n'?: number | null; + /** + * The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @type {string} + * @memberof CreateImageRequest + */ + 'size'?: CreateImageRequestSizeEnum; + /** + * The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @type {string} + * @memberof CreateImageRequest + */ + 'response_format'?: CreateImageRequestResponseFormatEnum; + /** + * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids). + * @type {string} + * @memberof CreateImageRequest + */ + 'user'?: string; +} + +export const CreateImageRequestSizeEnum = { + _256x256: '256x256', + _512x512: '512x512', + _1024x1024: '1024x1024' +} as const; + +export type CreateImageRequestSizeEnum = typeof CreateImageRequestSizeEnum[keyof typeof CreateImageRequestSizeEnum]; +export const CreateImageRequestResponseFormatEnum = { + Url: 'url', + B64Json: 'b64_json' +} as const; + +export type CreateImageRequestResponseFormatEnum = typeof CreateImageRequestResponseFormatEnum[keyof typeof CreateImageRequestResponseFormatEnum]; + /** * * @export @@ -1094,7 +1146,7 @@ export interface CreateSearchRequest { */ 'return_metadata'?: boolean | null; /** - * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. + * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids). * @type {string} * @memberof CreateSearchRequest */ @@ -1347,6 +1399,44 @@ export interface FineTuneEvent { */ 'message': string; } +/** + * + * @export + * @interface ImagesResponse + */ +export interface ImagesResponse { + /** + * + * @type {number} + * @memberof ImagesResponse + */ + 'created': number; + /** + * + * @type {Array} + * @memberof ImagesResponse + */ + 'data': Array; +} +/** + * + * @export + * @interface ImagesResponseDataInner + */ +export interface ImagesResponseDataInner { + /** + * + * @type {string} + * @memberof ImagesResponseDataInner + */ + 'url'?: string; + /** + * + * @type {string} + * @memberof ImagesResponseDataInner + */ + 'b64_json'?: string; +} /** * * @export @@ -1835,6 +1925,178 @@ export const OpenAIApiAxiosParamCreator = function (configuration?: Configuratio options: localVarRequestOptions, }; }, + /** + * + * @summary Creates an image given a prompt. + * @param {CreateImageRequest} createImageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImage: async (createImageRequest: CreateImageRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'createImageRequest' is not null or undefined + assertParamExists('createImage', 'createImageRequest', createImageRequest) + const localVarPath = `/images/generations`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(createImageRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Creates an edited or extended image given an original image and a prompt. + * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square. + * @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`. + * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImageEdit: async (image: File, mask: File, prompt: string, n?: number, size?: string, responseFormat?: string, user?: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'image' is not null or undefined + assertParamExists('createImageEdit', 'image', image) + // verify required parameter 'mask' is not null or undefined + assertParamExists('createImageEdit', 'mask', mask) + // verify required parameter 'prompt' is not null or undefined + assertParamExists('createImageEdit', 'prompt', prompt) + const localVarPath = `/images/edits`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)(); + + + if (image !== undefined) { + localVarFormParams.append('image', image as any); + } + + if (mask !== undefined) { + localVarFormParams.append('mask', mask as any); + } + + if (prompt !== undefined) { + localVarFormParams.append('prompt', prompt as any); + } + + if (n !== undefined) { + localVarFormParams.append('n', n as any); + } + + if (size !== undefined) { + localVarFormParams.append('size', size as any); + } + + if (responseFormat !== undefined) { + localVarFormParams.append('response_format', responseFormat as any); + } + + if (user !== undefined) { + localVarFormParams.append('user', user as any); + } + + + localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...localVarFormParams.getHeaders(), ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = localVarFormParams; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Creates a variation of a given image. + * @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. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImageVariation: async (image: File, n?: number, size?: string, responseFormat?: string, user?: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'image' is not null or undefined + assertParamExists('createImageVariation', 'image', image) + const localVarPath = `/images/variations`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)(); + + + if (image !== undefined) { + localVarFormParams.append('image', image as any); + } + + if (n !== undefined) { + localVarFormParams.append('n', n as any); + } + + if (size !== undefined) { + localVarFormParams.append('size', size as any); + } + + if (responseFormat !== undefined) { + localVarFormParams.append('response_format', responseFormat as any); + } + + if (user !== undefined) { + localVarFormParams.append('user', user as any); + } + + + localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...localVarFormParams.getHeaders(), ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = localVarFormParams; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @summary Classifies if text violates OpenAI\'s Content Policy @@ -2412,6 +2674,49 @@ export const OpenAIApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.createFineTune(createFineTuneRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @summary Creates an image given a prompt. + * @param {CreateImageRequest} createImageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createImage(createImageRequest: CreateImageRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createImage(createImageRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary Creates an edited or extended image given an original image and a prompt. + * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square. + * @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`. + * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createImageEdit(image: File, mask: File, prompt: string, n?: number, size?: string, responseFormat?: string, user?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createImageEdit(image, mask, prompt, n, size, responseFormat, user, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary Creates a variation of a given image. + * @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. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createImageVariation(image: File, n?: number, size?: string, responseFormat?: string, user?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createImageVariation(image, n, size, responseFormat, user, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @summary Classifies if text violates OpenAI\'s Content Policy @@ -2660,6 +2965,46 @@ export const OpenAIApiFactory = function (configuration?: Configuration, basePat createFineTune(createFineTuneRequest: CreateFineTuneRequest, options?: any): AxiosPromise { return localVarFp.createFineTune(createFineTuneRequest, options).then((request) => request(axios, basePath)); }, + /** + * + * @summary Creates an image given a prompt. + * @param {CreateImageRequest} createImageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImage(createImageRequest: CreateImageRequest, options?: any): AxiosPromise { + return localVarFp.createImage(createImageRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Creates an edited or extended image given an original image and a prompt. + * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square. + * @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`. + * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImageEdit(image: File, mask: File, prompt: string, n?: number, size?: string, responseFormat?: string, user?: string, options?: any): AxiosPromise { + return localVarFp.createImageEdit(image, mask, prompt, n, size, responseFormat, user, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Creates a variation of a given image. + * @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. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImageVariation(image: File, n?: number, size?: string, responseFormat?: string, user?: string, options?: any): AxiosPromise { + return localVarFp.createImageVariation(image, n, size, responseFormat, user, options).then((request) => request(axios, basePath)); + }, /** * * @summary Classifies if text violates OpenAI\'s Content Policy @@ -2910,6 +3255,52 @@ export class OpenAIApi extends BaseAPI { return OpenAIApiFp(this.configuration).createFineTune(createFineTuneRequest, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @summary Creates an image given a prompt. + * @param {CreateImageRequest} createImageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OpenAIApi + */ + public createImage(createImageRequest: CreateImageRequest, options?: AxiosRequestConfig) { + return OpenAIApiFp(this.configuration).createImage(createImageRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Creates an edited or extended image given an original image and a prompt. + * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square. + * @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`. + * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OpenAIApi + */ + public createImageEdit(image: File, mask: File, prompt: string, n?: number, size?: string, responseFormat?: string, user?: string, options?: AxiosRequestConfig) { + return OpenAIApiFp(this.configuration).createImageEdit(image, mask, prompt, n, size, responseFormat, user, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Creates a variation of a given image. + * @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. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OpenAIApi + */ + public createImageVariation(image: File, n?: number, size?: string, responseFormat?: string, user?: string, options?: AxiosRequestConfig) { + return OpenAIApiFp(this.configuration).createImageVariation(image, n, size, responseFormat, user, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @summary Classifies if text violates OpenAI\'s Content Policy diff --git a/base.ts b/base.ts index 3f3c926f..231329cf 100644 --- a/base.ts +++ b/base.ts @@ -4,7 +4,7 @@ * OpenAI API * APIs for sampling from and fine-tuning language models * - * The version of the OpenAPI document: 1.0.6 + * The version of the OpenAPI document: 1.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/common.ts b/common.ts index dccf6868..3bc7c137 100644 --- a/common.ts +++ b/common.ts @@ -4,7 +4,7 @@ * OpenAI API * APIs for sampling from and fine-tuning language models * - * The version of the OpenAPI document: 1.0.6 + * The version of the OpenAPI document: 1.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/configuration.ts b/configuration.ts index b7f17a12..b8992474 100644 --- a/configuration.ts +++ b/configuration.ts @@ -4,7 +4,7 @@ * OpenAI API * APIs for sampling from and fine-tuning language models * - * The version of the OpenAPI document: 1.0.6 + * The version of the OpenAPI document: 1.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/dist/api.d.ts b/dist/api.d.ts index 2d02de20..0e589cfa 100644 --- a/dist/api.d.ts +++ b/dist/api.d.ts @@ -2,7 +2,7 @@ * OpenAI API * APIs for sampling from and fine-tuning language models * - * The version of the OpenAPI document: 1.0.6 + * The version of the OpenAPI document: 1.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -121,7 +121,7 @@ export interface CreateAnswerRequest { */ 'expand'?: Array | null; /** - * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. + * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids). * @type {string} * @memberof CreateAnswerRequest */ @@ -280,7 +280,7 @@ export interface CreateClassificationRequest { */ 'expand'?: Array | null; /** - * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. + * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids). * @type {string} * @memberof CreateClassificationRequest */ @@ -451,7 +451,7 @@ export interface CreateCompletionRequest { */ 'logit_bias'?: object | null; /** - * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. + * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids). * @type {string} * @memberof CreateCompletionRequest */ @@ -704,7 +704,7 @@ export interface CreateEmbeddingRequest { */ 'input': CreateEmbeddingRequestInput; /** - * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. + * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids). * @type {string} * @memberof CreateEmbeddingRequest */ @@ -870,6 +870,54 @@ export interface CreateFineTuneRequest { */ 'suffix'?: string | null; } +/** + * + * @export + * @interface CreateImageRequest + */ +export interface CreateImageRequest { + /** + * A text description of the desired image(s). The maximum length is 1000 characters. + * @type {string} + * @memberof CreateImageRequest + */ + 'prompt': string; + /** + * The number of images to generate. Must be between 1 and 10. + * @type {number} + * @memberof CreateImageRequest + */ + 'n'?: number | null; + /** + * The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @type {string} + * @memberof CreateImageRequest + */ + 'size'?: CreateImageRequestSizeEnum; + /** + * The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @type {string} + * @memberof CreateImageRequest + */ + 'response_format'?: CreateImageRequestResponseFormatEnum; + /** + * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids). + * @type {string} + * @memberof CreateImageRequest + */ + 'user'?: string; +} +export declare const CreateImageRequestSizeEnum: { + readonly _256x256: "256x256"; + readonly _512x512: "512x512"; + readonly _1024x1024: "1024x1024"; +}; +export declare type CreateImageRequestSizeEnum = typeof CreateImageRequestSizeEnum[keyof typeof CreateImageRequestSizeEnum]; +export declare const CreateImageRequestResponseFormatEnum: { + readonly Url: "url"; + readonly B64Json: "b64_json"; +}; +export declare type CreateImageRequestResponseFormatEnum = typeof CreateImageRequestResponseFormatEnum[keyof typeof CreateImageRequestResponseFormatEnum]; /** * * @export @@ -1080,7 +1128,7 @@ export interface CreateSearchRequest { */ 'return_metadata'?: boolean | null; /** - * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. + * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. [Learn more](/docs/usage-policies/end-user-ids). * @type {string} * @memberof CreateSearchRequest */ @@ -1333,6 +1381,44 @@ export interface FineTuneEvent { */ 'message': string; } +/** + * + * @export + * @interface ImagesResponse + */ +export interface ImagesResponse { + /** + * + * @type {number} + * @memberof ImagesResponse + */ + 'created': number; + /** + * + * @type {Array} + * @memberof ImagesResponse + */ + 'data': Array; +} +/** + * + * @export + * @interface ImagesResponseDataInner + */ +export interface ImagesResponseDataInner { + /** + * + * @type {string} + * @memberof ImagesResponseDataInner + */ + 'url'?: string; + /** + * + * @type {string} + * @memberof ImagesResponseDataInner + */ + 'b64_json'?: string; +} /** * * @export @@ -1586,6 +1672,40 @@ export declare const OpenAIApiAxiosParamCreator: (configuration?: Configuration) * @throws {RequiredError} */ createFineTune: (createFineTuneRequest: CreateFineTuneRequest, options?: AxiosRequestConfig) => Promise; + /** + * + * @summary Creates an image given a prompt. + * @param {CreateImageRequest} createImageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImage: (createImageRequest: CreateImageRequest, options?: AxiosRequestConfig) => Promise; + /** + * + * @summary Creates an edited or extended image given an original image and a prompt. + * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square. + * @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`. + * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImageEdit: (image: File, mask: File, prompt: string, n?: number, size?: string, responseFormat?: string, user?: string, options?: AxiosRequestConfig) => Promise; + /** + * + * @summary Creates a variation of a given image. + * @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. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImageVariation: (image: File, n?: number, size?: string, responseFormat?: string, user?: string, options?: AxiosRequestConfig) => Promise; /** * * @summary Classifies if text violates OpenAI\'s Content Policy @@ -1772,6 +1892,40 @@ export declare const OpenAIApiFp: (configuration?: Configuration) => { * @throws {RequiredError} */ createFineTune(createFineTuneRequest: CreateFineTuneRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>; + /** + * + * @summary Creates an image given a prompt. + * @param {CreateImageRequest} createImageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImage(createImageRequest: CreateImageRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>; + /** + * + * @summary Creates an edited or extended image given an original image and a prompt. + * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square. + * @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`. + * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImageEdit(image: File, mask: File, prompt: string, n?: number, size?: string, responseFormat?: string, user?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>; + /** + * + * @summary Creates a variation of a given image. + * @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. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImageVariation(image: File, n?: number, size?: string, responseFormat?: string, user?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>; /** * * @summary Classifies if text violates OpenAI\'s Content Policy @@ -1958,6 +2112,40 @@ export declare const OpenAIApiFactory: (configuration?: Configuration, basePath? * @throws {RequiredError} */ createFineTune(createFineTuneRequest: CreateFineTuneRequest, options?: any): AxiosPromise; + /** + * + * @summary Creates an image given a prompt. + * @param {CreateImageRequest} createImageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImage(createImageRequest: CreateImageRequest, options?: any): AxiosPromise; + /** + * + * @summary Creates an edited or extended image given an original image and a prompt. + * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square. + * @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`. + * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImageEdit(image: File, mask: File, prompt: string, n?: number, size?: string, responseFormat?: string, user?: string, options?: any): AxiosPromise; + /** + * + * @summary Creates a variation of a given image. + * @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. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImageVariation(image: File, n?: number, size?: string, responseFormat?: string, user?: string, options?: any): AxiosPromise; /** * * @summary Classifies if text violates OpenAI\'s Content Policy @@ -2154,6 +2342,43 @@ export declare class OpenAIApi extends BaseAPI { * @memberof OpenAIApi */ createFineTune(createFineTuneRequest: CreateFineTuneRequest, options?: AxiosRequestConfig): Promise>; + /** + * + * @summary Creates an image given a prompt. + * @param {CreateImageRequest} createImageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OpenAIApi + */ + createImage(createImageRequest: CreateImageRequest, options?: AxiosRequestConfig): Promise>; + /** + * + * @summary Creates an edited or extended image given an original image and a prompt. + * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square. + * @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`. + * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OpenAIApi + */ + createImageEdit(image: File, mask: File, prompt: string, n?: number, size?: string, responseFormat?: string, user?: string, options?: AxiosRequestConfig): Promise>; + /** + * + * @summary Creates a variation of a given image. + * @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. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OpenAIApi + */ + createImageVariation(image: File, n?: number, size?: string, responseFormat?: string, user?: string, options?: AxiosRequestConfig): Promise>; /** * * @summary Classifies if text violates OpenAI\'s Content Policy diff --git a/dist/api.js b/dist/api.js index 644a5c8b..e678085c 100644 --- a/dist/api.js +++ b/dist/api.js @@ -5,7 +5,7 @@ * OpenAI API * APIs for sampling from and fine-tuning language models * - * The version of the OpenAPI document: 1.0.6 + * The version of the OpenAPI document: 1.1.0 * * * 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 }); }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.OpenAIApi = exports.OpenAIApiFactory = exports.OpenAIApiFp = exports.OpenAIApiAxiosParamCreator = void 0; +exports.OpenAIApi = exports.OpenAIApiFactory = exports.OpenAIApiFp = exports.OpenAIApiAxiosParamCreator = exports.CreateImageRequestResponseFormatEnum = exports.CreateImageRequestSizeEnum = void 0; const axios_1 = require("axios"); // Some imports not used depending on template conditions // @ts-ignore const common_1 = require("./common"); // @ts-ignore const base_1 = require("./base"); +exports.CreateImageRequestSizeEnum = { + _256x256: '256x256', + _512x512: '512x512', + _1024x1024: '1024x1024' +}; +exports.CreateImageRequestResponseFormatEnum = { + Url: 'url', + B64Json: 'b64_json' +}; /** * OpenAIApi - axios parameter creator * @export @@ -286,6 +295,148 @@ exports.OpenAIApiAxiosParamCreator = function (configuration) { options: localVarRequestOptions, }; }), + /** + * + * @summary Creates an image given a prompt. + * @param {CreateImageRequest} createImageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImage: (createImageRequest, options = {}) => __awaiter(this, void 0, void 0, function* () { + // verify required parameter 'createImageRequest' is not null or undefined + common_1.assertParamExists('createImage', 'createImageRequest', createImageRequest); + const localVarPath = `/images/generations`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); + const localVarHeaderParameter = {}; + const localVarQueryParameter = {}; + localVarHeaderParameter['Content-Type'] = 'application/json'; + common_1.setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); + localVarRequestOptions.data = common_1.serializeDataIfNeeded(createImageRequest, localVarRequestOptions, configuration); + return { + url: common_1.toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }), + /** + * + * @summary Creates an edited or extended image given an original image and a prompt. + * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square. + * @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`. + * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImageEdit: (image, mask, prompt, n, size, responseFormat, user, options = {}) => __awaiter(this, void 0, void 0, function* () { + // verify required parameter 'image' is not null or undefined + common_1.assertParamExists('createImageEdit', 'image', image); + // verify required parameter 'mask' is not null or undefined + common_1.assertParamExists('createImageEdit', 'mask', mask); + // verify required parameter 'prompt' is not null or undefined + common_1.assertParamExists('createImageEdit', 'prompt', prompt); + const localVarPath = `/images/edits`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); + const localVarHeaderParameter = {}; + const localVarQueryParameter = {}; + const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)(); + if (image !== undefined) { + localVarFormParams.append('image', image); + } + if (mask !== undefined) { + localVarFormParams.append('mask', mask); + } + if (prompt !== undefined) { + localVarFormParams.append('prompt', prompt); + } + if (n !== undefined) { + localVarFormParams.append('n', n); + } + if (size !== undefined) { + localVarFormParams.append('size', size); + } + if (responseFormat !== undefined) { + localVarFormParams.append('response_format', responseFormat); + } + if (user !== undefined) { + localVarFormParams.append('user', user); + } + localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; + common_1.setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), localVarFormParams.getHeaders()), headersFromBaseOptions), options.headers); + localVarRequestOptions.data = localVarFormParams; + return { + url: common_1.toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }), + /** + * + * @summary Creates a variation of a given image. + * @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. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImageVariation: (image, n, size, responseFormat, user, options = {}) => __awaiter(this, void 0, void 0, function* () { + // verify required parameter 'image' is not null or undefined + common_1.assertParamExists('createImageVariation', 'image', image); + const localVarPath = `/images/variations`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); + const localVarHeaderParameter = {}; + const localVarQueryParameter = {}; + const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)(); + if (image !== undefined) { + localVarFormParams.append('image', image); + } + if (n !== undefined) { + localVarFormParams.append('n', n); + } + if (size !== undefined) { + localVarFormParams.append('size', size); + } + if (responseFormat !== undefined) { + localVarFormParams.append('response_format', responseFormat); + } + if (user !== undefined) { + localVarFormParams.append('user', user); + } + localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; + common_1.setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), localVarFormParams.getHeaders()), headersFromBaseOptions), options.headers); + localVarRequestOptions.data = localVarFormParams; + return { + url: common_1.toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }), /** * * @summary Classifies if text violates OpenAI\'s Content Policy @@ -805,6 +956,55 @@ exports.OpenAIApiFp = function (configuration) { return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, + /** + * + * @summary Creates an image given a prompt. + * @param {CreateImageRequest} createImageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImage(createImageRequest, options) { + return __awaiter(this, void 0, void 0, function* () { + const localVarAxiosArgs = yield localVarAxiosParamCreator.createImage(createImageRequest, options); + return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); + }); + }, + /** + * + * @summary Creates an edited or extended image given an original image and a prompt. + * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square. + * @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`. + * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImageEdit(image, mask, prompt, n, size, responseFormat, user, options) { + return __awaiter(this, void 0, void 0, function* () { + const localVarAxiosArgs = yield localVarAxiosParamCreator.createImageEdit(image, mask, prompt, n, size, responseFormat, user, options); + return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); + }); + }, + /** + * + * @summary Creates a variation of a given image. + * @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. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImageVariation(image, n, size, responseFormat, user, options) { + return __awaiter(this, void 0, void 0, function* () { + const localVarAxiosArgs = yield localVarAxiosParamCreator.createImageVariation(image, n, size, responseFormat, user, options); + return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); + }); + }, /** * * @summary Classifies if text violates OpenAI\'s Content Policy @@ -1080,6 +1280,46 @@ exports.OpenAIApiFactory = function (configuration, basePath, axios) { createFineTune(createFineTuneRequest, options) { return localVarFp.createFineTune(createFineTuneRequest, options).then((request) => request(axios, basePath)); }, + /** + * + * @summary Creates an image given a prompt. + * @param {CreateImageRequest} createImageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImage(createImageRequest, options) { + return localVarFp.createImage(createImageRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Creates an edited or extended image given an original image and a prompt. + * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square. + * @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`. + * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImageEdit(image, mask, prompt, n, size, responseFormat, user, options) { + return localVarFp.createImageEdit(image, mask, prompt, n, size, responseFormat, user, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Creates a variation of a given image. + * @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. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createImageVariation(image, n, size, responseFormat, user, options) { + return localVarFp.createImageVariation(image, n, size, responseFormat, user, options).then((request) => request(axios, basePath)); + }, /** * * @summary Classifies if text violates OpenAI\'s Content Policy @@ -1321,6 +1561,49 @@ class OpenAIApi extends base_1.BaseAPI { createFineTune(createFineTuneRequest, options) { return exports.OpenAIApiFp(this.configuration).createFineTune(createFineTuneRequest, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @summary Creates an image given a prompt. + * @param {CreateImageRequest} createImageRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OpenAIApi + */ + createImage(createImageRequest, options) { + return exports.OpenAIApiFp(this.configuration).createImage(createImageRequest, options).then((request) => request(this.axios, this.basePath)); + } + /** + * + * @summary Creates an edited or extended image given an original image and a prompt. + * @param {File} image The image to edit. Must be a valid PNG file, less than 4MB, and square. + * @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`. + * @param {string} prompt A text description of the desired image(s). The maximum length is 1000 characters. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OpenAIApi + */ + createImageEdit(image, mask, prompt, n, size, responseFormat, user, options) { + return exports.OpenAIApiFp(this.configuration).createImageEdit(image, mask, prompt, n, size, responseFormat, user, options).then((request) => request(this.axios, this.basePath)); + } + /** + * + * @summary Creates a variation of a given image. + * @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. + * @param {number} [n] The number of images to generate. Must be between 1 and 10. + * @param {string} [size] The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param {string} [responseFormat] The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @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). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OpenAIApi + */ + createImageVariation(image, n, size, responseFormat, user, options) { + return exports.OpenAIApiFp(this.configuration).createImageVariation(image, n, size, responseFormat, user, options).then((request) => request(this.axios, this.basePath)); + } /** * * @summary Classifies if text violates OpenAI\'s Content Policy diff --git a/dist/base.d.ts b/dist/base.d.ts index 4d83ba3b..94435235 100644 --- a/dist/base.d.ts +++ b/dist/base.d.ts @@ -2,7 +2,7 @@ * OpenAI API * APIs for sampling from and fine-tuning language models * - * The version of the OpenAPI document: 1.0.6 + * The version of the OpenAPI document: 1.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/dist/base.js b/dist/base.js index 779802b9..a87b90b2 100644 --- a/dist/base.js +++ b/dist/base.js @@ -5,7 +5,7 @@ * OpenAI API * APIs for sampling from and fine-tuning language models * - * The version of the OpenAPI document: 1.0.6 + * The version of the OpenAPI document: 1.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/dist/common.d.ts b/dist/common.d.ts index e06f7cd5..520dd410 100644 --- a/dist/common.d.ts +++ b/dist/common.d.ts @@ -2,7 +2,7 @@ * OpenAI API * APIs for sampling from and fine-tuning language models * - * The version of the OpenAPI document: 1.0.6 + * The version of the OpenAPI document: 1.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/dist/common.js b/dist/common.js index 7f28e3aa..51c19753 100644 --- a/dist/common.js +++ b/dist/common.js @@ -5,7 +5,7 @@ * OpenAI API * APIs for sampling from and fine-tuning language models * - * The version of the OpenAPI document: 1.0.6 + * The version of the OpenAPI document: 1.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/dist/configuration.d.ts b/dist/configuration.d.ts index fda48b0a..f070ca8f 100644 --- a/dist/configuration.d.ts +++ b/dist/configuration.d.ts @@ -2,7 +2,7 @@ * OpenAI API * APIs for sampling from and fine-tuning language models * - * The version of the OpenAPI document: 1.0.6 + * The version of the OpenAPI document: 1.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/dist/configuration.js b/dist/configuration.js index bfb75e8e..7ee24fa3 100644 --- a/dist/configuration.js +++ b/dist/configuration.js @@ -5,7 +5,7 @@ * OpenAI API * APIs for sampling from and fine-tuning language models * - * The version of the OpenAPI document: 1.0.6 + * The version of the OpenAPI document: 1.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/dist/index.d.ts b/dist/index.d.ts index 76a7aea4..e8fe57ea 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -2,7 +2,7 @@ * OpenAI API * APIs for sampling from and fine-tuning language models * - * The version of the OpenAPI document: 1.0.6 + * The version of the OpenAPI document: 1.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/dist/index.js b/dist/index.js index 6fba612b..87443b1b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5,7 +5,7 @@ * OpenAI API * APIs for sampling from and fine-tuning language models * - * The version of the OpenAPI document: 1.0.6 + * The version of the OpenAPI document: 1.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/index.ts b/index.ts index d57cfd22..2c4c9da1 100644 --- a/index.ts +++ b/index.ts @@ -4,7 +4,7 @@ * OpenAI API * APIs for sampling from and fine-tuning language models * - * The version of the OpenAPI document: 1.0.6 + * The version of the OpenAPI document: 1.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).