From 5a640e853c1293044db3400fb6bc160ef012f838 Mon Sep 17 00:00:00 2001 From: Gerardo Lecaros Date: Fri, 23 Jun 2023 12:22:21 -0700 Subject: [PATCH] Removing unused state + Fixing enum + Adding versioning to DALL-E models. --- .../models/chat.completions.tsp | 9 +- .../OpenAI.Inference/models/images.tsp | 12 +- .../preview/2023-06-01-preview/generated.json | 8 +- .../stable/2022-12-01/generated.json | 203 ------------------ .../stable/2023-05-15/generated.json | 203 ------------------ 5 files changed, 13 insertions(+), 422 deletions(-) diff --git a/specification/cognitiveservices/OpenAI.Inference/models/chat.completions.tsp b/specification/cognitiveservices/OpenAI.Inference/models/chat.completions.tsp index 5405b21497b2..0333f1635dae 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/chat.completions.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/chat.completions.tsp @@ -10,16 +10,13 @@ namespace Azure.OpenAI; @doc("A description of the intended purpose of a message within a chat completions interaction.") enum ChatRole { @doc("The role that instructs or sets the behavior of the assistant.") - @projectedName("json", "system") - system, + system: "system", @doc("The role that provides responses to system-instructed, user-prompted input.") - @projectedName("json", "assistant") - assistant, + assistant: "assistant", @doc("The role that provides input for chat completions.") - @projectedName("json", "user") - user, + user: "user", } @doc("A single, role-attributed message within a chat completion interaction.") diff --git a/specification/cognitiveservices/OpenAI.Inference/models/images.tsp b/specification/cognitiveservices/OpenAI.Inference/models/images.tsp index c990a9ff2c24..916ed05b1581 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/images.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/images.tsp @@ -1,12 +1,15 @@ import "@azure-tools/typespec-azure-core"; import "@typespec/http"; +import "@typespec/versioning"; using Azure.Core; using TypeSpec.Http; +using TypeSpec.Versioning; namespace Azure.OpenAI; @doc("The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024.") +@added(ServiceApiVersions.v2023_06_01_Preview) enum ImageSize { @doc("Image size of 256x256.") Size256x256: "256x256", @@ -19,6 +22,7 @@ enum ImageSize { } @doc("Represents the request data used to generate images.") +@added(ServiceApiVersions.v2023_06_01_Preview) model ImageGenerationOptions { @doc("A description of the desired images.") prompt: string; @@ -34,6 +38,7 @@ model ImageGenerationOptions { } @doc("The image url if successful, and an error otherwise.") +@added(ServiceApiVersions.v2023_06_01_Preview) model ImageLocation { @doc("The URL that provides temporary access to download the generated image.") url?: url; @@ -43,6 +48,7 @@ model ImageLocation { } @doc("The result of the operation if the operation succeeded.") +@added(ServiceApiVersions.v2023_06_01_Preview) model ImageResponse { @doc("A timestamp when this job or item was created (in unix epochs).") created: int64; @@ -52,6 +58,7 @@ model ImageResponse { } @doc("The result of the operation if the operation succeeded.") +@added(ServiceApiVersions.v2023_06_01_Preview) model ImageOperationResponse { @doc("The ID of the operation.") id: string; @@ -74,6 +81,7 @@ model ImageOperationResponse { @lroStatus @doc("The state of a job or item.") +@added(ServiceApiVersions.v2023_06_01_Preview) enum State { @doc("The operation was created and is queued to be processed in the future.") notRunning, @@ -92,12 +100,10 @@ enum State { @lroFailed @doc("The operation has completed processing with a failure and cannot be further consumed.") failed, - - @doc("The entity has been deleted but may still be referenced by other entities predating the deletion.") - deleted, } @doc("Provides status details for long running operations.") +@added(ServiceApiVersions.v2023_06_01_Preview) model ImageOperationStatus { @key("operationId") @visibility("read", "query") diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2023-06-01-preview/generated.json b/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2023-06-01-preview/generated.json index 408442988421..1042c456b550 100644 --- a/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2023-06-01-preview/generated.json +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2023-06-01-preview/generated.json @@ -1137,8 +1137,7 @@ "running", "succeeded", "canceled", - "failed", - "deleted" + "failed" ], "x-ms-enum": { "name": "State", @@ -1168,11 +1167,6 @@ "name": "failed", "value": "failed", "description": "The operation has completed processing with a failure and cannot be further consumed." - }, - { - "name": "deleted", - "value": "deleted", - "description": "The entity has been deleted but may still be referenced by other entities predating the deletion." } ] } diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/inference/stable/2022-12-01/generated.json b/specification/cognitiveservices/data-plane/AzureOpenAI/inference/stable/2022-12-01/generated.json index 13f6ad8e1121..6e5b78cd511f 100644 --- a/specification/cognitiveservices/data-plane/AzureOpenAI/inference/stable/2022-12-01/generated.json +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/inference/stable/2022-12-01/generated.json @@ -803,161 +803,6 @@ "total_tokens" ] }, - "ImageGenerationOptions": { - "type": "object", - "properties": { - "prompt": { - "type": "string", - "description": "A description of the desired images." - }, - "n": { - "type": "integer", - "format": "int32", - "description": "The number of images to generate (defaults to 1).", - "default": 1 - }, - "size": { - "$ref": "#/definitions/ImageSize", - "description": "The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024 (defaults to 1024x1024).", - "default": "1024x1024" - }, - "user": { - "type": "string", - "description": "A unique identifier representing your end-user, which can help to monitor and detect abuse." - } - }, - "description": "Represents the request data used to generate images.", - "required": [ - "prompt" - ] - }, - "ImageLocation": { - "type": "object", - "properties": { - "url": { - "type": "string", - "format": "uri", - "description": "The URL that provides temporary access to download the generated image." - }, - "error": { - "$ref": "#/definitions/Azure.Core.Foundations.Error", - "description": "The error if the operation failed." - } - }, - "description": "The image url if successful, and an error otherwise." - }, - "ImageOperationResponse": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of the operation." - }, - "created": { - "type": "integer", - "format": "int64", - "description": "A timestamp when this job or item was created (in unix epochs)." - }, - "expires": { - "type": "integer", - "format": "int64", - "description": "A timestamp when this operation and its associated images expire and will be deleted (in unix epochs)." - }, - "result": { - "$ref": "#/definitions/ImageResponse", - "description": "The result of the operation if the operation succeeded." - }, - "status": { - "$ref": "#/definitions/State", - "description": "The status of the operation" - }, - "error": { - "$ref": "#/definitions/Azure.Core.Foundations.Error", - "description": "The error if the operation failed." - } - }, - "description": "The result of the operation if the operation succeeded.", - "required": [ - "id", - "created", - "status" - ] - }, - "ImageOperationStatus": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the operation.", - "x-ms-mutability": [ - "read" - ] - }, - "status": { - "$ref": "#/definitions/State", - "description": "The status of the operation" - } - }, - "description": "Provides status details for long running operations.", - "required": [ - "id", - "status" - ] - }, - "ImageResponse": { - "type": "object", - "properties": { - "created": { - "type": "integer", - "format": "int64", - "description": "A timestamp when this job or item was created (in unix epochs)." - }, - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/ImageLocation" - }, - "x-ms-identifiers": [], - "description": "The images generated by the operator.", - "x-typespec-name": "ImageLocation[]" - } - }, - "description": "The result of the operation if the operation succeeded.", - "required": [ - "created", - "data" - ] - }, - "ImageSize": { - "type": "string", - "description": "The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024.", - "enum": [ - "256x256", - "512x512", - "1024x1024" - ], - "x-ms-enum": { - "name": "ImageSize", - "modelAsString": true, - "values": [ - { - "name": "Size256x256", - "value": "256x256", - "description": "Image size of 256x256." - }, - { - "name": "Size512x512", - "value": "512x512", - "description": "Image size of 512x512." - }, - { - "name": "Size1024x1024", - "value": "1024x1024", - "description": "Image size of 1024x1024." - } - ] - } - }, "ServiceApiVersions": { "type": "string", "enum": [ @@ -983,54 +828,6 @@ } ] } - }, - "State": { - "type": "string", - "description": "The state of a job or item.", - "enum": [ - "notRunning", - "running", - "succeeded", - "canceled", - "failed", - "deleted" - ], - "x-ms-enum": { - "name": "State", - "modelAsString": true, - "values": [ - { - "name": "notRunning", - "value": "notRunning", - "description": "The operation was created and is queued to be processed in the future." - }, - { - "name": "running", - "value": "running", - "description": "The operation has started to be processed." - }, - { - "name": "succeeded", - "value": "succeeded", - "description": "The operation has successfully be processed and is ready for consumption." - }, - { - "name": "canceled", - "value": "canceled", - "description": "The operation has been canceled and is incomplete." - }, - { - "name": "failed", - "value": "failed", - "description": "The operation has completed processing with a failure and cannot be further consumed." - }, - { - "name": "deleted", - "value": "deleted", - "description": "The entity has been deleted but may still be referenced by other entities predating the deletion." - } - ] - } } }, "parameters": { diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/inference/stable/2023-05-15/generated.json b/specification/cognitiveservices/data-plane/AzureOpenAI/inference/stable/2023-05-15/generated.json index 78fd2fe57232..25eb53097331 100644 --- a/specification/cognitiveservices/data-plane/AzureOpenAI/inference/stable/2023-05-15/generated.json +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/inference/stable/2023-05-15/generated.json @@ -854,161 +854,6 @@ "total_tokens" ] }, - "ImageGenerationOptions": { - "type": "object", - "properties": { - "prompt": { - "type": "string", - "description": "A description of the desired images." - }, - "n": { - "type": "integer", - "format": "int32", - "description": "The number of images to generate (defaults to 1).", - "default": 1 - }, - "size": { - "$ref": "#/definitions/ImageSize", - "description": "The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024 (defaults to 1024x1024).", - "default": "1024x1024" - }, - "user": { - "type": "string", - "description": "A unique identifier representing your end-user, which can help to monitor and detect abuse." - } - }, - "description": "Represents the request data used to generate images.", - "required": [ - "prompt" - ] - }, - "ImageLocation": { - "type": "object", - "properties": { - "url": { - "type": "string", - "format": "uri", - "description": "The URL that provides temporary access to download the generated image." - }, - "error": { - "$ref": "#/definitions/Azure.Core.Foundations.Error", - "description": "The error if the operation failed." - } - }, - "description": "The image url if successful, and an error otherwise." - }, - "ImageOperationResponse": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of the operation." - }, - "created": { - "type": "integer", - "format": "int64", - "description": "A timestamp when this job or item was created (in unix epochs)." - }, - "expires": { - "type": "integer", - "format": "int64", - "description": "A timestamp when this operation and its associated images expire and will be deleted (in unix epochs)." - }, - "result": { - "$ref": "#/definitions/ImageResponse", - "description": "The result of the operation if the operation succeeded." - }, - "status": { - "$ref": "#/definitions/State", - "description": "The status of the operation" - }, - "error": { - "$ref": "#/definitions/Azure.Core.Foundations.Error", - "description": "The error if the operation failed." - } - }, - "description": "The result of the operation if the operation succeeded.", - "required": [ - "id", - "created", - "status" - ] - }, - "ImageOperationStatus": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of the operation.", - "x-ms-mutability": [ - "read" - ] - }, - "status": { - "$ref": "#/definitions/State", - "description": "The status of the operation" - } - }, - "description": "Provides status details for long running operations.", - "required": [ - "id", - "status" - ] - }, - "ImageResponse": { - "type": "object", - "properties": { - "created": { - "type": "integer", - "format": "int64", - "description": "A timestamp when this job or item was created (in unix epochs)." - }, - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/ImageLocation" - }, - "x-ms-identifiers": [], - "description": "The images generated by the operator.", - "x-typespec-name": "ImageLocation[]" - } - }, - "description": "The result of the operation if the operation succeeded.", - "required": [ - "created", - "data" - ] - }, - "ImageSize": { - "type": "string", - "description": "The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024.", - "enum": [ - "256x256", - "512x512", - "1024x1024" - ], - "x-ms-enum": { - "name": "ImageSize", - "modelAsString": true, - "values": [ - { - "name": "Size256x256", - "value": "256x256", - "description": "Image size of 256x256." - }, - { - "name": "Size512x512", - "value": "512x512", - "description": "Image size of 512x512." - }, - { - "name": "Size1024x1024", - "value": "1024x1024", - "description": "Image size of 1024x1024." - } - ] - } - }, "ServiceApiVersions": { "type": "string", "enum": [ @@ -1034,54 +879,6 @@ } ] } - }, - "State": { - "type": "string", - "description": "The state of a job or item.", - "enum": [ - "notRunning", - "running", - "succeeded", - "canceled", - "failed", - "deleted" - ], - "x-ms-enum": { - "name": "State", - "modelAsString": true, - "values": [ - { - "name": "notRunning", - "value": "notRunning", - "description": "The operation was created and is queued to be processed in the future." - }, - { - "name": "running", - "value": "running", - "description": "The operation has started to be processed." - }, - { - "name": "succeeded", - "value": "succeeded", - "description": "The operation has successfully be processed and is ready for consumption." - }, - { - "name": "canceled", - "value": "canceled", - "description": "The operation has been canceled and is incomplete." - }, - { - "name": "failed", - "value": "failed", - "description": "The operation has completed processing with a failure and cannot be further consumed." - }, - { - "name": "deleted", - "value": "deleted", - "description": "The entity has been deleted but may still be referenced by other entities predating the deletion." - } - ] - } } }, "parameters": {