diff --git a/custom-words.txt b/custom-words.txt index 76a7eb6457f1..aae0e0c8cbec 100644 --- a/custom-words.txt +++ b/custom-words.txt @@ -504,6 +504,8 @@ dacl DaemonSet dailyforecast dailyhistorical +DALL-E +dalle dapr darkgrey Darussalam diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-04-15-preview/examples/delete_operation.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-04-15-preview/examples/delete_operation.json new file mode 100644 index 000000000000..1576fa8cfe9b --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-04-15-preview/examples/delete_operation.json @@ -0,0 +1,15 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "Api-Key": "{api key}", + "api-version": "2023-04-15-preview", + "operation-id": "f508bcf2-e651-4b4b-85a7-58ad77981ffa" + }, + "responses": { + "204": { + "headers": { + "x-ms-request-id": "29fd3fe5-ab2f-44e0-aefa-0dfe9bd1c03f" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-04-15-preview/examples/get_operation.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-04-15-preview/examples/get_operation.json new file mode 100644 index 000000000000..d6e4374e144e --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-04-15-preview/examples/get_operation.json @@ -0,0 +1,29 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "Api-Key": "{api key}", + "api-version": "2023-04-15-preview", + "operation-id": "f508bcf2-e651-4b4b-85a7-58ad77981ffa" + }, + "responses": { + "200": { + "headers": { + "x-ms-request-id": "29fd3fe5-ab2f-44e0-aefa-0dfe9bd1c03f" + }, + "body": { + "created": 1679320850, + "result": { + "data": [ + { + "url": "https://aoairesource.blob.core.windows.net/private/images?SAS-token" + } + ] + }, + "expires": 1679407255, + "id": "41dc2981-bf72-492a-b4fe-7eed680a1681", + "last_action": 1679320850, + "status": "succeeded" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-04-15-preview/examples/post_images_generate.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-04-15-preview/examples/post_images_generate.json new file mode 100644 index 000000000000..fe614f166564 --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-04-15-preview/examples/post_images_generate.json @@ -0,0 +1,25 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "Api-Key": "{api key}", + "api-version": "2023-04-15-preview", + "body": { + "prompt": "An avocado chair", + "size": "512x512", + "n": 3 + }, + "content-Type": "application/json" + }, + "responses": { + "202": { + "headers": { + "operation-location": "https://aoairesource.openai.azure.com/openai/dalle/operations/images/f508bcf2-e651-4b4b-85a7-58ad77981ffa?api-version=2023-04-15-preview", + "x-ms-request-id": "29fd3fe5-ab2f-44e0-aefa-0dfe9bd1c03f" + }, + "body": { + "id": "f508bcf2-e651-4b4b-85a7-58ad77981ffa", + "status": "notStarted" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-04-15-preview/images.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-04-15-preview/images.json new file mode 100644 index 000000000000..532b75a850cf --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-04-15-preview/images.json @@ -0,0 +1,557 @@ +{ + "swagger": "2.0", + "info": { + "title": "Azure OpenAI DALL-E API version 2023-04-15-preview", + "description": "Cognitive Services API to support OpenAI DALL-E", + "version": "2023-04-15-preview" + }, + "paths": { + "/images/generate": { + "post": { + "summary": "Generates a batch of images from a text caption", + "operationId": "Images_Generate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionQueryParameter" + }, + { + "in": "header", + "name": "Operation-Id", + "description": "ID of the status monitor for the operation. If the Operation-Id header matches an existing operation and the request is not identical to the prior request, it will fail with a 400 Bad Request.", + "type": "string" + }, + { + "in": "body", + "name": "body", + "description": "The specification of the images that should be generated.", + "required": true, + "schema": { + "$ref": "#/definitions/GenerateImagesCreation" + } + } + ], + "responses": { + "202": { + "description": "Created", + "headers": { + "operation-location": { + "type": "string", + "format": "url", + "description": "URL to poll for the operation result." + }, + "x-ms-request-id": { + "type": "string", + "format": "uuid", + "description": "Service generated correlation id identifying the request, in the form of a GUID." + } + }, + "schema": { + "$ref": "#/definitions/GenerateImagesResponse" + } + }, + "default": { + "description": "An error occurred.", + "headers": { + "x-ms-error-code": { + "type": "string", + "description": "The error code indicating what went wrong." + }, + "x-ms-request-id": { + "type": "string", + "format": "uuid", + "description": "Service generated correlation id identifying the request, in the form of a GUID." + } + }, + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-long-running-operation-options": { + "final-state-via": "azure-async-operation" + }, + "x-ms-examples": { + "Creating an image generation operation.": { + "$ref": "./examples/post_images_generate.json" + } + } + } + }, + "/operations/images/{operation-id}": { + "get": { + "summary": "Returns the status of the operation", + "operationId": "Operations_Get", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionQueryParameter" + }, + { + "in": "path", + "name": "operation-id", + "required": true, + "type": "string", + "format": "uuid", + "description": "The id of the operation" + } + ], + "responses": { + "200": { + "description": "OK", + "headers": { + "retry-after": { + "type": "integer", + "format": "int32", + "description": "Indicates the number of seconds that the client should wait before executing another GET request if the operation did not terminate yet." + }, + "x-ms-request-id": { + "type": "string", + "format": "uuid", + "description": "Service generated correlation id identifying the request, in the form of a GUID." + } + }, + "schema": { + "$ref": "#/definitions/OperationResponse" + } + }, + "default": { + "description": "An error occurred.", + "headers": { + "x-ms-error-code": { + "type": "string", + "description": "The error code indicating what went wrong." + }, + "x-ms-request-id": { + "type": "string", + "format": "uuid", + "description": "Service generated correlation id identifying the request, in the form of a GUID." + } + }, + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Getting the result of a specific operation.": { + "$ref": "./examples/get_operation.json" + } + } + }, + "delete": { + "summary": "Deletes an operation (if in terminal state) and all generated and user provided images associated with the operation.", + "operationId": "Operations_Delete", + "parameters": [ + { + "$ref": "#/parameters/apiVersionQueryParameter" + }, + { + "in": "path", + "name": "operation-id", + "required": true, + "type": "string", + "format": "uuid", + "description": "The id of the operation" + } + ], + "responses": { + "204": { + "description": "NoContent", + "headers": { + "x-ms-request-id": { + "type": "string", + "format": "uuid", + "description": "Service generated correlation id identifying the request, in the form of a GUID." + } + } + }, + "default": { + "description": "An error occurred.", + "headers": { + "x-ms-error-code": { + "type": "string", + "description": "The error code indicating what went wrong." + }, + "x-ms-request-id": { + "type": "string", + "format": "uuid", + "description": "Service generated correlation id identifying the request, in the form of a GUID." + } + }, + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Deleting a specific operation.": { + "$ref": "./examples/delete_operation.json" + } + } + } + } + }, + "definitions": { + "Status": { + "title": "State", + "description": "The status of the operation.", + "enum": [ + "notStarted", + "running", + "succeeded", + "canceled", + "failed" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "Status", + "modelAsString": true, + "values": [ + { + "value": "notStarted", + "description": "The operation was created and is not queued to be processed in the future." + }, + { + "value": "running", + "description": "The operation has started to be processed." + }, + { + "value": "succeeded", + "description": "The operation has successfully be processed and is ready for consumption." + }, + { + "value": "canceled", + "description": "The operation has been canceled and is incomplete." + }, + { + "value": "failed", + "description": "The operation has completed processing with a failure and cannot be further consumed." + } + ] + } + }, + "Error": { + "title": "Error", + "description": "Error content as defined in the Microsoft REST guidelines\r\n(https://github.com/microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses).", + "type": "object", + "properties": { + "message": { + "description": "The message of this error.", + "minLength": 1, + "type": "string" + }, + "code": { + "$ref": "#/definitions/ErrorCode" + } + }, + "required": [ + "message", + "code" + ] + }, + "ErrorCode": { + "title": "ErrorCode", + "description": "Error codes as defined in the Microsoft REST guidelines\r\n(https://github.com/microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses).", + "enum": [ + "badRequest", + "internal", + "tooManyRequests", + "unauthorized", + "notFound", + "operationNotInTerminalState" + ], + "type": "string", + "x-ms-enum": { + "name": "ErrorCode", + "modelAsString": true, + "values": [ + { + "value": "badRequest", + "description": "The request data is invalid for this operation." + }, + { + "value": "internal", + "description": "Internal error. Please retry." + }, + { + "value": "tooManyRequests", + "description": "Too many requests. Please retry later." + }, + { + "value": "unauthorized", + "description": "The current user/api key is not authorized for the operation." + }, + { + "value": "notFound", + "description": "The resource is not found." + }, + { + "value": "operationNotInTerminalState", + "description": "The operation cannot be executed in the current resource's state." + } + ] + } + }, + "ErrorResponse": { + "title": "ErrorResponse", + "description": "Error response as defined in the Microsoft REST guidelines\r\n(https://github.com/microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses).", + "required": [ + "error" + ], + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/Error" + } + } + }, + "ImageErrorCode": { + "title": "ErrorCode", + "description": "Error codes for image errors.", + "enum": [ + "contentFilter", + "blockedImages" + ], + "type": "string", + "x-ms-enum": { + "name": "ImageErrorCode", + "modelAsString": true, + "values": [ + { + "value": "contentFilter", + "description": "Generated image was filtered as a result of our safety system." + }, + { + "value": "blockedImages", + "description": "The user provided images were blocked by our safety system." + } + ] + } + }, + "ImageError": { + "title": "Error", + "description": "The error when an image could not be generated.", + "type": "object", + "properties": { + "message": { + "description": "The message of this error.", + "minLength": 1, + "type": "string" + }, + "code": { + "$ref": "#/definitions/ImageErrorCode" + } + }, + "required": [ + "message", + "code" + ] + }, + "ImageResult": { + "type": "object", + "description": "The image url if successful, and an error otherwise.", + "properties": { + "url": { + "type": "string", + "format": "url", + "description": "The URL that provides temporary access to download the generated image." + }, + "error": { + "$ref": "#/definitions/ImageError" + } + } + }, + "ImageResults": { + "title": "OperationResult", + "description": "The result data of the operation, if successful", + "type": "array", + "items": { + "$ref": "#/definitions/ImageResult" + } + }, + "OperationResponse": { + "title": "OperationResponse", + "description": "The operation response containing the id and the status of the operation. If successful, it contains data with the generated images and an error otherwise.", + "type": "object", + "properties": { + "id": { + "format": "uuid", + "description": "The ID of the operation.", + "type": "string" + }, + "created": { + "format": "unixtime", + "description": "A timestamp when this job or item was created (in unix epochs).", + "type": "integer" + }, + "last_action": { + "format": "unixtime", + "description": "A timestamp when this job or item was modified last (in unix epochs).", + "type": "integer" + }, + "expires": { + "format": "unixtime", + "description": "A timestamp when this operation and its associated images expire and will be deleted (in unix epochs).", + "type": "integer" + }, + "result": { + "type": "object", + "description": "The result of the operation if the operation succeeded.", + "properties": { + "data": { + "$ref": "#/definitions/ImageResults" + } + }, + "required": [ + "data" + ] + }, + "status": { + "$ref": "#/definitions/Status" + }, + "error": { + "$ref": "#/definitions/Error" + } + }, + "required": [ + "id", + "status", + "created", + "last_action" + ] + }, + "Size": { + "title": "Size", + "description": "The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024.", + "enum": [ + "256x256", + "512x512", + "1024x1024" + ], + "type": "string", + "default": "1024x1024", + "x-ms-enum": { + "name": "Size", + "modelAsString": true, + "values": [ + { + "value": "256x256", + "description": "The desired size of the generated image is 256x256 pixels." + }, + { + "value": "512x512", + "description": "The desired size of the generated image is 512x512 pixels." + }, + { + "value": "1024x1024", + "description": "The desired size of the generated image is 1024x1024 pixels." + } + ] + } + }, + "GenerateImagesCreation": { + "title": "GenerateImagesCreation", + "description": "Defines the request to create an operation to generate images.", + "type": "object", + "properties": { + "prompt": { + "description": "A text description of the desired image(s).", + "type": "string", + "minLength": 1 + }, + "n": { + "description": "The number of images to generate.", + "type": "integer", + "format": "int32", + "minimum": 1, + "default": 1 + }, + "size": { + "$ref": "#/definitions/Size" + }, + "user": { + "description": "A unique identifier representing your end-user, which can help to monitor and detect abuse.", + "type": "string" + } + }, + "required": [ + "prompt" + ] + }, + "GenerateImagesResponse": { + "title": "GenerateImagesResponse", + "description": "Defines response after creating an operation to generate images. It contains the status and the id of the operation.", + "type": "object", + "properties": { + "status": { + "$ref": "#/definitions/Status" + }, + "id": { + "type": "string", + "format": "uuid", + "description": " The Id of the asynchronous operation that can be used to query its status later." + } + }, + "required": [ + "id", + "status" + ] + } + }, + "parameters": { + "endpoint": { + "in": "path", + "name": "endpoint", + "description": "Supported Cognitive Services endpoints (protocol and hostname, for example: https://aoairesource.openai.azure.com. Replace \"aoairesource\" with your Azure OpenAI account name).", + "required": true, + "type": "string", + "format": "url", + "x-ms-skip-url-encoding": true, + "x-ms-parameter-location": "client" + }, + "apiVersionQueryParameter": { + "in": "query", + "name": "api-version", + "description": "The requested API version.", + "required": true, + "type": "string", + "x-ms-client-default": "2023-04-15-preview", + "x-ms-parameter-location": "client" + } + }, + "securityDefinitions": { + "api-key": { + "type": "apiKey", + "name": "Api-Key", + "in": "header", + "description": "Provide your Cognitive Services Azure OpenAI account key here." + } + }, + "security": [ + { + "api-key": [] + } + ], + "schemes": [ + "https" + ], + "x-ms-parameterized-host": { + "hostTemplate": "{endpoint}/openai", + "useSchemePrefix": false, + "parameters": [ + { + "$ref": "#/parameters/endpoint" + } + ] + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/readme.md b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/readme.md index 963fd25593ba..5dd51fa7c9fb 100644 --- a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/readme.md +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/readme.md @@ -85,3 +85,21 @@ directive: - suppress: IntegerTypeMustHaveFormat reason: API stewardship board recommend to use format "unixtime" which is not supported by linter at the moment. ``` + +## AzureOpenAI 2023-04-15-preview +These settings apply only when `api-version=2023-04-15-preview` is specified in the query parameters of the request. + +``` yaml $(tag) == 'release_2023_04_15_preview' +input-file: preview/2023-04-15-preview/images.json +``` + +AutoRest-Linter Suppressions + +``` yaml +# Ignore autorest-linter issues that cannot be resolved without breaking compatibility to existing openai api +directive: + - suppress: ValidFormats + reason: API stewardship board recommend to use format "unixtime" which is not supported by linter at the moment. + - suppress: IntegerTypeMustHaveFormat + reason: API stewardship board recommend to use format "unixtime" which is not supported by linter at the moment. +``` \ No newline at end of file