diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/azureopenai.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/azureopenai.json new file mode 100644 index 000000000000..62bed5a0860b --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/azureopenai.json @@ -0,0 +1,1869 @@ +{ + "swagger": "2.0", + "info": { + "title": "Azure OpenAI API version 2023-07-01-preview", + "description": "APIs for fine-tuning, managing deployments of OpenAI models and to support OpenAI DALL-E.", + "version": "2023-07-01-preview" + }, + "paths": { + "/files": { + "get": { + "tags": [ + "Files:" + ], + "summary": "Gets a list of all files owned by the Azure OpenAI resource.\r\nThese include user uploaded content like files with purpose \"fine-tune\" for training or validation of fine-tunes models\r\nas well as files that are generated by the service such as \"fine-tune-results\" which contains various metrics for the corresponding fine-tune job.", + "operationId": "Files_List", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionQueryParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/FileList" + } + }, + "default": { + "description": "An error occurred.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Getting all files owned by this account.": { + "$ref": "./examples/get_files.json" + } + } + }, + "post": { + "tags": [ + "Files:" + ], + "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.", + "operationId": "Files_Upload", + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionQueryParameter" + }, + { + "in": "formData", + "name": "purpose", + "description": "The intended purpose of the uploaded documents. Use \"fine-tune\" for fine-tuning. This allows us to validate the format of the uploaded file.", + "required": true, + "type": "string", + "enum": [ + "fine-tune", + "fine-tune-results" + ], + "x-ms-enum": { + "name": "Purpose", + "modelAsString": true, + "values": [ + { + "value": "fine-tune", + "description": "This file contains training data for a fine tune job." + }, + { + "value": "fine-tune-results", + "description": "This file contains the results of a fine tune job." + } + ] + } + }, + { + "in": "formData", + "name": "file", + "description": "Gets or sets the file to upload into Azure OpenAI.", + "required": true, + "type": "file" + } + ], + "responses": { + "201": { + "description": "The file has been successfully created.", + "schema": { + "$ref": "#/definitions/File" + }, + "headers": { + "Location": { + "description": "The location of the newly created item.", + "type": "string", + "format": "url" + } + } + }, + "default": { + "description": "An error occurred.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Upload a file.": { + "$ref": "./examples/upload_file.json" + } + } + } + }, + "/files/{file-id}": { + "get": { + "tags": [ + "Files:" + ], + "summary": "Gets details for a single file specified by the given file-id including status, size, purpose, etc.", + "operationId": "Files_Get", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "file-id", + "description": "The identifier of the file.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/apiVersionQueryParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/File" + } + }, + "default": { + "description": "An error occurred.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Getting a file.": { + "$ref": "./examples/get_file.json" + } + } + }, + "delete": { + "tags": [ + "Files:" + ], + "summary": "Deletes the file with the given file-id.\r\nDeletion is also allowed if a file was used, e.g., as training file in a fine-tune job.", + "operationId": "Files_Delete", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "file-id", + "description": "The identifier of the file.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/apiVersionQueryParameter" + } + ], + "responses": { + "204": { + "description": "The file was successfully deleted." + }, + "default": { + "description": "An error occurred.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Deleting a file.": { + "$ref": "./examples/delete_file.json" + } + } + } + }, + "/files/{file-id}/content": { + "get": { + "tags": [ + "Files:" + ], + "summary": "Gets the content of the file specified by the given file-id.\r\nFiles can be user uploaded content or generated by the service like result metrics of a fine-tune job.", + "operationId": "Files_GetContent", + "produces": [ + "application/octet-stream", + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "file-id", + "description": "The identifier of the file.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/apiVersionQueryParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "file" + } + }, + "default": { + "description": "An error occurred.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Getting the file content.": { + "$ref": "./examples/get_file_content.json" + } + } + } + }, + "/files/import": { + "post": { + "tags": [ + "Files:" + ], + "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.", + "operationId": "Files_Import", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionQueryParameter" + }, + { + "in": "body", + "name": "fileImport", + "description": "The definition of the file to create including its purpose, the file name and the url of the file location.", + "required": true, + "schema": { + "$ref": "#/definitions/FileImport" + } + } + ], + "responses": { + "201": { + "description": "The file has been successfully created.", + "schema": { + "$ref": "#/definitions/File" + }, + "headers": { + "Location": { + "description": "The location of the newly created item.", + "type": "string", + "format": "url" + } + } + }, + "default": { + "description": "An error occurred.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Importing a file with a blob url as source.": { + "$ref": "./examples/import_file.json" + } + } + } + }, + "/fine-tunes": { + "get": { + "tags": [ + "Fine-tunes:" + ], + "summary": "Gets a list of all fine-tune jobs owned by the Azure OpenAI resource.\r\nThe details that are returned for each fine-tune job contain besides its identifier\r\nthe base model, training and validation files, hyper parameters, time stamps, status and events.\r\nEvents are created when the job status changes, e.g. running or complete, and when results are uploaded.", + "operationId": "FineTunes_List", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionQueryParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/FineTuneList" + } + }, + "default": { + "description": "An error occurred.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Getting all fine tune jobs owned by this account.": { + "$ref": "./examples/get_finetunes.json" + } + } + }, + "post": { + "tags": [ + "Fine-tunes:" + ], + "summary": "Creates a job that fine-tunes a specified model from a given training file.\r\nResponse includes details of the enqueued job including job status and hyper parameters.\r\nThe name of the fine-tuned model is added to the response once complete.", + "operationId": "FineTunes_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionQueryParameter" + }, + { + "in": "body", + "name": "fineTune", + "description": "The specification of the fine-tuned model to create.\r\nRequired parameters are the base model and the training file to use.\r\nOptionally a validation file can be specified to compute validation metrics during training.\r\nHyper parameters will be set to default values or can by optionally specified.\r\nThese include batch size, learning rate multiplier, number of epochs and others.", + "required": true, + "schema": { + "$ref": "#/definitions/FineTuneCreation" + } + } + ], + "responses": { + "201": { + "description": "The fine tune has been successfully created.", + "schema": { + "$ref": "#/definitions/FineTune" + }, + "headers": { + "Location": { + "description": "The location of the newly created item.", + "type": "string", + "format": "url" + } + } + }, + "default": { + "description": "An error occurred.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Creating a fine tune job.": { + "$ref": "./examples/post_finetune.json" + }, + "Creating a fine tune job for classification.": { + "$ref": "./examples/post_classification_finetune.json" + } + } + } + }, + "/fine-tunes/{fine-tune-id}": { + "get": { + "tags": [ + "Fine-tunes:" + ], + "summary": "Gets details for a single fine-tune job specified by the given fine-tune-id.\r\nThe details contain the base model, training and validation files, hyper parameters, time stamps, status and events.\r\nEvents are created when the job status changes, e.g. running or complete, and when results are uploaded.", + "operationId": "FineTunes_Get", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "fine-tune-id", + "description": "The identifier of the fine-tune job.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/apiVersionQueryParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/FineTune" + } + }, + "default": { + "description": "An error occurred.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Getting a fine tune job.": { + "$ref": "./examples/get_finetune.json" + } + } + }, + "delete": { + "tags": [ + "Fine-tunes:" + ], + "summary": "Deletes the fine-tune job specified by the given fine-tune-id.", + "operationId": "FineTunes_Delete", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "fine-tune-id", + "description": "The identifier of the fine-tune job.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/apiVersionQueryParameter" + } + ], + "responses": { + "204": { + "description": "The fine tune was successfully deleted." + }, + "default": { + "description": "An error occurred.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Deleting a fine tune job.": { + "$ref": "./examples/delete_finetune.json" + } + } + } + }, + "/fine-tunes/{fine-tune-id}/events": { + "get": { + "tags": [ + "Fine-tunes:" + ], + "summary": "Gets the events for the fine-tune job specified by the given fine-tune-id.\r\nEvents are created when the job status changes, e.g. running or complete, and when results are uploaded.", + "operationId": "FineTunes_GetEvents", + "produces": [ + "application/json", + "text/event-stream" + ], + "parameters": [ + { + "in": "path", + "name": "fine-tune-id", + "description": "The identifier of the fine-tune job.", + "required": true, + "type": "string" + }, + { + "in": "query", + "name": "stream", + "description": "A flag indicating whether to stream events for the fine-tune job. If set to true,\r\n events will be sent as data-only server-sent events as they become available. The stream will terminate with\r\n a data: [DONE] message when the job is finished (succeeded, cancelled, or failed).\r\n If set to false, only events generated so far will be returned..", + "type": "boolean" + }, + { + "$ref": "#/parameters/apiVersionQueryParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/EventList" + } + }, + "default": { + "description": "An error occurred.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Getting events of a fine tune job.": { + "$ref": "./examples/get_finetune_events.json" + } + } + } + }, + "/fine-tunes/{fine-tune-id}/cancel": { + "post": { + "tags": [ + "Fine-tunes:" + ], + "summary": "Cancels the processing of the fine-tune job specified by the given fine-tune-id.", + "operationId": "FineTunes_Cancel", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "fine-tune-id", + "description": "The identifier of the fine-tune job.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/apiVersionQueryParameter" + } + ], + "responses": { + "200": { + "description": "The fine tune has been successfully canceled", + "schema": { + "$ref": "#/definitions/FineTune" + } + }, + "default": { + "description": "An error occurred.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Canceling a fine tune job.": { + "$ref": "./examples/cancel_finetune.json" + } + } + } + }, + "/images/generations:submit": { + "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", + "format": "uuid" + }, + { + "in": "body", + "name": "body", + "description": "The specification of the images that should be generated.", + "required": true, + "schema": { + "$ref": "#/definitions/GenerateImagesCreation" + } + } + ], + "responses": { + "202": { + "description": "Accepted", + "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-examples": { + "Creating an image generation operation.": { + "$ref": "./examples/post_images_generate.json" + } + } + } + }, + "/models": { + "get": { + "tags": [ + "Models:" + ], + "summary": "Gets a list of all models that are accessible by the Azure OpenAI resource.\r\nThese include base models as well as all successfully completed fine-tuned models owned by the Azure OpenAI resource.", + "operationId": "Models_List", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/apiVersionQueryParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/ModelList" + } + }, + "default": { + "description": "An error occurred.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Getting all models owned by account.": { + "$ref": "./examples/get_models.json" + } + } + } + }, + "/models/{model-id}": { + "get": { + "tags": [ + "Models:" + ], + "summary": "Gets details for the model specified by the given modelId.", + "operationId": "Models_Get", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "model-id", + "description": "The identifier of the model.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/apiVersionQueryParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/Model" + } + }, + "default": { + "description": "An error occurred.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Getting a base model.": { + "$ref": "./examples/get_model_base.json" + }, + "Getting a fine-tuned model.": { + "$ref": "./examples/get_model_finetune.json" + } + } + } + }, + "/operations/images/{operation-id}": { + "get": { + "summary": "Returns the status of the images operation", + "operationId": "OperationsImages_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_images_operation.json" + } + } + }, + "delete": { + "summary": "Deletes an operation (if in terminal state) and all generated and user provided images associated with the operation.", + "operationId": "OperationsImages_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_images_operation.json" + } + } + } + } + }, + "definitions": { + "Capabilities": { + "title": "Capabilities", + "description": "The capabilities of a base or fine tune model.", + "required": [ + "chat_completion", + "completion", + "embeddings", + "fine_tune", + "inference" + ], + "type": "object", + "properties": { + "fine_tune": { + "description": "A value indicating whether a model can be used for fine tuning.", + "type": "boolean" + }, + "inference": { + "description": "A value indicating whether a model can be deployed.", + "type": "boolean" + }, + "completion": { + "description": "A value indicating whether a model supports completion.", + "type": "boolean" + }, + "chat_completion": { + "description": "A value indicating whether a model supports chat completion.", + "type": "boolean" + }, + "embeddings": { + "description": "A value indicating whether a model supports embeddings.", + "type": "boolean" + } + } + }, + "Deprecation": { + "title": "Deprecation", + "description": "Defines the dates of deprecation for the different use cases of a model.\r\nUsually base models support 1 year of fine tuning after creation. Inference is typically supported 2 years after creation of base or\r\nfine tuned models. The exact dates are specified in the properties.", + "required": [ + "inference" + ], + "type": "object", + "properties": { + "fine_tune": { + "format": "unixtime", + "description": "The end date of fine tune support of this model. Will be `null` for fine tune models.", + "type": "integer" + }, + "inference": { + "format": "unixtime", + "description": "The end date of inference support of this model.", + "type": "integer" + } + } + }, + "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).", + "required": [ + "code", + "message" + ], + "readOnly": true, + "type": "object", + "properties": { + "code": { + "$ref": "#/definitions/ErrorCode" + }, + "message": { + "description": "The message of this error.", + "minLength": 1, + "type": "string" + }, + "target": { + "description": "The location where the error happened if available.", + "type": "string" + }, + "details": { + "description": "The error details if available.", + "type": "array", + "items": { + "$ref": "#/definitions/Error" + } + }, + "innererror": { + "$ref": "#/definitions/InnerError" + } + } + }, + "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": [ + "conflict", + "invalidPayload", + "forbidden", + "notFound", + "unexpectedEntityState", + "itemDoesAlreadyExist", + "serviceUnavailable", + "internalFailure", + "quotaExceeded", + "jsonlValidationFailed", + "fileImportFailed", + "tooManyRequests", + "unauthorized", + "contentFilter" + ], + "type": "string", + "x-ms-enum": { + "name": "ErrorCode", + "modelAsString": true, + "values": [ + { + "value": "conflict", + "description": "The requested operation conflicts with the current resource state." + }, + { + "value": "invalidPayload", + "description": "The request data is invalid for this operation." + }, + { + "value": "forbidden", + "description": "The operation is forbidden for the current user/api key." + }, + { + "value": "notFound", + "description": "The resource is not found." + }, + { + "value": "unexpectedEntityState", + "description": "The operation cannot be executed in the current resource's state." + }, + { + "value": "itemDoesAlreadyExist", + "description": "The item does already exist." + }, + { + "value": "serviceUnavailable", + "description": "The service is currently not available." + }, + { + "value": "internalFailure", + "description": "Internal error. Please retry." + }, + { + "value": "quotaExceeded", + "description": "Quota exceeded." + }, + { + "value": "jsonlValidationFailed", + "description": "Validation of jsonl data failed." + }, + { + "value": "fileImportFailed", + "description": "Import of file failed." + }, + { + "value": "tooManyRequests", + "description": "Too many requests. Please retry later." + }, + { + "value": "unauthorized", + "description": "The current user/api key is not authorized for the operation." + }, + { + "value": "contentFilter", + "description": "Image generation failed as a result of our safety system." + } + ] + } + }, + "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" + } + } + }, + "Event": { + "title": "Event", + "required": [ + "created_at", + "level", + "message" + ], + "type": "object", + "properties": { + "object": { + "$ref": "#/definitions/TypeDiscriminator" + }, + "created_at": { + "format": "unixtime", + "description": "A timestamp when this event was created (in unix epochs).", + "type": "integer" + }, + "level": { + "$ref": "#/definitions/LogLevel" + }, + "message": { + "description": "The message describing the event. This can be a change of state, e.g., enqueued, started, failed or completed, or other events like uploaded results.", + "minLength": 1, + "type": "string" + } + } + }, + "EventList": { + "title": "EventList", + "description": "Represents a list of events.", + "type": "object", + "properties": { + "object": { + "$ref": "#/definitions/TypeDiscriminator" + }, + "data": { + "description": "The list of items.", + "type": "array", + "items": { + "$ref": "#/definitions/Event" + } + } + } + }, + "File": { + "title": "File", + "description": "A file is a document usable for training and validation. It can also be a service generated document with result details.", + "required": [ + "filename", + "purpose" + ], + "type": "object", + "properties": { + "object": { + "$ref": "#/definitions/TypeDiscriminator" + }, + "status": { + "$ref": "#/definitions/State" + }, + "created_at": { + "format": "unixtime", + "description": "A timestamp when this job or item was created (in unix epochs).", + "type": "integer", + "readOnly": true + }, + "updated_at": { + "format": "unixtime", + "description": "A timestamp when this job or item was modified last (in unix epochs).", + "type": "integer", + "readOnly": true + }, + "id": { + "description": "The identity of this item.", + "type": "string", + "readOnly": true + }, + "bytes": { + "format": "int64", + "description": "The size of this file when available (can be null). File sizes larger than 2^53-1 are not supported to ensure compatibility\r\nwith JavaScript integers.", + "type": "integer", + "readOnly": true + }, + "purpose": { + "$ref": "#/definitions/Purpose" + }, + "filename": { + "description": "The name of the file.", + "minLength": 1, + "type": "string" + }, + "statistics": { + "$ref": "#/definitions/FileStatistics" + }, + "error": { + "$ref": "#/definitions/Error" + } + } + }, + "FileImport": { + "title": "FileImport", + "description": "Defines a document to import from an external content url to be usable with Azure OpenAI.", + "required": [ + "content_url", + "filename", + "purpose" + ], + "type": "object", + "properties": { + "purpose": { + "$ref": "#/definitions/Purpose" + }, + "filename": { + "description": "The name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded.\r\nIf the `purpose` is set to \"fine-tune\", each line is a JSON record with \"prompt\" and \"completion\" fields representing your training examples.", + "minLength": 1, + "type": "string" + }, + "content_url": { + "format": "url", + "description": "The url to download the document from (can be SAS url of a blob or any other external url accessible with a GET request).", + "type": "string" + } + } + }, + "FileList": { + "title": "FileList", + "description": "Represents a list of files.", + "type": "object", + "properties": { + "object": { + "$ref": "#/definitions/TypeDiscriminator" + }, + "data": { + "description": "The list of items.", + "type": "array", + "items": { + "$ref": "#/definitions/File" + } + } + } + }, + "FileStatistics": { + "title": "FileStatistics", + "description": "A file is a document usable for training and validation. It can also be a service generated document with result details.", + "type": "object", + "properties": { + "tokens": { + "format": "int32", + "description": "The number of tokens used in prompts and completions for files of kind \"fine-tune\" once validation of file content is complete.", + "type": "integer" + }, + "examples": { + "format": "int32", + "description": "The number of contained training examples in files of kind \"fine-tune\" once validation of file content is complete.", + "type": "integer" + } + } + }, + "FineTune": { + "title": "FineTune", + "description": "Fine tuning is a job to tailor a model to specific training data.", + "required": [ + "model", + "training_files" + ], + "type": "object", + "properties": { + "object": { + "$ref": "#/definitions/TypeDiscriminator" + }, + "status": { + "$ref": "#/definitions/State" + }, + "created_at": { + "format": "unixtime", + "description": "A timestamp when this job or item was created (in unix epochs).", + "type": "integer", + "readOnly": true + }, + "updated_at": { + "format": "unixtime", + "description": "A timestamp when this job or item was modified last (in unix epochs).", + "type": "integer", + "readOnly": true + }, + "id": { + "description": "The identity of this item.", + "type": "string", + "readOnly": true + }, + "model": { + "description": "The identifier (model-id) of the base model used for the fine-tune.", + "minLength": 1, + "type": "string" + }, + "fine_tuned_model": { + "description": "The identifier (model-id) of the resulting fine tuned model. This property is only populated for successfully completed fine-tune runs.\r\nUse this identifier to create a deployment for inferencing.", + "type": "string" + }, + "training_files": { + "description": "The file identities (file-id) that are used for training the fine tuned model.", + "type": "array", + "items": { + "$ref": "#/definitions/File" + } + }, + "validation_files": { + "description": "The file identities (file-id) that are used to evaluate the fine tuned model during training.", + "type": "array", + "items": { + "$ref": "#/definitions/File" + } + }, + "result_files": { + "description": "The result file identities (file-id) containing training and evaluation metrics in csv format.\r\nThe file is only available for successfully completed fine-tune runs.", + "type": "array", + "items": { + "$ref": "#/definitions/File" + } + }, + "events": { + "description": "The events that show the progress of the fine-tune run including queued, running and completed.", + "type": "array", + "items": { + "$ref": "#/definitions/Event" + } + }, + "organisation_id": { + "description": "The organisation id of this fine tune job. Unused on Azure OpenAI; compatibility for OpenAI only.", + "type": "string" + }, + "user_id": { + "description": "The user id of this fine tune job. Unused on Azure OpenAI; compatibility for OpenAI only.", + "type": "string" + }, + "hyperparams": { + "$ref": "#/definitions/HyperParameters" + }, + "suffix": { + "description": "The suffix used to identify the fine-tuned model.", + "type": "string" + }, + "error": { + "$ref": "#/definitions/Error" + } + } + }, + "FineTuneCreation": { + "title": "FineTuneCreation", + "description": "Defines the values of a fine tune job.", + "required": [ + "model", + "training_file" + ], + "type": "object", + "properties": { + "model": { + "description": "The identifier (model-id) of the base model used for this fine-tune.", + "minLength": 1, + "type": "string" + }, + "training_file": { + "description": "The file identity (file-id) that is used for training this fine tuned model.", + "minLength": 1, + "type": "string" + }, + "validation_file": { + "description": "The file identity (file-id) that is used to evaluate the fine tuned model during training.", + "type": "string" + }, + "suffix": { + "description": "The suffix used to identify the fine-tuned model. The suffix can contain up to 40 characters (a-z, A-Z, 0-9,- and _) that will be added to your fine-tuned model name.", + "type": "string" + }, + "n_epochs": { + "format": "int32", + "description": "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.", + "type": "integer" + }, + "batch_size": { + "format": "int32", + "description": "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.\r\nIn general, we've found that larger batch sizes tend to work better for larger datasets.\r\nThe default value as well as the maximum value for this property are specific to a base model.", + "type": "integer" + }, + "learning_rate_multiplier": { + "format": "double", + "description": "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 value.\r\nLarger learning rates tend to perform better with larger batch sizes.\r\nWe recommend experimenting with values in the range 0.02 to 0.2 to see what produces the best results.", + "type": "number" + }, + "prompt_loss_weight": { + "format": "double", + "description": "The weight to use for loss on the prompt tokens. This controls how much the model tries to learn to generate the prompt\r\n(as compared to the completion which always has a weight of 1.0), and can add a stabilizing effect to training when completions are short.\r\nIf prompts are extremely long (relative to completions), it may make sense to reduce this weight so as to avoid over-prioritizing learning the prompt.", + "type": "number" + }, + "compute_classification_metrics": { + "description": "A value indicating whether to compute classification metrics.\r\nIf set, we calculate classification-specific metrics such as accuracy and F-1 score using the validation set at the end of every epoch.\r\nThese metrics can be viewed in the results file. In order to compute classification metrics, you must provide a validation_file.Additionally,\r\nyou must specify classification_n_classes for multiclass classification or classification_positive_class for binary classification.", + "type": "boolean" + }, + "classification_n_classes": { + "format": "int32", + "description": "The number of classes in a classification task.\r\nThis parameter is required for multiclass classification.", + "type": "integer" + }, + "classification_positive_class": { + "description": "The positive class in binary classification.\r\nThis parameter is needed to generate precision, recall, and F1 metrics when doing binary classification.", + "type": "string" + }, + "classification_betas": { + "description": "The classification beta values. If this is provided, we calculate F-beta scores at the specified beta values.\r\nThe F-beta score is a generalization of F-1 score. This is only used for binary classification.\r\nWith a beta of 1 (i.e.the F-1 score), precision and recall are given the same weight.\r\nA larger beta score puts more weight on recall and less on precision. A smaller beta score puts more weight on precision and less on recall.", + "type": "array", + "items": { + "format": "double", + "type": "number" + } + } + } + }, + "FineTuneList": { + "title": "FineTuneList", + "description": "Represents a list of fine tunes.", + "type": "object", + "properties": { + "object": { + "$ref": "#/definitions/TypeDiscriminator" + }, + "data": { + "description": "The list of items.", + "type": "array", + "items": { + "$ref": "#/definitions/FineTune" + } + } + } + }, + "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/State" + }, + "id": { + "type": "string", + "format": "uuid", + "description": " The Id of the asynchronous operation that can be used to query its status later." + } + }, + "required": [ + "id", + "status" + ] + }, + "HyperParameters": { + "title": "HyperParameters", + "description": "The hyper parameter settings used in a fine tune job.", + "type": "object", + "properties": { + "batch_size": { + "format": "int32", + "description": "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.\r\nIn general, we've found that larger batch sizes tend to work better for larger datasets.\r\nThe default value as well as the maximum value for this property are specific to a base model.", + "type": "integer" + }, + "learning_rate_multiplier": { + "format": "double", + "description": "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 value.\r\nLarger learning rates tend to perform better with larger batch sizes.\r\nWe recommend experimenting with values in the range 0.02 to 0.2 to see what produces the best results.", + "type": "number" + }, + "n_epochs": { + "format": "int32", + "description": "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.", + "type": "integer" + }, + "prompt_loss_weight": { + "format": "double", + "description": "The weight to use for loss on the prompt tokens. This controls how much the model tries to learn to generate the prompt\r\n(as compared to the completion which always has a weight of 1.0), and can add a stabilizing effect to training when completions are short.\r\nIf prompts are extremely long (relative to completions), it may make sense to reduce this weight so as to avoid over-prioritizing learning the prompt.", + "type": "number" + }, + "compute_classification_metrics": { + "description": "A value indicating whether to compute classification metrics.\r\nIf set, we calculate classification-specific metrics such as accuracy and F-1 score using the validation set at the end of every epoch.\r\nThese metrics can be viewed in the results file. In order to compute classification metrics, you must provide a validation_file.Additionally,\r\nyou must specify classification_n_classes for multiclass classification or classification_positive_class for binary classification.", + "type": "boolean" + }, + "classification_n_classes": { + "format": "int32", + "description": "The number of classes in a classification task.\r\nThis parameter is required for multiclass classification.", + "type": "integer" + }, + "classification_positive_class": { + "description": "The positive class in binary classification.\r\nThis parameter is needed to generate precision, recall, and F1 metrics when doing binary classification.", + "type": "string" + }, + "classification_betas": { + "description": "The classification beta values. If this is provided, we calculate F-beta scores at the specified beta values.\r\nThe F-beta score is a generalization of F-1 score. This is only used for binary classification.\r\nWith a beta of 1 (i.e.the F-1 score), precision and recall are given the same weight.\r\nA larger beta score puts more weight on recall and less on precision. A smaller beta score puts more weight on precision and less on recall.", + "type": "array", + "items": { + "format": "double", + "type": "number" + } + } + } + }, + "ImageResult": { + "title": "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/Error" + } + } + }, + "ImageResults": { + "title": "ImageResults", + "description": "The result data of the operation, if successful", + "type": "array", + "items": { + "$ref": "#/definitions/ImageResult" + } + }, + "InnerError": { + "title": "InnerError", + "description": "Inner error 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": { + "code": { + "$ref": "#/definitions/InnerErrorCode" + }, + "innererror": { + "$ref": "#/definitions/InnerError" + } + } + }, + "InnerErrorCode": { + "title": "InnerErrorCode", + "description": "Inner 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": [ + "invalidPayload" + ], + "type": "string", + "x-ms-enum": { + "name": "InnerErrorCode", + "modelAsString": true, + "values": [ + { + "value": "invalidPayload", + "description": "The request data is invalid for this operation." + } + ] + } + }, + "LifeCycleStatus": { + "title": "LifeCycleStatus", + "description": "The life cycle status of a model.\r\nNote: A model can be promoted from \"preview\" to \"generally-available\", but never from \"generally-available\" to \"preview\".", + "enum": [ + "preview", + "generally-available" + ], + "type": "string", + "x-ms-enum": { + "name": "LifeCycleStatus", + "modelAsString": true, + "values": [ + { + "value": "preview", + "description": "Model is in preview and covered by the service preview terms." + }, + { + "value": "generally-available", + "description": "Model is generally available." + } + ] + } + }, + "LogLevel": { + "title": "LogLevel", + "description": "The verbosity level of an event.", + "enum": [ + "info", + "warning", + "error" + ], + "type": "string", + "x-ms-enum": { + "name": "LogLevel", + "modelAsString": true, + "values": [ + { + "value": "info", + "description": "This event is for information only." + }, + { + "value": "warning", + "description": "This event represents a mitigated issue." + }, + { + "value": "error", + "description": "This message represents a non recoverable issue." + } + ] + } + }, + "Model": { + "title": "Model", + "description": "A model is either a base model or the result of a successful fine tune job.", + "required": [ + "capabilities", + "deprecation", + "lifecycle_status" + ], + "type": "object", + "properties": { + "object": { + "$ref": "#/definitions/TypeDiscriminator" + }, + "status": { + "$ref": "#/definitions/State" + }, + "created_at": { + "format": "unixtime", + "description": "A timestamp when this job or item was created (in unix epochs).", + "type": "integer", + "readOnly": true + }, + "updated_at": { + "format": "unixtime", + "description": "A timestamp when this job or item was modified last (in unix epochs).", + "type": "integer", + "readOnly": true + }, + "id": { + "description": "The identity of this item.", + "type": "string", + "readOnly": true + }, + "model": { + "description": "The base model identity (model-id) if this is a fine tune model; otherwise `null`.", + "type": "string" + }, + "fine_tune": { + "description": "The fine tune job identity (fine-tune-id) if this is a fine tune model; otherwise `null`.", + "type": "string" + }, + "capabilities": { + "$ref": "#/definitions/Capabilities" + }, + "lifecycle_status": { + "$ref": "#/definitions/LifeCycleStatus" + }, + "deprecation": { + "$ref": "#/definitions/Deprecation" + } + } + }, + "ModelList": { + "title": "ModelList", + "description": "Represents a list of models.", + "type": "object", + "properties": { + "object": { + "$ref": "#/definitions/TypeDiscriminator" + }, + "data": { + "description": "The list of items.", + "type": "array", + "items": { + "$ref": "#/definitions/Model" + } + } + } + }, + "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" + }, + "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": { + "created": { + "format": "unixtime", + "description": "A timestamp when this job or item was created (in unix epochs).", + "type": "integer" + }, + "data": { + "$ref": "#/definitions/ImageResults" + } + }, + "required": [ + "created", + "data" + ] + }, + "status": { + "$ref": "#/definitions/State" + }, + "error": { + "$ref": "#/definitions/Error" + } + }, + "required": [ + "id", + "status", + "created" + ] + }, + "Purpose": { + "title": "Purpose", + "description": "The intended purpose of the uploaded documents. Use \"fine-tune\" for fine-tuning. This allows us to validate the format of the uploaded file.", + "enum": [ + "fine-tune", + "fine-tune-results" + ], + "type": "string", + "x-ms-enum": { + "name": "Purpose", + "modelAsString": true, + "values": [ + { + "value": "fine-tune", + "description": "This file contains training data for a fine tune job." + }, + { + "value": "fine-tune-results", + "description": "This file contains the results of a fine tune job." + } + ] + } + }, + "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.", + "name": "Size256x256" + }, + { + "value": "512x512", + "description": "The desired size of the generated image is 512x512 pixels.", + "name": "Size512x512" + }, + { + "value": "1024x1024", + "description": "The desired size of the generated image is 1024x1024 pixels.", + "name": "Size1024x1024" + } + ] + } + }, + "State": { + "title": "State", + "description": "The state of a job or item.", + "enum": [ + "notRunning", + "running", + "succeeded", + "canceled", + "failed", + "deleted" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "State", + "modelAsString": true, + "values": [ + { + "value": "notRunning", + "description": "The operation was created and is 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." + }, + { + "value": "deleted", + "description": "The entity has been deleted but may still be referenced by other entities predating the deletion." + } + ] + } + }, + "TypeDiscriminator": { + "title": "TypeDiscriminator", + "description": "Defines the type of an object.", + "enum": [ + "list", + "fine-tune", + "file", + "fine-tune-event", + "model" + ], + "type": "string", + "readOnly": true, + "x-ms-enum": { + "name": "TypeDiscriminator", + "modelAsString": true, + "values": [ + { + "value": "list", + "description": "This object represents a list of other objects." + }, + { + "value": "fine-tune", + "description": "This object represents a fine tune job." + }, + { + "value": "file", + "description": "This object represents a file." + }, + { + "value": "fine-tune-event", + "description": "This object represents an event of a fine tune job." + }, + { + "value": "model", + "description": "This object represents a model (can be a base models or fine tune job result)." + }, + { + "value": "deployment", + "description": "This object represents a deployment." + } + ] + } + } + }, + "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-07-01-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/preview/2023-07-01-preview/examples/cancel_finetune.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/cancel_finetune.json new file mode 100644 index 000000000000..fb3f774a0293 --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/cancel_finetune.json @@ -0,0 +1,63 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "api-key": "{api key}", + "api-version": "2023-07-01-preview", + "fine-tune-id": "ft-72a2792ef7d24ba7b82c7fe4a37e379f" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "hyperparams": { + "batch_size": 32, + "learning_rate_multiplier": 1, + "n_epochs": 2, + "prompt_loss_weight": 0.1 + }, + "model": "curie", + "training_files": [ + { + "statistics": { + "tokens": 42, + "examples": 23 + }, + "bytes": 140, + "purpose": "fine-tune", + "filename": "puppy.jsonl", + "id": "file-181a1cbdcdcf4677ada87f63a0928099", + "status": "succeeded", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "file" + } + ], + "events": [ + { + "created_at": 1646126127, + "level": "info", + "message": "Job enqueued. Waiting for jobs ahead to complete.", + "object": "fine-tune-event" + }, + { + "created_at": 1646126169, + "level": "info", + "message": "Job started.", + "object": "fine-tune-event" + }, + { + "created_at": 1646126192, + "level": "info", + "message": "Job canceled.", + "object": "fine-tune-event" + } + ], + "id": "ft-72a2792ef7d24ba7b82c7fe4a37e379f", + "status": "canceled", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "fine-tune" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/delete_file.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/delete_file.json new file mode 100644 index 000000000000..80286eb43aa0 --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/delete_file.json @@ -0,0 +1,13 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "api-key": "{api key}", + "api-version": "2023-07-01-preview", + "file-id": "file-181a1cbdcdcf4677ada87f63a0928099" + }, + "responses": { + "204": { + "headers": {} + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/delete_finetune.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/delete_finetune.json new file mode 100644 index 000000000000..bade00fe5eb2 --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/delete_finetune.json @@ -0,0 +1,13 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "api-key": "{api key}", + "api-version": "2023-07-01-preview", + "fine-tune-id": "ft-72a2792ef7d24ba7b82c7fe4a37e379f" + }, + "responses": { + "204": { + "headers": {} + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/delete_images_operation.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/delete_images_operation.json new file mode 100644 index 000000000000..e2119415542b --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/delete_images_operation.json @@ -0,0 +1,15 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "Api-Key": "{api key}", + "api-version": "2023-07-01-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-07-01-preview/examples/get_file.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_file.json new file mode 100644 index 000000000000..a19ef46a70f5 --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_file.json @@ -0,0 +1,27 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "api-key": "{api key}", + "api-version": "2023-07-01-preview", + "file-id": "file-181a1cbdcdcf4677ada87f63a0928099" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "statistics": { + "tokens": 42, + "examples": 23 + }, + "bytes": 140, + "purpose": "fine-tune", + "filename": "puppy.jsonl", + "id": "file-181a1cbdcdcf4677ada87f63a0928099", + "status": "succeeded", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "file" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_file_content.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_file_content.json new file mode 100644 index 000000000000..b10842bbe05c --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_file_content.json @@ -0,0 +1,14 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "api-key": "{api key}", + "api-version": "2023-07-01-preview", + "file-id": "file-181a1cbdcdcf4677ada87f63a0928099" + }, + "responses": { + "200": { + "headers": {}, + "body": "raw file content" + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_files.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_files.json new file mode 100644 index 000000000000..fa45146763ff --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_files.json @@ -0,0 +1,37 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "api-key": "{api key}", + "api-version": "2023-07-01-preview" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "data": [ + { + "bytes": 140, + "purpose": "fine-tune", + "filename": "puppy.jsonl", + "id": "file-181a1cbdcdcf4677ada87f63a0928099", + "status": "succeeded", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "file" + }, + { + "bytes": 32423, + "purpose": "fine-tune-results", + "filename": "results.csv", + "id": "file-181a1cbdcdcf4677ada87f63a0928099", + "status": "succeeded", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "file" + } + ], + "object": "list" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_finetune.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_finetune.json new file mode 100644 index 000000000000..b9aa3af4a448 --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_finetune.json @@ -0,0 +1,76 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "api-key": "{api key}", + "api-version": "2023-07-01-preview", + "fine-tune-id": "ft-72a2792ef7d24ba7b82c7fe4a37e379f" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "hyperparams": { + "batch_size": 32, + "learning_rate_multiplier": 1, + "n_epochs": 2, + "prompt_loss_weight": 0.1 + }, + "model": "curie", + "fine_tuned_model": "curie.ft-72a2792ef7d24ba7b82c7fe4a37e379f", + "training_files": [ + { + "statistics": { + "tokens": 42, + "examples": 23 + }, + "bytes": 140, + "purpose": "fine-tune", + "filename": "puppy.jsonl", + "id": "file-181a1cbdcdcf4677ada87f63a0928099", + "status": "succeeded", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "file" + } + ], + "result_files": [ + { + "bytes": 32423, + "purpose": "fine-tune-results", + "filename": "results.csv", + "id": "file-181a1cbdcdcf4677ada87f63a0928099", + "status": "succeeded", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "file" + } + ], + "events": [ + { + "created_at": 1646126127, + "level": "info", + "message": "Job enqueued. Waiting for jobs ahead to complete.", + "object": "fine-tune-event" + }, + { + "created_at": 1646126169, + "level": "info", + "message": "Job started.", + "object": "fine-tune-event" + }, + { + "created_at": 1646126192, + "level": "info", + "message": "Job succeeded.", + "object": "fine-tune-event" + } + ], + "id": "ft-72a2792ef7d24ba7b82c7fe4a37e379f", + "status": "succeeded", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "fine-tune" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_finetune_events.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_finetune_events.json new file mode 100644 index 000000000000..c0bc35068e5f --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_finetune_events.json @@ -0,0 +1,36 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "api-key": "{api key}", + "api-version": "2023-07-01-preview", + "fine-tune-id": "ft-72a2792ef7d24ba7b82c7fe4a37e379f" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "data": [ + { + "created_at": 1646126127, + "level": "info", + "message": "Job enqueued. Waiting for jobs ahead to complete.", + "object": "fine-tune-event" + }, + { + "created_at": 1646126169, + "level": "info", + "message": "Job started.", + "object": "fine-tune-event" + }, + { + "created_at": 1646126192, + "level": "info", + "message": "Job succeeded.", + "object": "fine-tune-event" + } + ], + "object": "list" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_finetunes.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_finetunes.json new file mode 100644 index 000000000000..bf9d40f73234 --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_finetunes.json @@ -0,0 +1,80 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "api-key": "{api key}", + "api-version": "2023-07-01-preview" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "data": [ + { + "hyperparams": { + "batch_size": 32, + "learning_rate_multiplier": 1, + "n_epochs": 2, + "prompt_loss_weight": 0.1 + }, + "model": "curie", + "fine_tuned_model": "curie.ft-72a2792ef7d24ba7b82c7fe4a37e379f", + "training_files": [ + { + "statistics": { + "tokens": 42, + "examples": 23 + }, + "bytes": 140, + "purpose": "fine-tune", + "filename": "puppy.jsonl", + "id": "file-181a1cbdcdcf4677ada87f63a0928099", + "status": "succeeded", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "file" + } + ], + "result_files": [ + { + "bytes": 32423, + "purpose": "fine-tune-results", + "filename": "results.csv", + "id": "file-181a1cbdcdcf4677ada87f63a0928099", + "status": "succeeded", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "file" + } + ], + "events": [ + { + "created_at": 1646126127, + "level": "info", + "message": "Job enqueued. Waiting for jobs ahead to complete.", + "object": "fine-tune-event" + }, + { + "created_at": 1646126169, + "level": "info", + "message": "Job started.", + "object": "fine-tune-event" + }, + { + "created_at": 1646126192, + "level": "info", + "message": "Job succeeded.", + "object": "fine-tune-event" + } + ], + "id": "ft-72a2792ef7d24ba7b82c7fe4a37e379f", + "status": "succeeded", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "fine-tune" + } + ], + "object": "list" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_images_operation.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_images_operation.json new file mode 100644 index 000000000000..b0dfdc4dbcfc --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_images_operation.json @@ -0,0 +1,29 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "Api-Key": "{api key}", + "api-version": "2023-07-01-preview", + "operation-id": "f508bcf2-e651-4b4b-85a7-58ad77981ffa" + }, + "responses": { + "200": { + "headers": { + "x-ms-request-id": "29fd3fe5-ab2f-44e0-aefa-0dfe9bd1c03f" + }, + "body": { + "created": 1679320850, + "result": { + "created": 1679320850, + "data": [ + { + "url": "https://aoairesource.blob.core.windows.net/private/images?SAS-token" + } + ] + }, + "expires": 1679407255, + "id": "41dc2981-bf72-492a-b4fe-7eed680a1681", + "status": "succeeded" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_model_base.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_model_base.json new file mode 100644 index 000000000000..f74017fc5f98 --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_model_base.json @@ -0,0 +1,32 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "api-key": "{api key}", + "api-version": "2023-07-01-preview", + "model-id": "curie" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "capabilities": { + "fine_tune": true, + "inference": true, + "completion": true, + "chat_completion": false, + "embeddings": false + }, + "lifecycle_status": "generally-available", + "deprecation": { + "fine_tune": 1677662127, + "inference": 1709284527 + }, + "id": "curie", + "status": "succeeded", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "model" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_model_finetune.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_model_finetune.json new file mode 100644 index 000000000000..86f87bf96793 --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_model_finetune.json @@ -0,0 +1,33 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "api-key": "{api key}", + "api-version": "2023-07-01-preview", + "model-id": "curie.ft-72a2792ef7d24ba7b82c7fe4a37e379f" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "model": "curie", + "fine_tune": "ft-72a2792ef7d24ba7b82c7fe4a37e379f", + "capabilities": { + "fine_tune": false, + "inference": true, + "completion": true, + "chat_completion": false, + "embeddings": false + }, + "lifecycle_status": "generally-available", + "deprecation": { + "inference": 1709284527 + }, + "id": "curie.ft-72a2792ef7d24ba7b82c7fe4a37e379f", + "status": "succeeded", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "model" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_models.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_models.json new file mode 100644 index 000000000000..47e6dd499133 --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/get_models.json @@ -0,0 +1,56 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "api-key": "{api key}", + "api-version": "2023-07-01-preview" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "data": [ + { + "capabilities": { + "fine_tune": true, + "inference": true, + "completion": true, + "chat_completion": false, + "embeddings": false + }, + "lifecycle_status": "generally-available", + "deprecation": { + "fine_tune": 1677662127, + "inference": 1709284527 + }, + "id": "curie", + "status": "succeeded", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "model" + }, + { + "model": "curie", + "fine_tune": "ft-72a2792ef7d24ba7b82c7fe4a37e379f", + "capabilities": { + "fine_tune": false, + "inference": true, + "completion": true, + "chat_completion": false, + "embeddings": false + }, + "lifecycle_status": "generally-available", + "deprecation": { + "inference": 1709284527 + }, + "id": "curie.ft-72a2792ef7d24ba7b82c7fe4a37e379f", + "status": "succeeded", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "model" + } + ], + "object": "list" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/import_file.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/import_file.json new file mode 100644 index 000000000000..1eae74ec023a --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/import_file.json @@ -0,0 +1,29 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "api-key": "{api key}", + "api-version": "2023-07-01-preview", + "fileImport": { + "purpose": "fine-tune", + "filename": "puppy.jsonl", + "content_url": "https://www.contoso.com/trainingdata/puppy.jsonl" + }, + "content-Type": "application/json" + }, + "responses": { + "201": { + "headers": { + "location": "https://aoairesource.openai.azure.com/openai/files/file-181a1cbdcdcf4677ada87f63a0928099" + }, + "body": { + "purpose": "fine-tune", + "filename": "puppy.jsonl", + "id": "file-181a1cbdcdcf4677ada87f63a0928099", + "status": "notRunning", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "file" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/post_classification_finetune.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/post_classification_finetune.json new file mode 100644 index 000000000000..76dbeefeb29d --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/post_classification_finetune.json @@ -0,0 +1,53 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "api-key": "{api key}", + "api-version": "2023-07-01-preview", + "fineTune": { + "compute_classification_metrics": true, + "classification_n_classes": 4, + "model": "curie", + "training_file": "file-181a1cbdcdcf4677ada87f63a0928099" + }, + "content-Type": "application/json" + }, + "responses": { + "201": { + "headers": { + "location": "https://aoairesource.openai.azure.com/openai/fine-tunes/ft-72a2792ef7d24ba7b82c7fe4a37e379f" + }, + "body": { + "hyperparams": { + "compute_classification_metrics": true, + "classification_n_classes": 4, + "batch_size": 32, + "learning_rate_multiplier": 1, + "n_epochs": 2, + "prompt_loss_weight": 0.1 + }, + "model": "curie", + "training_files": [ + { + "statistics": { + "tokens": 42, + "examples": 23 + }, + "bytes": 140, + "purpose": "fine-tune", + "filename": "puppy.jsonl", + "id": "file-181a1cbdcdcf4677ada87f63a0928099", + "status": "succeeded", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "file" + } + ], + "id": "ft-72a2792ef7d24ba7b82c7fe4a37e379f", + "status": "notRunning", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "fine-tune" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/post_finetune.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/post_finetune.json new file mode 100644 index 000000000000..348aa9f851a0 --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/post_finetune.json @@ -0,0 +1,49 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "api-key": "{api key}", + "api-version": "2023-07-01-preview", + "fineTune": { + "model": "curie", + "training_file": "file-181a1cbdcdcf4677ada87f63a0928099" + }, + "content-Type": "application/json" + }, + "responses": { + "201": { + "headers": { + "location": "https://aoairesource.openai.azure.com/openai/fine-tunes/ft-72a2792ef7d24ba7b82c7fe4a37e379f" + }, + "body": { + "hyperparams": { + "batch_size": 32, + "learning_rate_multiplier": 1, + "n_epochs": 2, + "prompt_loss_weight": 0.1 + }, + "model": "curie", + "training_files": [ + { + "statistics": { + "tokens": 42, + "examples": 23 + }, + "bytes": 140, + "purpose": "fine-tune", + "filename": "puppy.jsonl", + "id": "file-181a1cbdcdcf4677ada87f63a0928099", + "status": "succeeded", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "file" + } + ], + "id": "ft-72a2792ef7d24ba7b82c7fe4a37e379f", + "status": "notRunning", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "fine-tune" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/post_images_generate.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/post_images_generate.json new file mode 100644 index 000000000000..2b13d73db1a9 --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/post_images_generate.json @@ -0,0 +1,25 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "Api-Key": "{api key}", + "api-version": "2023-07-01-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-07-01-preview", + "x-ms-request-id": "29fd3fe5-ab2f-44e0-aefa-0dfe9bd1c03f" + }, + "body": { + "id": "f508bcf2-e651-4b4b-85a7-58ad77981ffa", + "status": "notRunning" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/upload_file.json b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/upload_file.json new file mode 100644 index 000000000000..78c5fd5d85f1 --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2023-07-01-preview/examples/upload_file.json @@ -0,0 +1,26 @@ +{ + "parameters": { + "endpoint": "https://aoairesource.openai.azure.com", + "api-key": "{api key}", + "api-version": "2023-07-01-preview", + "purpose": "fine-tune", + "content-Type": "multipart/form-data", + "file": "raw file content" + }, + "responses": { + "201": { + "headers": { + "location": "https://aoairesource.openai.azure.com/openai/files/file-181a1cbdcdcf4677ada87f63a0928099" + }, + "body": { + "purpose": "fine-tune", + "filename": "puppy.jsonl", + "id": "file-181a1cbdcdcf4677ada87f63a0928099", + "status": "notRunning", + "created_at": 1646126127, + "updated_at": 1646127311, + "object": "file" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/readme.md b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/readme.md index d1a9d0ede120..02ae8bf1af5e 100644 --- a/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/readme.md +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/readme.md @@ -125,3 +125,23 @@ directive: - suppress: IntegerTypeMustHaveFormat reason: API stewardship board recommend to use format "unixtime" which is not supported by linter at the moment. ``` + +## AzureOpenAI 2023-07-01-preview +These settings apply only when `--tag=release_2023_07_01_preview` is specified on the command line. + +``` yaml $(tag) == 'release_2023_07_01_preview' +input-file: preview/2023-07-01-preview/azureopenai.json +``` + +AutoRest-Linter Suppressions + +``` yaml +# Ignore autorest-linter issues that cannot be resolved without breaking compatibility to existing openai api +directive: + - suppress: DefinitionsPropertiesNamesCamelCase + reason: Existing external API uses property names like n_epochs, created_at, not following naming/casing guidelines from azure. + - 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. +``` diff --git a/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2023-07-01-preview/inference.json b/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2023-07-01-preview/inference.json new file mode 100644 index 000000000000..6bbbcdedcb24 --- /dev/null +++ b/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2023-07-01-preview/inference.json @@ -0,0 +1,1339 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Azure OpenAI Service API", + "description": "Azure OpenAI APIs for completions and search", + "version": "2023-07-01-preview" + }, + "servers": [ + { + "url": "https://{endpoint}/openai", + "variables": { + "endpoint": { + "default": "your-resource-name.openai.azure.com" + } + } + } + ], + "security": [ + { + "bearer": [ + "api.read" + ] + }, + { + "apiKey": [] + } + ], + "paths": { + "/deployments/{deployment-id}/completions": { + "post": { + "summary": "Creates a completion for the provided prompt, parameters and chosen model.", + "operationId": "Completions_Create", + "parameters": [ + { + "in": "path", + "name": "deployment-id", + "required": true, + "schema": { + "type": "string", + "example": "davinci", + "description": "Deployment id of the model which was deployed." + } + }, + { + "in": "query", + "name": "api-version", + "required": true, + "schema": { + "type": "string", + "example": "2023-07-01-preview", + "description": "api version" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "prompt": { + "description": "The prompt(s) to generate completions for, encoded as a string or array of strings.\nNote that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document. Maximum allowed size of string list is 2048.", + "oneOf": [ + { + "type": "string", + "default": "", + "example": "This is a test.", + "nullable": true + }, + { + "type": "array", + "items": { + "type": "string", + "default": "", + "example": "This is a test.", + "nullable": false + }, + "description": "Array size minimum of 1 and maximum of 2048" + } + ] + }, + "max_tokens": { + "description": "The token count of your prompt plus max_tokens cannot exceed the model's context length. Most models have a context length of 2048 tokens (except for the newest models, which support 4096). Has minimum of 0.", + "type": "integer", + "default": 16, + "example": 16, + "nullable": true + }, + "temperature": { + "description": "What sampling temperature to use. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer.\nWe generally recommend altering this or top_p but not both.", + "type": "number", + "default": 1, + "example": 1, + "nullable": true + }, + "top_p": { + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\nWe generally recommend altering this or temperature but not both.", + "type": "number", + "default": 1, + "example": 1, + "nullable": true + }, + "logit_bias": { + "description": "Defaults to null. Modify the likelihood of specified tokens appearing in the completion. Accepts a json object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this tokenizer tool (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. As an example, you can pass {\"50256\" : -100} to prevent the <|endoftext|> token from being generated.", + "type": "object", + "nullable": false + }, + "user": { + "description": "A unique identifier representing your end-user, which can help monitoring and detecting abuse", + "type": "string", + "nullable": false + }, + "n": { + "description": "How many completions to generate for each prompt. Minimum of 1 and maximum of 128 allowed.\nNote: Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for max_tokens and stop.", + "type": "integer", + "default": 1, + "example": 1, + "nullable": true + }, + "stream": { + "description": "Whether to stream back partial progress. If set, tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.", + "type": "boolean", + "nullable": true, + "default": false + }, + "logprobs": { + "description": "Include the log probabilities on the logprobs most likely tokens, as well the chosen tokens. For example, if logprobs is 5, the API will return a list of the 5 most likely tokens. The API will always return the logprob of the sampled token, so there may be up to logprobs+1 elements in the response.\nMinimum of 0 and maximum of 5 allowed.", + "type": "integer", + "default": null, + "nullable": true + }, + "suffix": { + "type": "string", + "nullable": true, + "description": "The suffix that comes after a completion of inserted text." + }, + "echo": { + "description": "Echo back the prompt in addition to the completion", + "type": "boolean", + "default": false, + "nullable": true + }, + "stop": { + "description": "Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.", + "oneOf": [ + { + "type": "string", + "default": "<|endoftext|>", + "example": "\n", + "nullable": true + }, + { + "type": "array", + "items": { + "type": "string", + "example": "\n", + "nullable": false + }, + "description": "Array minimum size of 1 and maximum of 4" + } + ] + }, + "completion_config": { + "type": "string", + "nullable": true + }, + "cache_level": { + "description": "can be used to disable any server-side caching, 0=no cache, 1=prompt prefix enabled, 2=full cache", + "type": "integer", + "nullable": true + }, + "presence_penalty": { + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.", + "type": "number", + "default": 0 + }, + "frequency_penalty": { + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.", + "type": "number", + "default": 0 + }, + "best_of": { + "description": "Generates best_of completions server-side and returns the \"best\" (the one with the highest log probability per token). Results cannot be streamed.\nWhen used with n, best_of controls the number of candidate completions and n specifies how many to return - best_of must be greater than n.\nNote: Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for max_tokens and stop. Has maximum value of 128.", + "type": "integer" + } + } + }, + "example": { + "prompt": "Negate the following sentence.The price for bubblegum increased on thursday.\n\n Negated Sentence:", + "max_tokens": 50 + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "object": { + "type": "string" + }, + "created": { + "type": "integer" + }, + "model": { + "type": "string" + }, + "prompt_filter_results": { + "$ref": "#/components/schemas/promptFilterResults" + }, + "choices": { + "type": "array", + "items": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "index": { + "type": "integer" + }, + "logprobs": { + "type": "object", + "properties": { + "tokens": { + "type": "array", + "items": { + "type": "string" + } + }, + "token_logprobs": { + "type": "array", + "items": { + "type": "number" + } + }, + "top_logprobs": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "number" + } + } + }, + "text_offset": { + "type": "array", + "items": { + "type": "integer" + } + } + }, + "nullable": true + }, + "finish_reason": { + "type": "string" + }, + "content_filter_results": { + "$ref": "#/components/schemas/contentFilterResults" + } + } + } + }, + "usage": { + "type": "object", + "properties": { + "completion_tokens": { + "type": "number", + "format": "int32" + }, + "prompt_tokens": { + "type": "number", + "format": "int32" + }, + "total_tokens": { + "type": "number", + "format": "int32" + } + }, + "required": [ + "prompt_tokens", + "total_tokens", + "completion_tokens" + ] + } + }, + "required": [ + "id", + "object", + "created", + "model", + "choices" + ] + }, + "example": { + "model": "davinci", + "object": "text_completion", + "id": "cmpl-4509KAos68kxOqpE2uYGw81j6m7uo", + "created": 1637097562, + "choices": [ + { + "index": 0, + "text": "The price for bubblegum decreased on thursday.", + "logprobs": null, + "finish_reason": "stop" + } + ] + } + } + }, + "headers": { + "apim-request-id": { + "description": "Request ID for troubleshooting purposes", + "schema": { + "type": "string" + } + } + } + }, + "default": { + "description": "Service unavailable", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/errorResponse" + } + } + }, + "headers": { + "apim-request-id": { + "description": "Request ID for troubleshooting purposes", + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/deployments/{deployment-id}/embeddings": { + "post": { + "summary": "Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.", + "operationId": "embeddings_create", + "parameters": [ + { + "in": "path", + "name": "deployment-id", + "required": true, + "schema": { + "type": "string", + "example": "ada-search-index-v1" + }, + "description": "The deployment id of the model which was deployed." + }, + { + "in": "query", + "name": "api-version", + "required": true, + "schema": { + "type": "string", + "example": "2023-07-01-preview", + "description": "api version" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": true, + "properties": { + "input": { + "description": "Input text to get embeddings for, encoded as a string. To get embeddings for multiple inputs in a single request, pass an array of strings. Each input must not exceed 2048 tokens in length.\nUnless you are embedding code, we suggest replacing newlines (\\n) in your input with a single space, as we have observed inferior results when newlines are present.", + "oneOf": [ + { + "type": "string", + "default": "", + "example": "This is a test.", + "nullable": true + }, + { + "type": "array", + "minItems": 1, + "maxItems": 2048, + "items": { + "type": "string", + "minLength": 1, + "example": "This is a test.", + "nullable": false + } + } + ] + }, + "user": { + "description": "A unique identifier representing your end-user, which can help monitoring and detecting abuse.", + "type": "string", + "nullable": false + }, + "input_type": { + "description": "input type of embedding search to use", + "type": "string", + "example": "query" + } + }, + "required": [ + "input" + ] + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "object": { + "type": "string" + }, + "model": { + "type": "string" + }, + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "index": { + "type": "integer" + }, + "object": { + "type": "string" + }, + "embedding": { + "type": "array", + "items": { + "type": "number" + } + } + }, + "required": [ + "index", + "object", + "embedding" + ] + } + }, + "usage": { + "type": "object", + "properties": { + "prompt_tokens": { + "type": "integer" + }, + "total_tokens": { + "type": "integer" + } + }, + "required": [ + "prompt_tokens", + "total_tokens" + ] + } + }, + "required": [ + "object", + "model", + "data", + "usage" + ] + } + } + } + } + } + } + }, + "/deployments/{deployment-id}/chat/completions": { + "post": { + "summary": "Creates a completion for the chat message", + "operationId": "ChatCompletions_Create", + "parameters": [ + { + "in": "path", + "name": "deployment-id", + "required": true, + "schema": { + "type": "string", + "description": "Deployment id of the model which was deployed." + } + }, + { + "in": "query", + "name": "api-version", + "required": true, + "schema": { + "type": "string", + "example": "2023-07-01-preview", + "description": "api version" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/createChatCompletionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/createChatCompletionResponse" + } + } + }, + "headers": { + "apim-request-id": { + "description": "Request ID for troubleshooting purposes", + "schema": { + "type": "string" + } + } + } + }, + "default": { + "description": "Service unavailable", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/errorResponse" + } + } + }, + "headers": { + "apim-request-id": { + "description": "Request ID for troubleshooting purposes", + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/deployments/{deployment-id}/extensions/chat/completions": { + "post": { + "summary": "Using extensions to creates a completion for the chat messages.", + "operationId": "ExtensionsChatCompletions_Create", + "parameters": [ + { + "in": "path", + "name": "deployment-id", + "required": true, + "schema": { + "type": "string", + "description": "Deployment id of the model which was deployed." + } + }, + { + "in": "query", + "name": "api-version", + "required": true, + "schema": { + "type": "string", + "example": "2023-07-01-preview", + "description": "api version" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/extensionsChatCompletionsRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/extensionsChatCompletionsResponse" + } + } + }, + "headers": { + "apim-request-id": { + "description": "Request ID for troubleshooting purposes", + "schema": { + "type": "string" + } + } + } + }, + "default": { + "description": "Service unavailable", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/errorResponse" + } + } + }, + "headers": { + "apim-request-id": { + "description": "Request ID for troubleshooting purposes", + "schema": { + "type": "string" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "errorResponse": { + "type": "object", + "properties": { + "error": { + "$ref": "#/components/schemas/error" + } + } + }, + "errorBase": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "error": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/errorBase" + } + ], + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "type": { + "type": "string" + }, + "inner_error": { + "$ref": "#/components/schemas/innerError" + } + } + }, + "innerError": { + "description": "Inner error with additional details.", + "type": "object", + "properties": { + "code": { + "$ref": "#/components/schemas/innerErrorCode" + }, + "content_filter_results": { + "$ref": "#/components/schemas/contentFilterResults" + } + } + }, + "innerErrorCode": { + "description": "Error codes for the inner error object.", + "enum": [ + "ResponsibleAIPolicyViolation" + ], + "type": "string", + "x-ms-enum": { + "name": "InnerErrorCode", + "modelAsString": true, + "values": [ + { + "value": "ResponsibleAIPolicyViolation", + "description": "The prompt violated one of more content filter rules." + } + ] + } + }, + "contentFilterResult": { + "type": "object", + "properties": { + "severity": { + "type": "string", + "enum": [ + "safe", + "low", + "medium", + "high" + ], + "x-ms-enum": { + "name": "ContentFilterSeverity", + "modelAsString": true, + "values": [ + { + "value": "safe", + "description": "General content or related content in generic or non-harmful contexts." + }, + { + "value": "low", + "description": "Harmful content at a low intensity and risk level." + }, + { + "value": "medium", + "description": "Harmful content at a medium intensity and risk level." + }, + { + "value": "high", + "description": "Harmful content at a high intensity and risk level." + } + ] + } + }, + "filtered": { + "type": "boolean" + } + }, + "required": [ + "severity", + "filtered" + ] + }, + "contentFilterResults": { + "type": "object", + "description": "Information about the content filtering category (hate, sexual, violence, self_harm), if it has been detected, as well as the severity level (very_low, low, medium, high-scale that determines the intensity and risk level of harmful content) and if it has been filtered or not.", + "properties": { + "sexual": { + "$ref": "#/components/schemas/contentFilterResult" + }, + "violence": { + "$ref": "#/components/schemas/contentFilterResult" + }, + "hate": { + "$ref": "#/components/schemas/contentFilterResult" + }, + "self_harm": { + "$ref": "#/components/schemas/contentFilterResult" + }, + "error": { + "$ref": "#/components/schemas/errorBase" + } + } + }, + "promptFilterResult": { + "type": "object", + "description": "Content filtering results for a single prompt in the request.", + "properties": { + "prompt_index": { + "type": "integer" + }, + "content_filter_results": { + "$ref": "#/components/schemas/contentFilterResults" + } + } + }, + "promptFilterResults": { + "type": "array", + "description": "Content filtering results for zero or more prompts in the request. In a streaming request, results for different prompts may arrive at different times or in different orders.", + "items": { + "$ref": "#/components/schemas/promptFilterResult" + } + }, + "chatCompletionsRequestCommon": { + "type": "object", + "properties": { + "temperature": { + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.", + "type": "number", + "minimum": 0, + "maximum": 2, + "default": 1, + "example": 1, + "nullable": true + }, + "top_p": { + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\nWe generally recommend altering this or `temperature` but not both.", + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 1, + "example": 1, + "nullable": true + }, + "stream": { + "description": "If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a `data: [DONE]` message.", + "type": "boolean", + "nullable": true, + "default": false + }, + "stop": { + "description": "Up to 4 sequences where the API will stop generating further tokens.", + "oneOf": [ + { + "type": "string", + "nullable": true + }, + { + "type": "array", + "items": { + "type": "string", + "nullable": false + }, + "minItems": 1, + "maxItems": 4, + "description": "Array minimum size of 1 and maximum of 4" + } + ], + "default": null + }, + "max_tokens": { + "description": "The maximum number of tokens allowed for the generated answer. By default, the number of tokens the model can return will be (4096 - prompt tokens).", + "type": "integer", + "default": 4096 + }, + "presence_penalty": { + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.", + "type": "number", + "default": 0, + "minimum": -2, + "maximum": 2 + }, + "frequency_penalty": { + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.", + "type": "number", + "default": 0, + "minimum": -2, + "maximum": 2 + }, + "logit_bias": { + "description": "Modify the likelihood of specified tokens appearing in the completion. Accepts a json object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.", + "type": "object", + "nullable": true + }, + "user": { + "description": "A unique identifier representing your end-user, which can help Azure OpenAI to monitor and detect abuse.", + "type": "string", + "example": "user-1234", + "nullable": false + } + } + }, + "createChatCompletionRequest": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/chatCompletionsRequestCommon" + }, + { + "properties": { + "messages": { + "description": "A list of messages comprising the conversation so far. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb).", + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/components/schemas/chatCompletionRequestMessage" + } + }, + "functions": { + "description": "A list of functions the model may generate JSON inputs for.", + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/components/schemas/chatCompletionFunctions" + } + }, + "function_call": { + "description": "Controls how the model responds to function calls. \"none\" means the model does not call a function, and responds to the end-user. \"auto\" means the model can pick between an end-user or calling a function. Specifying a particular function via `{\"name\":\\ \"my_function\"}` forces the model to call that function. \"none\" is the default when no functions are present. \"auto\" is the default if functions are present.", + "oneOf": [ + { + "type": "string", + "enum": [ + "none", + "auto" + ] + }, + { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the function to call." + } + }, + "required": [ + "name" + ] + } + ] + }, + "n": { + "type": "integer", + "minimum": 1, + "maximum": 128, + "default": 1, + "example": 1, + "nullable": true, + "description": "How many chat completion choices to generate for each input message." + } + } + } + ], + "required": [ + "messages" + ] + }, + "chatCompletionFunctions": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64." + }, + "description": { + "type": "string", + "description": "The description of what the function does." + }, + "parameters": { + "$ref": "#/components/schemas/chatCompletionFunctionParameters" + } + }, + "required": [ + "name" + ] + }, + "chatCompletionFunctionParameters": { + "type": "object", + "description": "The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/gpt/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.", + "additionalProperties": true + }, + "chatCompletionRequestMessage": { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "system", + "user", + "assistant", + "function" + ], + "description": "The role of the messages author. One of `system`, `user`, `assistant`, or `function`." + }, + "content": { + "type": "string", + "description": "The contents of the message. `content` is required for all messages except assistant messages with function calls." + }, + "name": { + "type": "string", + "description": "The name of the author of this message. `name` is required if role is `function`, and it should be the name of the function whose response is in the `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters." + }, + "function_call": { + "type": "object", + "description": "The name and arguments of a function that should be called, as generated by the model.", + "properties": { + "name": { + "type": "string", + "description": "The name of the function to call." + }, + "arguments": { + "type": "string", + "description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function." + } + } + } + }, + "required": [ + "role" + ] + }, + "createChatCompletionResponse": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/chatCompletionsResponseCommon" + }, + { + "properties": { + "prompt_filter_results": { + "$ref": "#/components/schemas/promptFilterResults" + }, + "choices": { + "type": "array", + "items": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/chatCompletionChoiceCommon" + }, + { + "properties": { + "message": { + "$ref": "#/components/schemas/chatCompletionResponseMessage" + }, + "content_filter_results": { + "$ref": "#/components/schemas/contentFilterResults" + } + } + } + ] + } + } + } + } + ], + "required": [ + "id", + "object", + "created", + "model", + "choices" + ] + }, + "chatCompletionResponseMessage": { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": [ + "system", + "user", + "assistant", + "function" + ], + "description": "The role of the author of this message." + }, + "content": { + "type": "string", + "description": "The contents of the message." + }, + "function_call": { + "type": "object", + "description": "The name and arguments of a function that should be called, as generated by the model.", + "properties": { + "name": { + "type": "string", + "description": "The name of the function to call." + }, + "arguments": { + "type": "string", + "description": "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function." + } + } + } + }, + "required": [ + "role" + ] + }, + "extensionsChatCompletionsRequest": { + "type": "object", + "description": "Request for the chat completions using extensions", + "required": [ + "messages" + ], + "allOf": [ + { + "$ref": "#/components/schemas/chatCompletionsRequestCommon" + }, + { + "properties": { + "messages": { + "type": "array", + "items": { + "$ref": "#/components/schemas/message" + } + }, + "dataSources": { + "type": "array", + "description": "The data sources to be used for the Azure OpenAI on your data feature.", + "items": { + "$ref": "#/components/schemas/dataSource" + } + } + } + } + ], + "example": { + "dataSources": [ + { + "type": "AzureCognitiveSearch", + "parameters": { + "endpoint": "https://mysearchexample.search.windows.net", + "key": "***(admin key)", + "indexName": "my-chunk-index", + "fieldsMapping": { + "titleField": "productName", + "urlField": "productUrl", + "filepathField": "productFilePath", + "contentFields": [ + "productDescription" + ], + "contentFieldsSeparator": "\n" + }, + "topNDocuments": 5, + "queryType": "semantic", + "semanticConfiguration": "defaultConfiguration", + "inScope": true, + "roleInformation": "roleInformation" + } + } + ], + "messages": [ + { + "role": "user", + "content": "Where can I find a hiking place in Seattle?" + } + ], + "temperature": 0.9 + } + }, + "dataSource": { + "type": "object", + "description": "The data source to be used for the Azure OpenAI on your data feature.", + "properties": { + "type": { + "type": "string", + "description": "The data source type." + }, + "parameters": { + "type": "object", + "description": "The parameters to be used for the data source in runtime.", + "additionalProperties": true + } + }, + "required": [ + "type" + ] + }, + "message": { + "type": "object", + "description": "A chat message.", + "properties": { + "index": { + "type": "integer", + "description": "The index of the message in the conversation." + }, + "role": { + "type": "string", + "enum": [ + "system", + "user", + "assistant", + "tool" + ], + "description": "The role of the author of this message." + }, + "recipient": { + "type": "string", + "example": "Contoso.productsUsingGET", + "description": "The recipient of the message in the format of .. Present if and only if the recipient is tool." + }, + "content": { + "type": "string", + "description": "The contents of the message" + }, + "end_turn": { + "type": "boolean", + "description": "Whether the message ends the turn." + } + }, + "required": [ + "role", + "content" + ] + }, + "chatCompletionsResponseCommon": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "object": { + "type": "string" + }, + "created": { + "type": "integer", + "format": "unixtime" + }, + "model": { + "type": "string" + }, + "usage": { + "type": "object", + "properties": { + "prompt_tokens": { + "type": "integer" + }, + "completion_tokens": { + "type": "integer" + }, + "total_tokens": { + "type": "integer" + } + }, + "required": [ + "prompt_tokens", + "completion_tokens", + "total_tokens" + ] + } + }, + "required": [ + "id", + "object", + "created", + "model" + ] + }, + "chatCompletionChoiceCommon": { + "type": "object", + "properties": { + "index": { + "type": "integer" + }, + "finish_reason": { + "type": "string" + } + } + }, + "extensionsChatCompletionChoice": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/chatCompletionChoiceCommon" + }, + { + "properties": { + "messages": { + "type": "array", + "description": "The list of messages returned by the service.", + "items": { + "$ref": "#/components/schemas/message" + } + } + } + } + ] + }, + "extensionsChatCompletionsResponse": { + "type": "object", + "description": "The response of the extensions chat completions.", + "allOf": [ + { + "$ref": "#/components/schemas/chatCompletionsResponseCommon" + }, + { + "properties": { + "choices": { + "type": "array", + "items": { + "$ref": "#/components/schemas/extensionsChatCompletionChoice" + } + } + } + } + ], + "example": { + "id": "1", + "object": "extensions.chat.completion", + "created": 1679201802, + "model": "gpt-3.5-turbo-0301", + "choices": [ + { + "index": 0, + "finish_reason": "stop", + "messages": [ + { + "role": "tool", + "content": "{\"citations\":[{\"filepath\":\"ContosoTraveler.pdf\",\"content\":\"This is the content of the citation 1\"},{\"filepath\":\"WestCoastTraveler.html\",\"content\":\"This is the content of the citation 2\"},{\"content\":\"This is the content of the citation 3 without filepath\"}],\"intent\":\"hiking place in seattle\"}", + "end_turn": false + }, + { + "role": "assistant", + "content": "Seattle is a great place for hiking! Here are some of the best hiking places in Seattle according to Contoso Traveler [doc1] and West Coast Traveler, Snow Lake, Mount Si, and Mount Tenerife [doc2]. I hope this helps! Let me know if you need more information.", + "end_turn": true + } + ] + } + ] + } + } + }, + "securitySchemes": { + "bearer": { + "type": "oauth2", + "flows": { + "implicit": { + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", + "scopes": {} + } + }, + "x-tokenInfoFunc": "api.middleware.auth.bearer_auth", + "x-scopeValidateFunc": "api.middleware.auth.validate_scopes" + }, + "apiKey": { + "type": "apiKey", + "name": "api-key", + "in": "header" + } + } + } +}