diff --git a/specification/cognitiveservices/AnomalyDetector/tspconfig.yaml b/specification/cognitiveservices/AnomalyDetector/tspconfig.yaml index 84035d69b58c..320cad1a5a75 100644 --- a/specification/cognitiveservices/AnomalyDetector/tspconfig.yaml +++ b/specification/cognitiveservices/AnomalyDetector/tspconfig.yaml @@ -17,7 +17,7 @@ options: examples-directory: ./examples omit-unreachable-types: true output-file: openapi.json - emitter-output-dir: "{project-root}/../data-plane/AnomalyDetector/stable" + emitter-output-dir: "{project-root}/../data-plane/AnomalyDetector/stable/v1.1" "@azure-tools/typespec-python": "package-pprint-name": "\"Cognitive Services Anomaly Detector\"" "package-mode": "dataplane" diff --git a/specification/cognitiveservices/ContentSafety/routes.tsp b/specification/cognitiveservices/ContentSafety/routes.tsp index a8736c4483e4..2ca98ad2dc76 100644 --- a/specification/cognitiveservices/ContentSafety/routes.tsp +++ b/specification/cognitiveservices/ContentSafety/routes.tsp @@ -1,5 +1,5 @@ import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-client-generator-core"; +//import "@azure-tools/typespec-client-generator-core"; import "@typespec/http"; import "@typespec/rest"; import "./models.tsp"; @@ -9,7 +9,7 @@ using TypeSpec.Rest; using TypeSpec.Versioning; using Azure.Core; using Azure.Core.Traits; -using Azure.ClientGenerator.Core; +//using Azure.ClientGenerator.Core; namespace ContentSafety; @@ -43,26 +43,30 @@ interface ImageOperations { >; } +interface BlockOps + extends Azure.Core.ResourceOperations {} interface TextBlocklists { @summary("Get Text Blocklist By blocklistName") @doc("Returns text blocklist details.") - getTextBlocklist is Azure.Core.ResourceRead; + getTextBlocklist is BlockOps.ResourceRead; @summary("Create Or Update Text Blocklist") @doc("Updates a text blocklist, if blocklistName does not exist, create a new blocklist.") - createOrUpdateTextBlocklist is Azure.Core.ResourceCreateOrUpdate; + createOrUpdateTextBlocklist is BlockOps.ResourceCreateOrUpdate; @summary("Delete Text Blocklist By blocklistName") @doc("Deletes a text blocklist.") - deleteTextBlocklist is Azure.Core.ResourceDelete; + deleteTextBlocklist is BlockOps.ResourceDelete; @summary("Get All Text Blocklists") @doc("Get all text blocklists details.") - listTextBlocklists is Azure.Core.ResourceList; + listTextBlocklists is BlockOps.ResourceList; @summary("Add BlockItems To Text Blocklist") @doc("Add blockItems to a text blocklist. You can add at most 100 BlockItems in one request.") - addBlockItems is ResourceAction< + addBlockItems is BlockOps.ResourceAction< TextBlocklist, AddBlockItemsOptions, AddBlockItemsResult @@ -70,7 +74,7 @@ interface TextBlocklists { @summary("Remove BlockItems From Text Blocklist") @doc("Remove blockItems from a text blocklist. You can remove at most 100 BlockItems in one request.") - removeBlockItems is ResourceAction< + removeBlockItems is BlockOps.ResourceAction< TextBlocklist, RemoveBlockItemsOptions, NoContentResponse @@ -78,11 +82,11 @@ interface TextBlocklists { @summary("Get BlockItem By blocklistName And blockItemId") @doc("Get blockItem By blockItemId from a text blocklist.") - getTextBlocklistItem is Azure.Core.ResourceRead; + getTextBlocklistItem is BlockOps.ResourceRead; @summary("Get All BlockItems By blocklistName") @doc("Get all blockItems in a text blocklist") - listTextBlocklistItems is Azure.Core.ResourceList< + listTextBlocklistItems is BlockOps.ResourceList< TextBlockItem, ListQueryParametersTrait >; diff --git a/specification/cognitiveservices/ContentSafety/tspconfig.yaml b/specification/cognitiveservices/ContentSafety/tspconfig.yaml index 976e4bb86aa4..adf734570bd8 100644 --- a/specification/cognitiveservices/ContentSafety/tspconfig.yaml +++ b/specification/cognitiveservices/ContentSafety/tspconfig.yaml @@ -13,8 +13,9 @@ emit: - "@azure-tools/typespec-autorest" options: "@azure-tools/typespec-autorest": - output-file: "contentsafety.json" - azure-resource-provider-folder: ../../../../data-plane + emitter-output-dir: "{project-root}/../" + output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/contentsafety.json" + azure-resource-provider-folder: "data-plane" examples-directory: ./examples "@azure-tools/typespec-python": package-name: "azure-ai-contentsafety" diff --git a/specification/cognitiveservices/HealthInsights/healthinsights.common/model.common.response.tsp b/specification/cognitiveservices/HealthInsights/healthinsights.common/model.common.response.tsp index 96f222532591..64648b8e0614 100644 --- a/specification/cognitiveservices/HealthInsights/healthinsights.common/model.common.response.tsp +++ b/specification/cognitiveservices/HealthInsights/healthinsights.common/model.common.response.tsp @@ -5,6 +5,7 @@ using TypeSpec.Rest; namespace AzureHealthInsights; alias Response = { + #suppress "@azure-tools/typespec-azure-core/no-format" "This is an old spec" @doc("A processing job identifier.") @visibility("read") @key @@ -32,7 +33,6 @@ alias Response = { errors?: Azure.Core.Foundations.Error[]; }; - @doc("An inference made by the model regarding a patient.") model Inference { @doc("The value of the inference, as relevant for the given inference type.") diff --git a/specification/cognitiveservices/HealthInsights/healthinsights.common/primitives.tsp b/specification/cognitiveservices/HealthInsights/healthinsights.common/primitives.tsp index a377638982d9..c1fabf7a1040 100644 --- a/specification/cognitiveservices/HealthInsights/healthinsights.common/primitives.tsp +++ b/specification/cognitiveservices/HealthInsights/healthinsights.common/primitives.tsp @@ -2,16 +2,16 @@ using Azure.Core; using TypeSpec.Http; namespace AzureHealthInsights; +#suppress "@azure-tools/typespec-azure-core/long-running-polling-operation-required" "This is a template" @doc("Long running RPC operation template") op LongRunningRpcOperation< - TParams extends object, - TResponse extends object, - Traits extends object = {} - > is RpcOperation< - TParams & Traits, - Foundations.AcceptedResponse | TResponse, - Traits - >; + TParams, + TResponse +> is Azure.Core.Foundations.Operation< + TParams & RepeatabilityRequestHeaders, + (Foundations.AcceptedResponse & + RepeatabilityResponseHeaders) | TResponse, + RepeatabilityRequestHeaders & RepeatabilityResponseHeaders, + Azure.Core.Foundations.ErrorResponse +>; diff --git a/specification/cognitiveservices/HealthInsights/healthinsights.oncophenotype/route.oncophenotype.tsp b/specification/cognitiveservices/HealthInsights/healthinsights.oncophenotype/route.oncophenotype.tsp index b4ac1b2b311b..1de4bccfbd5d 100644 --- a/specification/cognitiveservices/HealthInsights/healthinsights.oncophenotype/route.oncophenotype.tsp +++ b/specification/cognitiveservices/HealthInsights/healthinsights.oncophenotype/route.oncophenotype.tsp @@ -17,14 +17,21 @@ interface OncoPhenotype { @summary("Get Onco Phenotype job details") @tag("OncoPhenotype") @doc("Gets the status and details of the Onco Phenotype job.") - @example("./examples/SuccessfulOncoPhenotypeResponse.json", "SuccessfulOncoPhenotypeGetAnalyzeStatus") + @example( + "./examples/SuccessfulOncoPhenotypeResponse.json", + "SuccessfulOncoPhenotypeGetAnalyzeStatus" + ) GetJob is Azure.Core.ResourceRead; + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "There is no long-runnign RPC template in Azure.Core" @summary("Create Onco Phenotype job") @tag("OncoPhenotype") @doc("Creates an Onco Phenotype job with the given request body.") @pollingOperation(OncoPhenotype.GetJob) @route("/oncophenotype/jobs") - @example("./examples/SuccessfulOncoPhenotypeRequest.json", "SuccessfulOncoPhenotypeAnalyzeRequest") - CreateJob is LongRunningRpcOperation; + @example( + "./examples/SuccessfulOncoPhenotypeRequest.json", + "SuccessfulOncoPhenotypeAnalyzeRequest" + ) + CreateJob is LongRunningRpcOperation; } diff --git a/specification/cognitiveservices/HealthInsights/healthinsights.openapi/tspconfig.yaml b/specification/cognitiveservices/HealthInsights/healthinsights.openapi/tspconfig.yaml index e2d33c67e55f..b3bb437a1215 100644 --- a/specification/cognitiveservices/HealthInsights/healthinsights.openapi/tspconfig.yaml +++ b/specification/cognitiveservices/HealthInsights/healthinsights.openapi/tspconfig.yaml @@ -6,5 +6,7 @@ emit: [ options: "@azure-tools/typespec-autorest": - output-file: "openapi.json" + azure-resource-provider-folder: "HealthInsights" + emitter-output-dir: "{project-root}/../../data-plane" + output-file: "{azure-resource-provider-folder}/{version-status}/{version}/openapi.json" examples-directory: "./examples" diff --git a/specification/cognitiveservices/HealthInsights/healthinsights.trialmatcher/route.trialmatcher.tsp b/specification/cognitiveservices/HealthInsights/healthinsights.trialmatcher/route.trialmatcher.tsp index 337120b151ba..a02f2714d660 100644 --- a/specification/cognitiveservices/HealthInsights/healthinsights.trialmatcher/route.trialmatcher.tsp +++ b/specification/cognitiveservices/HealthInsights/healthinsights.trialmatcher/route.trialmatcher.tsp @@ -17,15 +17,21 @@ interface TrialMatcher { @summary("Get Trial Matcher job details") @tag("TrialMatcher") @doc("Gets the status and details of the Trial Matcher job.") - @example("./examples/SuccessfulTrialMatcherResponse.json", "SuccessfulTrialMatcherGetAnalyzeStatus") + @example( + "./examples/SuccessfulTrialMatcherResponse.json", + "SuccessfulTrialMatcherGetAnalyzeStatus" + ) GetJob is Azure.Core.ResourceRead; + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "There is no long-runnign RPC template in Azure.Core" @summary("Create Trial Matcher job") @tag("TrialMatcher") @doc("Creates a Trial Matcher job with the given request body.") @pollingOperation(TrialMatcher.GetJob) @route("/trialmatcher/jobs") - @example("./examples/SuccessfulTrialMatcherRequest.json", "SuccessfulTrialMatcherAnalyzeRequest") - CreateJob is LongRunningRpcOperation; + @example( + "./examples/SuccessfulTrialMatcherRequest.json", + "SuccessfulTrialMatcherAnalyzeRequest" + ) + CreateJob is LongRunningRpcOperation; } - diff --git a/specification/cognitiveservices/OpenAI.Authoring/cadl-output/2022-06-01-preview/openapi.json b/specification/cognitiveservices/OpenAI.Authoring/cadl-output/2022-06-01-preview/openapi.json index d619df664803..97af6badf8c6 100644 --- a/specification/cognitiveservices/OpenAI.Authoring/cadl-output/2022-06-01-preview/openapi.json +++ b/specification/cognitiveservices/OpenAI.Authoring/cadl-output/2022-06-01-preview/openapi.json @@ -4,9 +4,9 @@ "title": "Azure OpenAI API", "version": "2022-06-01-preview", "description": "API for managing and utilizing Azure Open AI endpoints", - "x-cadl-generated": [ + "x-typespec-generated": [ { - "emitter": "@azure-tools/cadl-autorest" + "emitter": "@azure-tools/typespec-autorest" } ] }, @@ -37,20 +37,24 @@ "ApiKeyAuth": [] }, { - "OAuth2Auth": [] + "OAuth2Auth": [ + "https://cognitiveservices.azure.com/.default" + ] } ], "securityDefinitions": { "ApiKeyAuth": { "type": "apiKey", "in": "header", - "name": "apiKey" + "name": "api-key" }, "OAuth2Auth": { "type": "oauth2", "flow": "implicit", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", - "scopes": {} + "scopes": { + "https://cognitiveservices.azure.com/.default": "" + } } }, "tags": [], @@ -74,6 +78,12 @@ }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -89,26 +99,12 @@ "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { - "name": "body", + "name": "resource", "in": "body", + "required": true, + "description": "The resource instance.", "schema": { - "type": "object", - "properties": { - "model": { - "type": "string", - "description": "The OpenAI model to deploy. Can be a base model or a fine tune." - }, - "scale_settings": { - "$ref": "#/definitions/ScaleSettings", - "description": "The scale settings of a deployment. It defines the modes for scaling and the\nreserved capacity." - } - }, - "description": "The template for adding updateable properties.", - "required": [ - "model", - "scale_settings" - ], - "x-cadl-name": "Azure.Core.Foundations.ResourceCreateOrReplaceModel" + "$ref": "#/definitions/Deployment" } } ], @@ -123,62 +119,17 @@ } }, "schema": { - "type": "object", - "properties": { - "object": { - "$ref": "#/definitions/TypeDiscriminator", - "description": "Defines the type of an object.", - "readOnly": true - }, - "status": { - "$ref": "#/definitions/State", - "description": "The state of a job or item.", - "readOnly": true - }, - "created_at": { - "type": "integer", - "format": "int32", - "description": "A timestamp when this job or item was created (in unix epochs).", - "readOnly": true - }, - "updated_at": { - "type": "integer", - "format": "int32", - "description": "A timestamp when this job or item was modified last (in unix epochs).", - "readOnly": true - }, - "id": { - "type": "string", - "description": "The identifier of the deployment", - "readOnly": true - }, - "model": { - "type": "string", - "description": "The OpenAI model to deploy. Can be a base model or a fine tune." - }, - "owner": { - "type": "string", - "description": "The owner of this deployment. For Azure OpenAI only \"organization-owner\" is\nsupported.", - "readOnly": true - }, - "scale_settings": { - "$ref": "#/definitions/ScaleSettings", - "description": "The scale settings of a deployment. It defines the modes for scaling and the\nreserved capacity." - } - }, - "required": [ - "status", - "created_at", - "updated_at", - "id", - "model", - "scale_settings" - ], - "x-cadl-name": "Azure.Core.Foundations.CustomResponseFields<(anonymous model)>" + "$ref": "#/definitions/Deployment" } }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -192,15 +143,15 @@ "summary": "Gets details for a single deployment specified by the given deployment_id.", "description": "Gets details for a single deployment specified by the given deployment_id.", "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, { "name": "deploymentId", "in": "path", "required": true, "description": "The identifier of the deployment", "type": "string" - }, - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" } ], "responses": { @@ -212,6 +163,12 @@ }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -223,6 +180,9 @@ "summary": "Updates the mutable details of the deployment with the given deployment_id.", "description": "Updates the mutable details of the deployment with the given deployment_id.", "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, { "name": "deploymentId", "in": "path", @@ -231,25 +191,12 @@ "type": "string" }, { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" - }, - { - "name": "body", + "name": "resource", "in": "body", + "required": true, + "description": "The resource instance.", "schema": { - "type": "object", - "properties": { - "model": { - "type": "string", - "description": "The OpenAI model to deploy. Can be a base model or a fine tune." - }, - "scale_settings": { - "$ref": "#/definitions/ScaleSettings", - "description": "The scale settings of a deployment. It defines the modes for scaling and the\nreserved capacity." - } - }, - "description": "The template for adding optional properties.", - "x-cadl-name": "Azure.Core.Foundations.ResourceCreateOrUpdateModel" + "$ref": "#/definitions/DeploymentUpdate" } } ], @@ -257,120 +204,23 @@ "200": { "description": "The request has succeeded.", "schema": { - "type": "object", - "properties": { - "object": { - "$ref": "#/definitions/TypeDiscriminator", - "description": "Defines the type of an object.", - "readOnly": true - }, - "status": { - "$ref": "#/definitions/State", - "description": "The state of a job or item.", - "readOnly": true - }, - "created_at": { - "type": "integer", - "format": "int32", - "description": "A timestamp when this job or item was created (in unix epochs).", - "readOnly": true - }, - "updated_at": { - "type": "integer", - "format": "int32", - "description": "A timestamp when this job or item was modified last (in unix epochs).", - "readOnly": true - }, - "id": { - "type": "string", - "description": "The identifier of the deployment", - "readOnly": true - }, - "model": { - "type": "string", - "description": "The OpenAI model to deploy. Can be a base model or a fine tune." - }, - "owner": { - "type": "string", - "description": "The owner of this deployment. For Azure OpenAI only \"organization-owner\" is\nsupported.", - "readOnly": true - }, - "scale_settings": { - "$ref": "#/definitions/ScaleSettings", - "description": "The scale settings of a deployment. It defines the modes for scaling and the\nreserved capacity." - } - }, - "required": [ - "status", - "created_at", - "updated_at", - "id", - "model", - "scale_settings" - ], - "x-cadl-name": "Azure.Core.Foundations.ResourceOkResponse" + "$ref": "#/definitions/Deployment" } }, "201": { "description": "The request has succeeded and a new resource has been created as a result.", "schema": { - "type": "object", - "properties": { - "object": { - "$ref": "#/definitions/TypeDiscriminator", - "description": "Defines the type of an object.", - "readOnly": true - }, - "status": { - "$ref": "#/definitions/State", - "description": "The state of a job or item.", - "readOnly": true - }, - "created_at": { - "type": "integer", - "format": "int32", - "description": "A timestamp when this job or item was created (in unix epochs).", - "readOnly": true - }, - "updated_at": { - "type": "integer", - "format": "int32", - "description": "A timestamp when this job or item was modified last (in unix epochs).", - "readOnly": true - }, - "id": { - "type": "string", - "description": "The identifier of the deployment", - "readOnly": true - }, - "model": { - "type": "string", - "description": "The OpenAI model to deploy. Can be a base model or a fine tune." - }, - "owner": { - "type": "string", - "description": "The owner of this deployment. For Azure OpenAI only \"organization-owner\" is\nsupported.", - "readOnly": true - }, - "scale_settings": { - "$ref": "#/definitions/ScaleSettings", - "description": "The scale settings of a deployment. It defines the modes for scaling and the\nreserved capacity." - } - }, - "description": "A resource was successfully created.", - "required": [ - "status", - "created_at", - "updated_at", - "id", - "model", - "scale_settings" - ], - "x-cadl-name": "Azure.Core.Foundations.ResourceCreatedResponse" + "$ref": "#/definitions/Deployment" } }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -385,15 +235,15 @@ "summary": "Deletes the deployment specified by the given deployment_id.", "description": "Deletes the deployment specified by the given deployment_id.", "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, { "name": "deploymentId", "in": "path", "required": true, "description": "The identifier of the deployment", "type": "string" - }, - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" } ], "responses": { @@ -402,6 +252,12 @@ }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -428,6 +284,12 @@ }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -443,26 +305,12 @@ "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { - "name": "body", + "name": "resource", "in": "body", + "required": true, + "description": "The resource instance.", "schema": { - "type": "object", - "properties": { - "purpose": { - "$ref": "#/definitions/Purpose", - "description": "The intended purpose of the uploaded documents. Use \"fine-tune\" for\nfine-tuning. This allows us to validate the format of the uploaded file." - }, - "filename": { - "type": "string", - "description": "The name of the file." - } - }, - "description": "The template for adding updateable properties.", - "required": [ - "purpose", - "filename" - ], - "x-cadl-name": "Azure.Core.Foundations.ResourceCreateOrReplaceModel" + "$ref": "#/definitions/File" } } ], @@ -477,60 +325,17 @@ } }, "schema": { - "type": "object", - "properties": { - "object": { - "$ref": "#/definitions/TypeDiscriminator", - "description": "Defines the type of an object.", - "readOnly": true - }, - "status": { - "$ref": "#/definitions/State", - "description": "The state of a job or item.", - "readOnly": true - }, - "created_at": { - "type": "integer", - "format": "int32", - "description": "A timestamp when this job or item was created (in unix epochs).", - "readOnly": true - }, - "updated_at": { - "type": "integer", - "format": "int32", - "description": "A timestamp when this job or item was modified last (in unix epochs).", - "readOnly": true - }, - "id": { - "type": "string", - "description": "The identity of this item.", - "readOnly": true - }, - "bytes": { - "type": "integer", - "format": "int32", - "description": "The size of this file when available (can be null). File sizes larger than\n2^53-1 are not supported to ensure compatibility\nwith JavaScript integers.", - "readOnly": true - }, - "purpose": { - "$ref": "#/definitions/Purpose", - "description": "The intended purpose of the uploaded documents. Use \"fine-tune\" for\nfine-tuning. This allows us to validate the format of the uploaded file." - }, - "filename": { - "type": "string", - "description": "The name of the file." - } - }, - "required": [ - "id", - "purpose", - "filename" - ], - "x-cadl-name": "Azure.Core.Foundations.CustomResponseFields<(anonymous model)>" + "$ref": "#/definitions/File" } }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -544,15 +349,15 @@ "summary": "Gets details for a single file specified by the given file_id including status,\nsize, purpose, etc.", "description": "Gets details for a single file specified by the given file_id including status,\nsize, purpose, etc.", "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, { "name": "fileId", "in": "path", "required": true, "description": "The identity of this item.", "type": "string" - }, - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" } ], "responses": { @@ -564,6 +369,12 @@ }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -575,15 +386,15 @@ "summary": "Deletes the file with the given file_id.\nDeletion is also allowed if a file\nwas used, e.g., as training file in a fine-tune job.", "description": "Deletes the file with the given file_id.\nDeletion is also allowed if a file\nwas used, e.g., as training file in a fine-tune job.", "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, { "name": "fileId", "in": "path", "required": true, "description": "The identity of this item.", "type": "string" - }, - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" } ], "responses": { @@ -592,6 +403,12 @@ }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -605,15 +422,15 @@ "summary": "Gets the content of the file specified by the given file_id.\nFiles can be user\nuploaded content or generated by the service like result metrics of a fine-tune\njob.", "description": "Gets the content of the file specified by the given file_id.\nFiles can be user\nuploaded content or generated by the service like result metrics of a fine-tune\njob.", "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, { "name": "fileId", "in": "path", "required": true, "description": "The identity of this item.", "type": "string" - }, - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" } ], "responses": { @@ -625,6 +442,12 @@ }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -657,8 +480,8 @@ "headers": { "location": { "description": "Location of the newly created item", - "format": "uri", - "type": "string" + "type": "string", + "format": "uri" } }, "schema": { @@ -667,6 +490,12 @@ }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -693,6 +522,12 @@ }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -721,8 +556,8 @@ "headers": { "location": { "description": "Location of the newly created item", - "format": "uri", - "type": "string" + "type": "string", + "format": "uri" } }, "schema": { @@ -731,6 +566,12 @@ }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -744,15 +585,15 @@ "summary": "Gets details for a single fine-tune job specified by the given\nfine_tune_id.\nThe details contain the base model, training and validation\nfiles, hyper parameters, time stamps, status and events.\nEvents are created\nwhen the job status changes, e.g. running or complete, and when results are\nuploaded.", "description": "Gets details for a single fine-tune job specified by the given\nfine_tune_id.\nThe details contain the base model, training and validation\nfiles, hyper parameters, time stamps, status and events.\nEvents are created\nwhen the job status changes, e.g. running or complete, and when results are\nuploaded.", "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, { "name": "fineTuneId", "in": "path", "required": true, "description": "The identity of this item.", "type": "string" - }, - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" } ], "responses": { @@ -764,6 +605,12 @@ }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -775,15 +622,15 @@ "summary": "Deletes the fine-tune job specified by the given fine_tune_id.", "description": "Deletes the fine-tune job specified by the given fine_tune_id.", "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, { "name": "fineTuneId", "in": "path", "required": true, "description": "The identity of this item.", "type": "string" - }, - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" } ], "responses": { @@ -792,6 +639,12 @@ }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -805,15 +658,15 @@ "summary": "Cancels the processing of the fine-tune job specified by the given fine_tune_id.", "description": "Cancels the processing of the fine-tune job specified by the given fine_tune_id.", "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, { "name": "fineTuneId", "in": "path", "required": true, "description": "The identity of this item.", "type": "string" - }, - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" } ], "responses": { @@ -825,6 +678,12 @@ }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -838,6 +697,9 @@ "summary": "List events for the fine-tune job specified by the given fine_tune_id.\nEvents are created when the job status changes, e.g. running or\ncomplete, and when results are uploaded.", "description": "List events for the fine-tune job specified by the given fine_tune_id.\nEvents are created when the job status changes, e.g. running or\ncomplete, and when results are uploaded.", "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, { "name": "fineTuneId", "in": "path", @@ -851,9 +713,6 @@ "required": true, "description": "A flag indicating whether to stream events for the fine-tune job. If set to true,\nevents will be sent as data-only server-sent events as they become available. The stream will terminate with\na data: [DONE] message when the job is finished (succeeded, cancelled, or failed).\nIf set to false, only events generated so far will be returned..", "type": "boolean" - }, - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" } ], "responses": { @@ -865,6 +724,12 @@ }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -891,6 +756,12 @@ }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -904,15 +775,15 @@ "summary": "Gets details for the model specified by the given model_id.", "description": "Gets details for the model specified by the given model_id.", "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, { "name": "model_id", "in": "path", "required": true, "description": "The identity of this item.", "type": "string" - }, - { - "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" } ], "responses": { @@ -924,6 +795,12 @@ }, "default": { "description": "An unexpected error response.", + "headers": { + "x-ms-error-code": { + "description": "String error code indicating what went wrong.", + "type": "string" + } + }, "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" } @@ -954,7 +831,7 @@ "$ref": "#/definitions/Azure.Core.Foundations.Error" }, "x-ms-identifiers": [], - "x-cadl-name": "Azure.Core.Foundations.Error[]", + "x-typespec-name": "Azure.Core.Foundations.Error[]", "description": "An array of details about specific errors that led to this reported error." }, "innererror": { @@ -1027,7 +904,7 @@ "items": { "$ref": "#/definitions/ScaleType" }, - "x-cadl-name": "ScaleType[]", + "x-typespec-name": "ScaleType[]", "description": "The supported scale types for deployments of this model.", "readOnly": true } @@ -1111,11 +988,25 @@ "items": { "$ref": "#/definitions/Deployment" }, - "x-cadl-name": "Deployment[]", + "x-typespec-name": "Deployment[]", "description": "The list of Deployments" } } }, + "DeploymentUpdate": { + "type": "object", + "properties": { + "model": { + "type": "string", + "description": "The OpenAI model to deploy. Can be a base model or a fine tune." + }, + "scale_settings": { + "$ref": "#/definitions/ScaleSettings", + "description": "The scale settings of a deployment. It defines the modes for scaling and the\nreserved capacity." + } + }, + "description": "Deployments manage the reserved quota for Azure OpenAI models and make them\navailable for inference requests." + }, "Deprecation": { "type": "object", "properties": { @@ -1205,7 +1096,7 @@ ], "x-ms-enum": { "name": "ErrorCodeKnownValues", - "modelAsString": false, + "modelAsString": true, "values": [ { "name": "Conflict", @@ -1286,7 +1177,7 @@ "$ref": "#/definitions/Event" }, "x-ms-identifiers": [], - "x-cadl-name": "Event[]", + "x-typespec-name": "Event[]", "description": "The list of Events" } } @@ -1403,7 +1294,7 @@ "items": { "$ref": "#/definitions/File" }, - "x-cadl-name": "File[]", + "x-typespec-name": "File[]", "description": "The list of Files" } } @@ -1452,7 +1343,7 @@ "items": { "$ref": "#/definitions/File" }, - "x-cadl-name": "File[]", + "x-typespec-name": "File[]", "description": "The files that are used for training the fine tuned model." }, "validation_files": { @@ -1460,7 +1351,7 @@ "items": { "$ref": "#/definitions/File" }, - "x-cadl-name": "File[]", + "x-typespec-name": "File[]", "description": "The files that are used to evaluate the fine tuned model during training." }, "result_files": { @@ -1468,7 +1359,7 @@ "items": { "$ref": "#/definitions/File" }, - "x-cadl-name": "File[]", + "x-typespec-name": "File[]", "description": "The result files containing training and evaluation metrics in csv format.\nThe\nfile is only available for successfully completed fine-tune runs.", "readOnly": true }, @@ -1478,7 +1369,7 @@ "$ref": "#/definitions/Event" }, "x-ms-identifiers": [], - "x-cadl-name": "Event[]", + "x-typespec-name": "Event[]", "description": "The events that show the progress of the fine-tune run including queued,\nrunning and completed.", "readOnly": true }, @@ -1548,7 +1439,7 @@ "items": { "$ref": "#/definitions/FineTune" }, - "x-cadl-name": "FineTune[]", + "x-typespec-name": "FineTune[]", "description": "The list of FineTunes" } } @@ -1595,7 +1486,7 @@ "type": "number", "format": "float" }, - "x-cadl-name": "float32[]", + "x-typespec-name": "float32[]", "description": "The classification beta values. If this is provided, we calculate F-beta scores\nat the specified beta values.\nThe F-beta score is a generalization of F-1\nscore. This is only used for binary classification.\nWith a beta of 1 (i.e.the\nF-1 score), precision and recall are given the same weight.\nA larger beta\nscore puts more weight on recall and less on precision. A smaller beta score\nputs more weight on precision and less on recall." } }, @@ -1624,7 +1515,7 @@ ], "x-ms-enum": { "name": "InnerErrorCodeKnownValues", - "modelAsString": false, + "modelAsString": true, "values": [ { "name": "InvalidPayload", @@ -1642,7 +1533,7 @@ ], "x-ms-enum": { "name": "LogLevel", - "modelAsString": false, + "modelAsString": true, "values": [ { "name": "Info", @@ -1751,7 +1642,7 @@ "items": { "$ref": "#/definitions/Model" }, - "x-cadl-name": "Model[]", + "x-typespec-name": "Model[]", "description": "The list of Models" } } @@ -1785,7 +1676,7 @@ ], "x-ms-enum": { "name": "PurposeKnownValues", - "modelAsString": false, + "modelAsString": true, "values": [ { "name": "FineTune", @@ -1841,7 +1732,7 @@ ], "x-ms-enum": { "name": "ScaleTypeKnownValues", - "modelAsString": false, + "modelAsString": true, "values": [ { "name": "Manual", @@ -1877,7 +1768,7 @@ ], "x-ms-enum": { "name": "State", - "modelAsString": false, + "modelAsString": true, "values": [ { "name": "NotRunning", @@ -1959,7 +1850,7 @@ ], "x-ms-enum": { "name": "TypeDiscriminatorKnownValues", - "modelAsString": false, + "modelAsString": true, "values": [ { "name": "List", @@ -1995,7 +1886,7 @@ ], "x-ms-enum": { "name": "Versions", - "modelAsString": false, + "modelAsString": true, "values": [ { "name": "v2022_06_01_preview", @@ -2011,6 +1902,7 @@ "in": "query", "required": true, "description": "The API version to use for this operation.", + "x-ms-client-name": "apiVersion", "minLength": 1, "type": "string", "x-ms-parameter-location": "method" diff --git a/specification/cognitiveservices/OpenAI.Authoring/common.tsp b/specification/cognitiveservices/OpenAI.Authoring/common.tsp index 297faeb9ae8c..d72f1d55552d 100644 --- a/specification/cognitiveservices/OpenAI.Authoring/common.tsp +++ b/specification/cognitiveservices/OpenAI.Authoring/common.tsp @@ -3,6 +3,9 @@ import "@typespec/http"; using TypeSpec.Rest; using TypeSpec.Http; +using Azure.Core; +using Azure.Core.Traits; +using Azure.Core.Traits.Private; namespace Azure.OpenAI; @@ -80,6 +83,22 @@ model CreatedResponse { @doc("Location of the newly created item") @header - @format("uri") - location: string; + location: url; } + +#suppress "@azure-tools/typespec-azure-core/documentation-required" "Template" +#suppress "@azure-tools/typespec-providerhub/no-inline-model" "This operation signature is not used in Azure Resource Manager operations (yet)" +@TypeSpec.Rest.createsResource(TResource) +op CustomResourceCreateWithServiceProvidedName< + TResource extends object, + Traits extends object = {} +> is Azure.Core.Foundations.ResourceCollectionOperation< + TResource, + Azure.Core.Foundations.ResourceBody & + TraitProperties, + Azure.Core.Foundations.LocationOfCreatedResourceResponse & + TResource & + TraitProperties, + Traits, + Azure.Core.Foundations.ErrorResponse +>; diff --git a/specification/cognitiveservices/OpenAI.Authoring/deployment.tsp b/specification/cognitiveservices/OpenAI.Authoring/deployment.tsp index 4ade825eae61..6b1b98eca9cf 100644 --- a/specification/cognitiveservices/OpenAI.Authoring/deployment.tsp +++ b/specification/cognitiveservices/OpenAI.Authoring/deployment.tsp @@ -8,14 +8,18 @@ using TypeSpec.Http; using Azure.Core; interface Deployments { - #suppress "@azure-tools/cadl-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." @summary("Gets the list of deployments owned by the Azure OpenAI resource.") @doc("Gets the list of deployments owned by the Azure OpenAI resource.") - @route("/deployments") + @route("/") @get // TODO: enum value types not supported in csharp emitter, change string literal to TypeDiscriminatorKnownValues enum when fixed - ListDeployments is ServiceCustomizations.OpenAIListOperation; + ListDeployments is ServiceCustomizations.OpenAIListOperation< + Deployment, + "deployment" + >; + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing spec" @summary(""" Creates a new deployment for the Azure OpenAI resource according to the given specification. @@ -24,12 +28,7 @@ specification. Creates a new deployment for the Azure OpenAI resource according to the given specification. """) - CreateDeployment is ResourceCreateWithServiceProvidedName< - Deployment, - { - response: Deployment - } - >; + CreateDeployment is CustomResourceCreateWithServiceProvidedName; @summary("Gets details for a single deployment specified by the given deployment_id.") @doc("Gets details for a single deployment specified by the given deployment_id.") diff --git a/specification/cognitiveservices/OpenAI.Authoring/file.tsp b/specification/cognitiveservices/OpenAI.Authoring/file.tsp index 1356a2292a1f..d407c28d2fe2 100644 --- a/specification/cognitiveservices/OpenAI.Authoring/file.tsp +++ b/specification/cognitiveservices/OpenAI.Authoring/file.tsp @@ -10,9 +10,8 @@ using TypeSpec.Rest; using TypeSpec.Http; using Azure.Core; -interface Files -{ - #suppress "@azure-tools/cadl-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." +interface Files { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." @summary(""" Gets a list of all files owned by the Azure OpenAI resource. These include user uploaded content like files with purpose "fine-tune" for training or @@ -28,11 +27,12 @@ as well as files that are generated by the service such as \"fine-tune-results\" which contains various metrics for the corresponding fine-tune job. """) - @route("/files") + @route("/") @get // TODO: enum value types not supported in csharp emitter, change string literal to TypeDiscriminatorKnownValues enum when fixed ListFiles is ServiceCustomizations.OpenAIListOperation; + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing spec" @summary(""" Creates a new file entity by uploading data from a local machine. Uploaded files can, for example, be used for training or evaluating fine-tuned models. @@ -41,12 +41,7 @@ files can, for example, be used for training or evaluating fine-tuned models. Creates a new file entity by uploading data from a local machine. Uploaded files can, for example, be used for training or evaluating fine-tuned models. """) - UploadFile is ResourceCreateWithServiceProvidedName< - File, - { - response: File - } - >; + UploadFile is CustomResourceCreateWithServiceProvidedName; @summary(""" Gets details for a single file specified by the given file_id including status, @@ -87,7 +82,7 @@ job. @actionSeparator("/") GetFileContent is ResourceAction; - #suppress "@azure-tools/cadl-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." @summary(""" Creates a new file entity by importing data from a provided url. Uploaded files can, for example, be used for training or evaluating fine-tuned models. diff --git a/specification/cognitiveservices/OpenAI.Authoring/finetune.tsp b/specification/cognitiveservices/OpenAI.Authoring/finetune.tsp index beb23f1c1d56..30d053e2661e 100644 --- a/specification/cognitiveservices/OpenAI.Authoring/finetune.tsp +++ b/specification/cognitiveservices/OpenAI.Authoring/finetune.tsp @@ -11,7 +11,7 @@ using TypeSpec.Http; using Azure.Core; interface FineTunes { - #suppress "@azure-tools/cadl-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." @summary(""" Gets a list of all fine-tune jobs owned by the Azure OpenAI resource. The details that are returned for each fine-tune job contain besides its @@ -26,12 +26,15 @@ identifier the base model, training and validation files, hyper parameters, time stamps, status and events. Events are created when the job status changes, e.g. running or complete, and when results are uploaded. """) - @route("/fine-tunes") + @route("/") @get // TODO: enum value types not supported in csharp emitter, change string literal to TypeDiscriminatorKnownValues enum when fixed - ListFineTunes is ServiceCustomizations.OpenAIListOperation; + ListFineTunes is ServiceCustomizations.OpenAIListOperation< + FineTune, + "fine-tune" + >; - #suppress "@azure-tools/cadl-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." @summary(""" Creates a job that fine-tunes a specified model from a given training file. @@ -51,7 +54,7 @@ once complete. @route("/fine-tunes") @post CreateFineTune is Foundations.Operation< - FineTuneCreation, + FineTuneCreation, FineTune & CreatedResponse >; @@ -90,13 +93,17 @@ List events for the fine-tune job specified by the given fine_tune_id. Events are created when the job status changes, e.g. running or complete, and when results are uploaded. """) - @Cadl.Rest.actionSeparator("/") + @TypeSpec.Rest.actionSeparator("/") @get - ListFineTuneEvents is Azure.Core.ResourceAction>; + @query + stream: boolean; + }, + ServiceCustomizations.OpenAiList + >; // #suppress "@azure-tools/cadl-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." @summary("Cancels the processing of the fine-tune job specified by the given fine_tune_id.") diff --git a/specification/cognitiveservices/OpenAI.Authoring/main.tsp b/specification/cognitiveservices/OpenAI.Authoring/main.tsp index 0be8f283aaf8..f2172fef3acc 100644 --- a/specification/cognitiveservices/OpenAI.Authoring/main.tsp +++ b/specification/cognitiveservices/OpenAI.Authoring/main.tsp @@ -11,14 +11,19 @@ using TypeSpec.Rest; using TypeSpec.Http; using TypeSpec.Versioning; +#suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @useAuth( - ApiKeyAuth | - OAuth2Auth<[{ + ApiKeyAuth | OAuth2Auth<[ + { type: OAuth2FlowType.implicit, authorizationUrl: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", - scopes: ["https://cognitiveservices.azure.com/.default"] - }]>) -@service({title: "Azure OpenAI API"}) + scopes: ["https://cognitiveservices.azure.com/.default"], + } + ]> +) +@service({ + title: "Azure OpenAI API", +}) @versioned(Azure.OpenAI.Versions) @server( "{endpoint}/openai", @@ -37,4 +42,4 @@ namespace Azure.OpenAI; enum Versions { @useDependency(Azure.Core.Versions.v1_0_Preview_1) v2022_06_01_preview: "2022-06-01-preview", -} \ No newline at end of file +} diff --git a/specification/cognitiveservices/OpenAI.Authoring/model.routes.tsp b/specification/cognitiveservices/OpenAI.Authoring/model.routes.tsp index 042a19979486..befafec9cf1d 100644 --- a/specification/cognitiveservices/OpenAI.Authoring/model.routes.tsp +++ b/specification/cognitiveservices/OpenAI.Authoring/model.routes.tsp @@ -6,8 +6,8 @@ import "./serviceCustomizations.tsp"; namespace Azure.OpenAI; -using Cadl.Rest; -using Cadl.Http; +using TypeSpec.Rest; +using TypeSpec.Http; using Azure.Core; interface Models { @@ -24,7 +24,7 @@ resource. These include base models as well as all successfully completed fine-tuned models owned by the Azure OpenAI resource. """) - @route("/models") + @route("/") @get // TODO: enum value types not supported in csharp emitter, change string literal to TypeDiscriminatorKnownValues enum when fixed ListModels is ServiceCustomizations.OpenAIListOperation; diff --git a/specification/cognitiveservices/OpenAI.Authoring/models/deployment.models.tsp b/specification/cognitiveservices/OpenAI.Authoring/models/deployment.models.tsp index b53a9e3f377b..ad6b41d233d8 100644 --- a/specification/cognitiveservices/OpenAI.Authoring/models/deployment.models.tsp +++ b/specification/cognitiveservices/OpenAI.Authoring/models/deployment.models.tsp @@ -20,10 +20,12 @@ model Deployment { @visibility("read") status: State; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("A timestamp when this job or item was created (in unix epochs).") @visibility("read") created_at: int32; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("A timestamp when this job or item was modified last (in unix epochs).") @visibility("read") updated_at: int32; @@ -34,7 +36,7 @@ model Deployment { id: string; @doc("The OpenAI model to deploy. Can be a base model or a fine tune.") - "model": string; + `model`: string; @doc(""" The owner of this deployment. For Azure OpenAI only \"organization-owner\" is @@ -43,6 +45,7 @@ supported. @visibility("read") owner?: string; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc(""" The scale settings of a deployment. It defines the modes for scaling and the reserved capacity. diff --git a/specification/cognitiveservices/OpenAI.Authoring/models/file.models.tsp b/specification/cognitiveservices/OpenAI.Authoring/models/file.models.tsp index 251c54baa6a5..ab6c9737cbdf 100644 --- a/specification/cognitiveservices/OpenAI.Authoring/models/file.models.tsp +++ b/specification/cognitiveservices/OpenAI.Authoring/models/file.models.tsp @@ -21,10 +21,12 @@ model File { @visibility("read") status?: State; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("A timestamp when this job or item was created (in unix epochs).") @visibility("read") created_at?: int32; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("A timestamp when this job or item was modified last (in unix epochs).") @visibility("read") updated_at?: int32; @@ -72,6 +74,7 @@ examples. """) filename: string; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc(""" The url to download the document from (can be SAS url of a blob or any other external url accessible with a GET request). @@ -89,4 +92,4 @@ fine-tuning. This allows us to validate the format of the uploaded file. @doc("Gets or sets the file to upload into Azure OpenAI.") file: bytes; -} \ No newline at end of file +} diff --git a/specification/cognitiveservices/OpenAI.Authoring/models/finetune.models.tsp b/specification/cognitiveservices/OpenAI.Authoring/models/finetune.models.tsp index 37137faf8995..28264fbbed00 100644 --- a/specification/cognitiveservices/OpenAI.Authoring/models/finetune.models.tsp +++ b/specification/cognitiveservices/OpenAI.Authoring/models/finetune.models.tsp @@ -19,10 +19,12 @@ model FineTune { @visibility("read") status?: State; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("A timestamp when this job or item was created (in unix epochs).") @visibility("read") created_at?: int32; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("A timestamp when this job or item was modified last (in unix epochs).") @visibility("read") updated_at?: int32; @@ -33,8 +35,9 @@ model FineTune { id: string; @doc("The identifier of the base model used for the fine-tune.") - "model": string; + `model`: string; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc(""" The identifier of the resulting fine tuned model. This property is only populated for successfully completed fine-tune runs. @@ -44,12 +47,15 @@ create a deployment for inferencing. @visibility("read") fine_tuned_model?: string; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("The files that are used for training the fine tuned model.") training_files: File[]; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("The files that are used to evaluate the fine tuned model during training.") validation_files?: File[]; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc(""" The result files containing training and evaluation metrics in csv format. The @@ -65,6 +71,7 @@ running and completed. @visibility("read") events?: Event[]; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc(""" The organisation id of this fine tune job. Unused on Azure OpenAI; compatibility for OpenAI only. @@ -72,6 +79,7 @@ compatibility for OpenAI only. @visibility("read") organisation_id?: string; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc(""" The user id of this fine tune job. Unused on Azure OpenAI; compatibility for OpenAI only. @@ -89,6 +97,7 @@ model Event { @visibility("read") object?: TypeDiscriminator; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("A timestamp when this event was created (in unix epochs).") @visibility("read") created_at?: int32; @@ -107,6 +116,7 @@ enqueued, started, failed or completed, or other events like uploaded results. @doc("The hyper parameter settings used in a fine tune job.") model HyperParameters { + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc(""" The batch size to use for training. The batch size is the number of training examples used to train a single forward and backward pass. @@ -118,6 +128,7 @@ base model. """) batch_size?: int32; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc(""" The learning rate multiplier to use for training. The fine-tuning learning rate is the original learning rate used for pre-training multiplied by this @@ -129,12 +140,14 @@ what produces the best results. """) learning_rate_multiplier?: float32; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc(""" The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. """) n_epochs?: int32; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc(""" The weight to use for loss on the prompt tokens. This controls how much the model tries to learn to generate the prompt @@ -147,6 +160,7 @@ over-prioritizing learning the prompt. """) prompt_loss_weight?: float32; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc(""" A value indicating whether to compute classification metrics. If set, we @@ -161,6 +175,7 @@ classification. """) compute_classification_metrics?: boolean; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc(""" The number of classes in a classification task. This parameter is required for @@ -168,6 +183,7 @@ multiclass classification. """) classification_n_classes?: int32; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc(""" The positive class in binary classification. This parameter is needed to @@ -175,6 +191,7 @@ generate precision, recall, and F1 metrics when doing binary classification. """) classification_positive_class?: string; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc(""" The classification beta values. If this is provided, we calculate F-beta scores at the specified beta values. @@ -192,11 +209,13 @@ puts more weight on precision and less on recall. @doc("Defines the values of a fine tune job.") model FineTuneCreation { @doc("The identifier of the base model used for this fine-tune.") - "model": string; + `model`: string; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("The file that is used for training this fine tuned model.") training_file: string; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("The file that is used to evaluate the fine tuned model during training.") validation_file?: string; diff --git a/specification/cognitiveservices/OpenAI.Authoring/models/model.models.tsp b/specification/cognitiveservices/OpenAI.Authoring/models/model.models.tsp index 5522d86dd6cc..0b86b0987a93 100644 --- a/specification/cognitiveservices/OpenAI.Authoring/models/model.models.tsp +++ b/specification/cognitiveservices/OpenAI.Authoring/models/model.models.tsp @@ -19,14 +19,17 @@ model Model { @visibility("read") status?: State; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("A timestamp when this job or item was created (in unix epochs).") @visibility("read") created_at?: int32; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("A timestamp when this job or item was modified last (in unix epochs).") @visibility("read") updated_at?: int32; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("The identity of this item.") @visibility("read") @key("model_id") @@ -34,8 +37,9 @@ model Model { @doc("The base model ID if this is a fine tune model; otherwise `null`.") @visibility("read") - "model"?: string; + `model`?: string; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("The fine tune job ID if this is a fine tune model; otherwise `null`.") @visibility("read") fine_tune?: string; @@ -56,6 +60,7 @@ models. The exact dates are specified in the properties. @doc("The capabilities of a base or fine tune model.") model Capabilities { + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("A value indicating whether a model can be used for fine tuning.") @visibility("read") fine_tune?: boolean; @@ -72,6 +77,7 @@ model Capabilities { @visibility("read") embeddings?: boolean; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("The supported scale types for deployments of this model.") @visibility("read") scale_types?: ScaleType[]; @@ -86,6 +92,7 @@ fine tuned models. The exact dates are specified in the properties. """) model Deprecation { + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc(""" The end date of fine tune support of this model. Will be `null` for fine tune models. @@ -103,10 +110,12 @@ model ManualScaleSettings extends ScaleSettings { @doc("The constant reserved capacity of the inference endpoint for this deployment.") capacity: int32; + #suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("Defines how scaling operations will be executed.") scale_type: "manual"; } +#suppress "@azure-tools/typespec-azure-core/casing-style" "Existing spec" @doc("Settings for the standard scale type.") model StandardScaleSettings extends ScaleSettings { @doc("Defines how scaling operations will be executed.") diff --git a/specification/cognitiveservices/OpenAI.Authoring/tspconfig.yaml b/specification/cognitiveservices/OpenAI.Authoring/tspconfig.yaml index 1f75eeae3530..3785c43fcd7f 100644 --- a/specification/cognitiveservices/OpenAI.Authoring/tspconfig.yaml +++ b/specification/cognitiveservices/OpenAI.Authoring/tspconfig.yaml @@ -1,7 +1,11 @@ emit: - "@azure-tools/typespec-autorest" - - "@azure-tools/cadl-apiview" -# options: +# - "@azure-tools/typespec-apiview" +options: + "@azure-tools/typespec-autorest": + azure-resource-provider-folder: "cadl-output" + emitter-output-dir: "{project-root}" + output-file: "{azure-resource-provider-folder}/{version}/openapi.json" # Uncomment this line and add "@azure-tools/cadl-python" to your package.json to generate Python code # "@azure-tools/cadl-python": # "basic-setup-py": true diff --git a/specification/cognitiveservices/OpenAI.Inference/models/chat.completions.tsp b/specification/cognitiveservices/OpenAI.Inference/models/chat.completions.tsp index 9b0f7d94c7cd..88a9b3fcdd74 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/chat.completions.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/chat.completions.tsp @@ -139,8 +139,8 @@ model ChatCompletionsOptions { """) @projectedName("json", "model") @projectedName("csharp", "InternalNonAzureModelName") - "model"?: string; -}; + `model`?: string; +} @doc(""" The representation of a single prompt completion as part of an overall chat completions request. @@ -158,7 +158,7 @@ model ChatChoice { @doc("The reason that this chat completions choice completed its generated.") @projectedName("json", "finish_reason") - finishReason: CompletionsFinishReason | null; + finishReason?: CompletionsFinishReason; @doc("The delta message content for a streaming response.") @projectedName("json", "delta") @@ -197,4 +197,4 @@ model ChatCompletions { """) @projectedName("json", "usage") usage: CompletionsUsage; -} \ No newline at end of file +} diff --git a/specification/cognitiveservices/OpenAI.Inference/models/completions.create.tsp b/specification/cognitiveservices/OpenAI.Inference/models/completions.create.tsp index e88329c9e2a3..30c51baf842f 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/completions.create.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/completions.create.tsp @@ -136,8 +136,8 @@ model CompletionsOptions { """) @projectedName("json", "model") @projectedName("csharp", "InternalNonAzureModelName") - "model"?: string; -}; + `model`?: string; +} @doc(""" Representation of the response data from a completions request. @@ -189,11 +189,11 @@ model Choice { @doc("The log probabilities model for tokens associated with this completions choice.") @projectedName("json", "logprobs") @projectedName("csharp", "LogProbabilityModel") - logprobs: CompletionsLogProbabilityModel | null; + logprobs?: CompletionsLogProbabilityModel; @doc("Reason for finishing") @projectedName("json", "finish_reason") - finishReason: CompletionsFinishReason | null; + finishReason?: CompletionsFinishReason; } alias NullableFloat = float32 | null; @@ -220,4 +220,4 @@ model CompletionsLogProbabilityModel { @projectedName("json", "text_offset") @projectedName("csharp", "TextOffsets") textOffset: int32[]; -} \ No newline at end of file +} diff --git a/specification/cognitiveservices/OpenAI.Inference/routes.tsp b/specification/cognitiveservices/OpenAI.Inference/routes.tsp index f5109b082876..5c2cb74af0e3 100644 --- a/specification/cognitiveservices/OpenAI.Inference/routes.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/routes.tsp @@ -1,7 +1,7 @@ import "@azure-tools/typespec-azure-core"; import "@typespec/rest"; import "@typespec/http"; -import "@azure-tools/typespec-client-generator-core"; +//import "@azure-tools/typespec-client-generator-core"; import "./models/completions.create.tsp"; import "./models/chat.completions.tsp"; @@ -10,16 +10,18 @@ import "./models/embeddings.create.tsp"; using TypeSpec.Rest; using TypeSpec.Http; using Azure.Core; -using Azure.ClientGenerator.Core; +//using Azure.ClientGenerator.Core; namespace Azure.OpenAI; @doc("Return the embeddings for a given prompt.") @TypeSpec.Rest.actionSeparator("/") -@action("embeddings") -@convenientAPI(true) -op getEmbeddings is Azure.Core.ResourceAction; - +@action("embeddings") //@convenientAPI(true) +op getEmbeddings is Azure.Core.ResourceAction< + Deployment, + EmbeddingsOptions, + Embeddings +>; @doc(""" Gets completions for the provided input prompts. @@ -27,10 +29,12 @@ Completions support a wide variety of tasks and generate text that continues fro provided prompt data. """) @TypeSpec.Rest.actionSeparator("/") -@action("completions") -@convenientAPI(true) -op getCompletions is Azure.Core.ResourceAction; - +@action("completions") //@convenientAPI(true) +op getCompletions is Azure.Core.ResourceAction< + Deployment, + CompletionsOptions, + Completions +>; @doc(""" Gets chat completions for the provided chat messages. @@ -38,6 +42,9 @@ Completions support a wide variety of tasks and generate text that continues fro provided prompt data. """) @TypeSpec.Rest.actionSeparator("/") -@action("chat/completions") -@convenientAPI(true) -op getChatCompletions is Azure.Core.ResourceAction; +@action("chat/completions") //@convenientAPI(true) +op getChatCompletions is Azure.Core.ResourceAction< + Deployment, + ChatCompletionsOptions, + ChatCompletions +>; diff --git a/specification/cognitiveservices/OpenAI.Inference/tspconfig.yaml b/specification/cognitiveservices/OpenAI.Inference/tspconfig.yaml index 9300c257a2d1..241fa1576e6f 100644 --- a/specification/cognitiveservices/OpenAI.Inference/tspconfig.yaml +++ b/specification/cognitiveservices/OpenAI.Inference/tspconfig.yaml @@ -1,6 +1,6 @@ emit: - - "@azure-tools/typespec-autorest" - - "@azure-tools/cadl-apiview" +# - "@azure-tools/typespec-autorest" +# - "@azure-tools/cadl-apiview" options: # Uncomment this line and add "@azure-tools/cadl-python" to your package.json to generate Python code # "@azure-tools/cadl-python": diff --git a/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-04-30-preview/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-04-30-preview/contentsafety.json index c365ee78d707..cfddf992ac58 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-04-30-preview/contentsafety.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-04-30-preview/contentsafety.json @@ -121,7 +121,7 @@ "type": "string", "format": "uri", "description": "The link to the next page of items", - "x-typespec-name": "Rest.ResourceLocation" + "x-typespec-name": "TypeSpec.Rest.ResourceLocation" } }, "description": "Paged collection of TextBlocklist items", @@ -453,7 +453,7 @@ "type": "string", "format": "uri", "description": "The link to the next page of items", - "x-typespec-name": "Rest.ResourceLocation" + "x-typespec-name": "TypeSpec.Rest.ResourceLocation" } }, "description": "Paged collection of TextBlockItem items", diff --git a/specification/translation/Azure.AI.TextTranslation/tspconfig.yaml b/specification/translation/Azure.AI.TextTranslation/tspconfig.yaml index d203f332194b..d05b3b5c3c0a 100644 --- a/specification/translation/Azure.AI.TextTranslation/tspconfig.yaml +++ b/specification/translation/Azure.AI.TextTranslation/tspconfig.yaml @@ -13,10 +13,10 @@ emit: - "@azure-tools/typespec-autorest" options: "@azure-tools/typespec-autorest": - azure-resource-provider-folder: "../data-plane/Azure.AI.TextTranslation" + azure-resource-provider-folder: "data-plane" emitter-output-dir: "{project-root}/.." examples-directory: "./examples" - output-file: openapi.json + output-file: "{azure-resource-provider-folder}/Azure.AI.TextTranslation/stable/v3.0/openapi.json" "@azure-tools/typespec-csharp": clear-output-folder: true emitter-output-dir: "{csharp-sdk-folder}/sdk/{service-directory-name}/{namespace}/src"