[TypeSpec-Clean] Update OpenAI.Authoring (#23969)
* Changes for OpenAI.Authoring * Removing extraneous file * Removing TypeSpec files for OpenAI.Authoring
This commit is contained in:
Родитель
bd22e99eea
Коммит
b96c8a355f
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,85 +0,0 @@
|
|||
import "@typespec/rest";
|
||||
import "@typespec/http";
|
||||
|
||||
using TypeSpec.Rest;
|
||||
using TypeSpec.Http;
|
||||
|
||||
namespace Azure.OpenAI;
|
||||
|
||||
// TODO: enum value types not supported in csharp emitter
|
||||
enum TypeDiscriminatorKnownValues {
|
||||
List: "list",
|
||||
FineTune: "fine-tune",
|
||||
File: "file",
|
||||
FineTuneEvent: "fine-tune-event",
|
||||
Model: "model",
|
||||
Deployment: "deployment",
|
||||
}
|
||||
|
||||
@knownValues(TypeDiscriminatorKnownValues)
|
||||
scalar TypeDiscriminator extends string;
|
||||
|
||||
enum ScaleTypeKnownValues {
|
||||
Manual: "manual",
|
||||
Standard: "standard",
|
||||
}
|
||||
|
||||
@knownValues(ScaleTypeKnownValues)
|
||||
scalar ScaleType extends string;
|
||||
|
||||
enum ErrorCodeKnownValues {
|
||||
Conflict: "conflict",
|
||||
InvalidPayload: "invalidPayload",
|
||||
Forbidden: "forbidden",
|
||||
NotFound: "notFound",
|
||||
UnexpectedEntityState: "unexpectedEntityState",
|
||||
ItemDoesAlreadyExist: "itemDoesAlreadyExist",
|
||||
ServiceUnavailable: "serviceUnavailable",
|
||||
InternalFailure: "internalFailure",
|
||||
QuotaExceeded: "quotaExceeded",
|
||||
}
|
||||
|
||||
@knownValues(ErrorCodeKnownValues)
|
||||
scalar ErrorCode extends string;
|
||||
|
||||
enum InnerErrorCodeKnownValues {
|
||||
InvalidPayload: "invalidPayload",
|
||||
}
|
||||
|
||||
@knownValues(InnerErrorCodeKnownValues)
|
||||
scalar InnerErrorCode extends string;
|
||||
|
||||
enum PurposeKnownValues {
|
||||
FineTune: "fine-tune",
|
||||
FineTuneResults: "fine-tune-results",
|
||||
}
|
||||
|
||||
@knownValues(PurposeKnownValues)
|
||||
scalar Purpose extends string;
|
||||
|
||||
enum State {
|
||||
NotRunning: "notRunning",
|
||||
Running: "running",
|
||||
Succeeded: "succeeded",
|
||||
Canceled: "canceled",
|
||||
Failed: "failed",
|
||||
Deleted: "deleted",
|
||||
}
|
||||
|
||||
enum LogLevel {
|
||||
Info: "info",
|
||||
Warning: "warning",
|
||||
Error: "error",
|
||||
}
|
||||
|
||||
@doc("Created Response")
|
||||
model CreatedResponse {
|
||||
@doc("The status code")
|
||||
@statusCode
|
||||
statusCode: 201;
|
||||
|
||||
@doc("Location of the newly created item")
|
||||
@header
|
||||
@format("uri")
|
||||
location: string;
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
import "@azure-tools/typespec-azure-core";
|
||||
import "./models/deployment.models.tsp";
|
||||
import "./serviceCustomizations.tsp";
|
||||
|
||||
namespace Azure.OpenAI;
|
||||
|
||||
using TypeSpec.Http;
|
||||
using Azure.Core;
|
||||
|
||||
interface Deployments {
|
||||
#suppress "@azure-tools/cadl-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation."
|
||||
@summary("Gets the list of deployments owned by the Azure OpenAI resource.")
|
||||
@doc("Gets the list of deployments owned by the Azure OpenAI resource.")
|
||||
@route("/deployments")
|
||||
@get
|
||||
// TODO: enum value types not supported in csharp emitter, change string literal to TypeDiscriminatorKnownValues enum when fixed
|
||||
ListDeployments is ServiceCustomizations.OpenAIListOperation<Deployment, "deployment">;
|
||||
|
||||
@summary("""
|
||||
Creates a new deployment for the Azure OpenAI resource according to the given
|
||||
specification.
|
||||
""")
|
||||
@doc("""
|
||||
Creates a new deployment for the Azure OpenAI resource according to the given
|
||||
specification.
|
||||
""")
|
||||
CreateDeployment is ResourceCreateWithServiceProvidedName<
|
||||
Deployment,
|
||||
{
|
||||
response: Deployment
|
||||
}
|
||||
>;
|
||||
|
||||
@summary("Gets details for a single deployment specified by the given deployment_id.")
|
||||
@doc("Gets details for a single deployment specified by the given deployment_id.")
|
||||
GetDeployment is ResourceRead<Deployment>;
|
||||
|
||||
@summary("Updates the mutable details of the deployment with the given deployment_id.")
|
||||
@doc("Updates the mutable details of the deployment with the given deployment_id.")
|
||||
UpdateDeployment is ResourceCreateOrUpdate<Deployment>;
|
||||
|
||||
@summary("Deletes the deployment specified by the given deployment_id.")
|
||||
@doc("Deletes the deployment specified by the given deployment_id.")
|
||||
DeleteDeployment is ResourceDelete<Deployment>;
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
import "@azure-tools/typespec-azure-core";
|
||||
import "@typespec/rest";
|
||||
import "@typespec/http";
|
||||
import "./models/file.models.tsp";
|
||||
import "./serviceCustomizations.tsp";
|
||||
|
||||
namespace Azure.OpenAI;
|
||||
|
||||
using TypeSpec.Rest;
|
||||
using TypeSpec.Http;
|
||||
using Azure.Core;
|
||||
|
||||
interface Files
|
||||
{
|
||||
#suppress "@azure-tools/cadl-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation."
|
||||
@summary("""
|
||||
Gets a list of all files owned by the Azure OpenAI resource.
|
||||
These include user uploaded content like files with purpose "fine-tune" for training or
|
||||
validation of fine-tunes models as well as files that are generated by the
|
||||
service such as "fine-tune-results" which contains various metrics for the
|
||||
corresponding fine-tune job.
|
||||
""")
|
||||
@doc("""
|
||||
Gets a list of all files owned by the Azure OpenAI resource.
|
||||
These include user uploaded content like files with purpose \"fine-tune\" for training or
|
||||
validation of fine-tunes models
|
||||
as well as files that are generated by the
|
||||
service such as \"fine-tune-results\" which contains various metrics for the
|
||||
corresponding fine-tune job.
|
||||
""")
|
||||
@route("/files")
|
||||
@get
|
||||
// TODO: enum value types not supported in csharp emitter, change string literal to TypeDiscriminatorKnownValues enum when fixed
|
||||
ListFiles is ServiceCustomizations.OpenAIListOperation<File, "file">;
|
||||
|
||||
@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.
|
||||
""")
|
||||
@doc("""
|
||||
Creates a new file entity by uploading data from a local machine. Uploaded
|
||||
files can, for example, be used for training or evaluating fine-tuned models.
|
||||
""")
|
||||
UploadFile is ResourceCreateWithServiceProvidedName<
|
||||
File,
|
||||
{
|
||||
response: File
|
||||
}
|
||||
>;
|
||||
|
||||
@summary("""
|
||||
Gets details for a single file specified by the given file_id including status,
|
||||
size, purpose, etc.
|
||||
""")
|
||||
@doc("""
|
||||
Gets details for a single file specified by the given file_id including status,
|
||||
size, purpose, etc.
|
||||
""")
|
||||
GetFile is ResourceRead<File>;
|
||||
|
||||
@summary("""
|
||||
Deletes the file with the given file_id.
|
||||
Deletion is also allowed if a file
|
||||
was used, e.g., as training file in a fine-tune job.
|
||||
""")
|
||||
@doc("""
|
||||
Deletes the file with the given file_id.
|
||||
Deletion is also allowed if a file
|
||||
was used, e.g., as training file in a fine-tune job.
|
||||
""")
|
||||
DeleteFile is ResourceDelete<File>;
|
||||
|
||||
@summary("""
|
||||
Gets the content of the file specified by the given file_id.
|
||||
Files can be user
|
||||
uploaded content or generated by the service like result metrics of a fine-tune
|
||||
job.
|
||||
""")
|
||||
@doc("""
|
||||
Gets the content of the file specified by the given file_id.
|
||||
Files can be user
|
||||
uploaded content or generated by the service like result metrics of a fine-tune
|
||||
job.
|
||||
""")
|
||||
@get
|
||||
@action("content")
|
||||
@actionSeparator("/")
|
||||
GetFileContent is ResourceAction<File, {}, FileContent>;
|
||||
|
||||
#suppress "@azure-tools/cadl-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation."
|
||||
@summary("""
|
||||
Creates a new file entity by importing data from a provided url. Uploaded files
|
||||
can, for example, be used for training or evaluating fine-tuned models.
|
||||
""")
|
||||
@doc("""
|
||||
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.
|
||||
""")
|
||||
@route("/files/import")
|
||||
@post
|
||||
ImportFile is Foundations.Operation<
|
||||
{
|
||||
@doc("expected schema for the body of the completion post request")
|
||||
@body
|
||||
body: FileImport;
|
||||
},
|
||||
File & CreatedResponse
|
||||
>;
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
import "@azure-tools/typespec-azure-core";
|
||||
import "@typespec/rest";
|
||||
import "@typespec/http";
|
||||
import "./models/finetune.models.tsp";
|
||||
import "./serviceCustomizations.tsp";
|
||||
|
||||
namespace Azure.OpenAI;
|
||||
|
||||
using TypeSpec.Rest;
|
||||
using TypeSpec.Http;
|
||||
using Azure.Core;
|
||||
|
||||
interface FineTunes {
|
||||
#suppress "@azure-tools/cadl-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation."
|
||||
@summary("""
|
||||
Gets a list of all fine-tune jobs owned by the Azure OpenAI resource.
|
||||
The details that are returned for each fine-tune job contain besides its
|
||||
identifier the base model, training and validation files, hyper parameters,
|
||||
time stamps, status and events. Events are created when the job status
|
||||
changes, e.g. running or complete, and when results are uploaded.
|
||||
""")
|
||||
@doc("""
|
||||
Gets a list of all fine-tune jobs owned by the Azure OpenAI resource.
|
||||
The details that are returned for each fine-tune job contain besides its
|
||||
identifier the base model, training and validation files, hyper parameters,
|
||||
time stamps, status and events. Events are created when the job status
|
||||
changes, e.g. running or complete, and when results are uploaded.
|
||||
""")
|
||||
@route("/fine-tunes")
|
||||
@get
|
||||
// TODO: enum value types not supported in csharp emitter, change string literal to TypeDiscriminatorKnownValues enum when fixed
|
||||
ListFineTunes is ServiceCustomizations.OpenAIListOperation<FineTune, "fine-tune">;
|
||||
|
||||
#suppress "@azure-tools/cadl-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation."
|
||||
@summary("""
|
||||
Creates a job that fine-tunes a specified model from a given training
|
||||
file.
|
||||
Response includes details of the enqueued job including job status and
|
||||
hyper parameters.
|
||||
The name of the fine-tuned model is added to the response
|
||||
once complete.
|
||||
""")
|
||||
@doc("""
|
||||
Creates a job that fine-tunes a specified model from a given training
|
||||
file.
|
||||
Response includes details of the enqueued job including job status and
|
||||
hyper parameters.
|
||||
The name of the fine-tuned model is added to the response
|
||||
once complete.
|
||||
""")
|
||||
@route("/fine-tunes")
|
||||
@post
|
||||
CreateFineTune is Foundations.Operation<
|
||||
FineTuneCreation,
|
||||
FineTune & CreatedResponse
|
||||
>;
|
||||
|
||||
@summary("""
|
||||
Gets details for a single fine-tune job specified by the given
|
||||
fine_tune_id.
|
||||
The details contain the base model, training and validation
|
||||
files, hyper parameters, time stamps, status and events.
|
||||
Events are created
|
||||
when the job status changes, e.g. running or complete, and when results are
|
||||
uploaded.
|
||||
""")
|
||||
@doc("""
|
||||
Gets details for a single fine-tune job specified by the given
|
||||
fine_tune_id.
|
||||
The details contain the base model, training and validation
|
||||
files, hyper parameters, time stamps, status and events.
|
||||
Events are created
|
||||
when the job status changes, e.g. running or complete, and when results are
|
||||
uploaded.
|
||||
""")
|
||||
GetFineTune is ResourceRead<FineTune>;
|
||||
|
||||
@summary("Deletes the fine-tune job specified by the given fine_tune_id.")
|
||||
@doc("Deletes the fine-tune job specified by the given fine_tune_id.")
|
||||
DeleteFineTune is ResourceDelete<FineTune>;
|
||||
|
||||
#suppress "@azure-tools/cadl-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation."
|
||||
@summary("""
|
||||
List events for the fine-tune job specified by the given fine_tune_id.
|
||||
Events are created when the job status changes, e.g. running or
|
||||
complete, and when results are uploaded.
|
||||
""")
|
||||
@doc("""
|
||||
List events for the fine-tune job specified by the given fine_tune_id.
|
||||
Events are created when the job status changes, e.g. running or
|
||||
complete, and when results are uploaded.
|
||||
""")
|
||||
@Cadl.Rest.actionSeparator("/")
|
||||
@get
|
||||
ListFineTuneEvents is Azure.Core.ResourceAction<FineTune,
|
||||
{
|
||||
@doc("A flag indicating whether to stream events for the fine-tune job. If set to true,\nevents will be sent as data-only server-sent events as they become available. The stream will terminate with\na data: [DONE] message when the job is finished (succeeded, cancelled, or failed).\nIf set to false, only events generated so far will be returned..")
|
||||
@query stream: boolean
|
||||
}, ServiceCustomizations.OpenAiList<Event, TypeDiscriminator>>;
|
||||
|
||||
// #suppress "@azure-tools/cadl-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation."
|
||||
@summary("Cancels the processing of the fine-tune job specified by the given fine_tune_id.")
|
||||
@doc("Cancels the processing of the fine-tune job specified by the given fine_tune_id.")
|
||||
@post
|
||||
@action("cancel")
|
||||
@actionSeparator("/")
|
||||
CancelFineTune is ResourceAction<FineTune, {}, FineTune>;
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
import "@typespec/rest";
|
||||
import "@typespec/http";
|
||||
import "@typespec/versioning";
|
||||
import "./common.tsp";
|
||||
import "./deployment.tsp";
|
||||
import "./file.tsp";
|
||||
import "./finetune.tsp";
|
||||
import "./model.routes.tsp";
|
||||
|
||||
using TypeSpec.Rest;
|
||||
using TypeSpec.Http;
|
||||
using TypeSpec.Versioning;
|
||||
|
||||
@useAuth(
|
||||
ApiKeyAuth<ApiKeyLocation.header, "api-key"> |
|
||||
OAuth2Auth<[{
|
||||
type: OAuth2FlowType.implicit,
|
||||
authorizationUrl: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
|
||||
scopes: ["https://cognitiveservices.azure.com/.default"]
|
||||
}]>)
|
||||
@service({title: "Azure OpenAI API"})
|
||||
@versioned(Azure.OpenAI.Versions)
|
||||
@server(
|
||||
"{endpoint}/openai",
|
||||
"API for managing and utilizing Azure Open AI endpoints",
|
||||
{
|
||||
@doc("""
|
||||
Supported Cognitive Services endpoints (protocol and hostname, for example:
|
||||
https://westus.api.cognitive.microsoft.com).
|
||||
""")
|
||||
endpoint: string,
|
||||
}
|
||||
)
|
||||
@doc("API for managing and utilizing Azure Open AI endpoints")
|
||||
namespace Azure.OpenAI;
|
||||
|
||||
enum Versions {
|
||||
@useDependency(Azure.Core.Versions.v1_0_Preview_1)
|
||||
v2022_06_01_preview: "2022-06-01-preview",
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
import "@azure-tools/typespec-azure-core";
|
||||
import "@typespec/rest";
|
||||
import "@typespec/http";
|
||||
import "./models/model.models.tsp";
|
||||
import "./serviceCustomizations.tsp";
|
||||
|
||||
namespace Azure.OpenAI;
|
||||
|
||||
using Cadl.Rest;
|
||||
using Cadl.Http;
|
||||
using Azure.Core;
|
||||
|
||||
interface Models {
|
||||
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation."
|
||||
@summary("""
|
||||
Gets a list of all models that are accessible by the Azure OpenAI
|
||||
resource.
|
||||
These include base models as well as all successfully completed
|
||||
fine-tuned models owned by the Azure OpenAI resource.
|
||||
""")
|
||||
@doc("""
|
||||
Gets a list of all models that are accessible by the Azure OpenAI
|
||||
resource.
|
||||
These include base models as well as all successfully completed
|
||||
fine-tuned models owned by the Azure OpenAI resource.
|
||||
""")
|
||||
@route("/models")
|
||||
@get
|
||||
// TODO: enum value types not supported in csharp emitter, change string literal to TypeDiscriminatorKnownValues enum when fixed
|
||||
ListModels is ServiceCustomizations.OpenAIListOperation<Model, "model">;
|
||||
|
||||
@summary("Gets details for the model specified by the given model_id.")
|
||||
@doc("Gets details for the model specified by the given model_id.")
|
||||
GetModel is ResourceRead<Model>;
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
import "@typespec/rest";
|
||||
import "@typespec/http";
|
||||
|
||||
using TypeSpec.Rest;
|
||||
using TypeSpec.Rest.Resource;
|
||||
|
||||
namespace Azure.OpenAI;
|
||||
|
||||
@doc("""
|
||||
Deployments manage the reserved quota for Azure OpenAI models and make them
|
||||
available for inference requests.
|
||||
""")
|
||||
@resource("deployments")
|
||||
model Deployment {
|
||||
@doc("Defines the type of an object.")
|
||||
@visibility("read")
|
||||
object?: TypeDiscriminator;
|
||||
|
||||
@doc("The state of a job or item.")
|
||||
@visibility("read")
|
||||
status: State;
|
||||
|
||||
@doc("A timestamp when this job or item was created (in unix epochs).")
|
||||
@visibility("read")
|
||||
created_at: int32;
|
||||
|
||||
@doc("A timestamp when this job or item was modified last (in unix epochs).")
|
||||
@visibility("read")
|
||||
updated_at: int32;
|
||||
|
||||
@doc("The identifier of the deployment")
|
||||
@key("deploymentId")
|
||||
@visibility("read")
|
||||
id: string;
|
||||
|
||||
@doc("The OpenAI model to deploy. Can be a base model or a fine tune.")
|
||||
"model": string;
|
||||
|
||||
@doc("""
|
||||
The owner of this deployment. For Azure OpenAI only \"organization-owner\" is
|
||||
supported.
|
||||
""")
|
||||
@visibility("read")
|
||||
owner?: string;
|
||||
|
||||
@doc("""
|
||||
The scale settings of a deployment. It defines the modes for scaling and the
|
||||
reserved capacity.
|
||||
""")
|
||||
scale_settings: ScaleSettings;
|
||||
}
|
||||
|
||||
@doc("""
|
||||
The scale settings of a deployment. It defines the modes for scaling and the
|
||||
reserved capacity.
|
||||
""")
|
||||
@discriminator("scale_type")
|
||||
model ScaleSettings {}
|
|
@ -1,92 +0,0 @@
|
|||
import "@typespec/rest";
|
||||
import "@typespec/http";
|
||||
import "@azure-tools/typespec-azure-core";
|
||||
|
||||
using TypeSpec.Rest;
|
||||
using Azure.Core;
|
||||
|
||||
namespace Azure.OpenAI;
|
||||
|
||||
@doc("""
|
||||
A file is a document usable for training and validation. It can also be a
|
||||
service generated document with result details.
|
||||
""")
|
||||
@resource("files")
|
||||
model File {
|
||||
@doc("Defines the type of an object.")
|
||||
@visibility("read")
|
||||
object?: TypeDiscriminator;
|
||||
|
||||
@doc("The state of a job or item.")
|
||||
@visibility("read")
|
||||
status?: State;
|
||||
|
||||
@doc("A timestamp when this job or item was created (in unix epochs).")
|
||||
@visibility("read")
|
||||
created_at?: int32;
|
||||
|
||||
@doc("A timestamp when this job or item was modified last (in unix epochs).")
|
||||
@visibility("read")
|
||||
updated_at?: int32;
|
||||
|
||||
@doc("The identity of this item.")
|
||||
@visibility("read")
|
||||
@key("fileId")
|
||||
id: string;
|
||||
|
||||
@doc("""
|
||||
The size of this file when available (can be null). File sizes larger than
|
||||
2^53-1 are not supported to ensure compatibility
|
||||
with JavaScript integers.
|
||||
""")
|
||||
@visibility("read")
|
||||
bytes?: int32;
|
||||
|
||||
@doc("""
|
||||
The intended purpose of the uploaded documents. Use \"fine-tune\" for
|
||||
fine-tuning. This allows us to validate the format of the uploaded file.
|
||||
""")
|
||||
purpose: Purpose;
|
||||
|
||||
@doc("The name of the file.")
|
||||
filename: string;
|
||||
}
|
||||
|
||||
@doc("""
|
||||
Defines a document to import from an external content url to be usable with
|
||||
Azure OpenAI.
|
||||
""")
|
||||
model FileImport {
|
||||
@doc("""
|
||||
The intended purpose of the uploaded documents. Use \"fine-tune\" for
|
||||
fine-tuning. This allows us to validate the format of the uploaded file.
|
||||
""")
|
||||
purpose: Purpose;
|
||||
|
||||
@doc("""
|
||||
The name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file
|
||||
to be uploaded.
|
||||
If the `purpose` is set to \"fine-tune\", each line is a JSON
|
||||
record with \"prompt\" and \"completion\" fields representing your training
|
||||
examples.
|
||||
""")
|
||||
filename: string;
|
||||
|
||||
@doc("""
|
||||
The url to download the document from (can be SAS url of a blob or any other
|
||||
external url accessible with a GET request).
|
||||
""")
|
||||
content_url: string;
|
||||
}
|
||||
|
||||
@doc("content of uploaded file")
|
||||
model FileContent {
|
||||
@doc("""
|
||||
The intended purpose of the uploaded documents. Use \"fine-tune\" for
|
||||
fine-tuning. This allows us to validate the format of the uploaded file.
|
||||
""")
|
||||
purpose: Purpose;
|
||||
|
||||
@doc("Gets or sets the file to upload into Azure OpenAI.")
|
||||
file: bytes;
|
||||
}
|
|
@ -1,205 +0,0 @@
|
|||
import "@typespec/rest";
|
||||
import "@typespec/http";
|
||||
import "@azure-tools/typespec-azure-core";
|
||||
|
||||
using TypeSpec.Http;
|
||||
using TypeSpec.Rest;
|
||||
using Azure.Core;
|
||||
|
||||
namespace Azure.OpenAI;
|
||||
|
||||
@doc("Fine tuning is a job to tailor a model to specific training data.")
|
||||
@resource("fine-tunes")
|
||||
model FineTune {
|
||||
@doc("Defines the type of an object.")
|
||||
@visibility("read")
|
||||
object?: TypeDiscriminator;
|
||||
|
||||
@doc("The state of a job or item.")
|
||||
@visibility("read")
|
||||
status?: State;
|
||||
|
||||
@doc("A timestamp when this job or item was created (in unix epochs).")
|
||||
@visibility("read")
|
||||
created_at?: int32;
|
||||
|
||||
@doc("A timestamp when this job or item was modified last (in unix epochs).")
|
||||
@visibility("read")
|
||||
updated_at?: int32;
|
||||
|
||||
@doc("The identity of this item.")
|
||||
@visibility("read")
|
||||
@key("fineTuneId")
|
||||
id: string;
|
||||
|
||||
@doc("The identifier of the base model used for the fine-tune.")
|
||||
"model": string;
|
||||
|
||||
@doc("""
|
||||
The identifier of the resulting fine tuned model. This property is only
|
||||
populated for successfully completed fine-tune runs.
|
||||
Use this identifier to
|
||||
create a deployment for inferencing.
|
||||
""")
|
||||
@visibility("read")
|
||||
fine_tuned_model?: string;
|
||||
|
||||
@doc("The files that are used for training the fine tuned model.")
|
||||
training_files: File[];
|
||||
|
||||
@doc("The files that are used to evaluate the fine tuned model during training.")
|
||||
validation_files?: File[];
|
||||
|
||||
@doc("""
|
||||
The result files containing training and evaluation metrics in csv format.
|
||||
The
|
||||
file is only available for successfully completed fine-tune runs.
|
||||
""")
|
||||
@visibility("read")
|
||||
result_files?: File[];
|
||||
|
||||
@doc("""
|
||||
The events that show the progress of the fine-tune run including queued,
|
||||
running and completed.
|
||||
""")
|
||||
@visibility("read")
|
||||
events?: Event[];
|
||||
|
||||
@doc("""
|
||||
The organisation id of this fine tune job. Unused on Azure OpenAI;
|
||||
compatibility for OpenAI only.
|
||||
""")
|
||||
@visibility("read")
|
||||
organisation_id?: string;
|
||||
|
||||
@doc("""
|
||||
The user id of this fine tune job. Unused on Azure OpenAI; compatibility for
|
||||
OpenAI only.
|
||||
""")
|
||||
@visibility("read")
|
||||
user_id?: string;
|
||||
|
||||
@doc("The hyper parameter settings used in a fine tune job.")
|
||||
hyperparams?: HyperParameters;
|
||||
}
|
||||
|
||||
@doc("Event")
|
||||
model Event {
|
||||
@doc("Defines the type of an object.")
|
||||
@visibility("read")
|
||||
object?: TypeDiscriminator;
|
||||
|
||||
@doc("A timestamp when this event was created (in unix epochs).")
|
||||
@visibility("read")
|
||||
created_at?: int32;
|
||||
|
||||
@doc("The verbosity level of an event.")
|
||||
@visibility("read")
|
||||
level?: LogLevel;
|
||||
|
||||
@doc("""
|
||||
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.
|
||||
""")
|
||||
@visibility("read")
|
||||
message?: string;
|
||||
}
|
||||
|
||||
@doc("The hyper parameter settings used in a fine tune job.")
|
||||
model HyperParameters {
|
||||
@doc("""
|
||||
The batch size to use for training. The batch size is the number of training
|
||||
examples used to train a single forward and backward pass.
|
||||
In general, we've
|
||||
found that larger batch sizes tend to work better for larger datasets.
|
||||
The
|
||||
default value as well as the maximum value for this property are specific to a
|
||||
base model.
|
||||
""")
|
||||
batch_size?: int32;
|
||||
|
||||
@doc("""
|
||||
The learning rate multiplier to use for training. The fine-tuning learning rate
|
||||
is the original learning rate used for pre-training multiplied by this
|
||||
value.
|
||||
Larger learning rates tend to perform better with larger batch
|
||||
sizes.
|
||||
We recommend experimenting with values in the range 0.02 to 0.2 to see
|
||||
what produces the best results.
|
||||
""")
|
||||
learning_rate_multiplier?: float32;
|
||||
|
||||
@doc("""
|
||||
The number of epochs to train the model for. An epoch refers to one full cycle
|
||||
through the training dataset.
|
||||
""")
|
||||
n_epochs?: int32;
|
||||
|
||||
@doc("""
|
||||
The weight to use for loss on the prompt tokens. This controls how much the
|
||||
model tries to learn to generate the prompt
|
||||
(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.
|
||||
If prompts are extremely long (relative to
|
||||
completions), it may make sense to reduce this weight so as to avoid
|
||||
over-prioritizing learning the prompt.
|
||||
""")
|
||||
prompt_loss_weight?: float32;
|
||||
|
||||
@doc("""
|
||||
A value indicating whether to compute classification metrics.
|
||||
If set, we
|
||||
calculate classification-specific metrics such as accuracy and F-1 score using
|
||||
the validation set at the end of every epoch.
|
||||
These metrics can be viewed in
|
||||
the results file. In order to compute classification metrics, you must provide
|
||||
a validation_file.Additionally,
|
||||
you must specify classification_n_classes for
|
||||
multiclass classification or classification_positive_class for binary
|
||||
classification.
|
||||
""")
|
||||
compute_classification_metrics?: boolean;
|
||||
|
||||
@doc("""
|
||||
The number of classes in a classification task.
|
||||
This parameter is required for
|
||||
multiclass classification.
|
||||
""")
|
||||
classification_n_classes?: int32;
|
||||
|
||||
@doc("""
|
||||
The positive class in binary classification.
|
||||
This parameter is needed to
|
||||
generate precision, recall, and F1 metrics when doing binary classification.
|
||||
""")
|
||||
classification_positive_class?: string;
|
||||
|
||||
@doc("""
|
||||
The classification beta values. If this is provided, we calculate F-beta scores
|
||||
at the specified beta values.
|
||||
The F-beta score is a generalization of F-1
|
||||
score. This is only used for binary classification.
|
||||
With a beta of 1 (i.e.the
|
||||
F-1 score), precision and recall are given the same weight.
|
||||
A 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.
|
||||
""")
|
||||
classification_betas?: float32[];
|
||||
}
|
||||
|
||||
@doc("Defines the values of a fine tune job.")
|
||||
model FineTuneCreation {
|
||||
@doc("The identifier of the base model used for this fine-tune.")
|
||||
"model": string;
|
||||
|
||||
@doc("The file that is used for training this fine tuned model.")
|
||||
training_file: string;
|
||||
|
||||
@doc("The file that is used to evaluate the fine tuned model during training.")
|
||||
validation_file?: string;
|
||||
|
||||
@doc("The hyper parameter settings used in a fine tune job.")
|
||||
hyperparams?: HyperParameters;
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
import "@typespec/rest";
|
||||
import "@typespec/http";
|
||||
import "@azure-tools/typespec-azure-core";
|
||||
|
||||
using TypeSpec.Http;
|
||||
using TypeSpec.Rest;
|
||||
using Azure.Core;
|
||||
|
||||
namespace Azure.OpenAI;
|
||||
|
||||
@doc("A model is either a base model or the result of a successful fine tune job.")
|
||||
@resource("models")
|
||||
model Model {
|
||||
@doc("Defines the type of an object.")
|
||||
@visibility("read")
|
||||
object?: TypeDiscriminator;
|
||||
|
||||
@doc("The state of a job or item.")
|
||||
@visibility("read")
|
||||
status?: State;
|
||||
|
||||
@doc("A timestamp when this job or item was created (in unix epochs).")
|
||||
@visibility("read")
|
||||
created_at?: int32;
|
||||
|
||||
@doc("A timestamp when this job or item was modified last (in unix epochs).")
|
||||
@visibility("read")
|
||||
updated_at?: int32;
|
||||
|
||||
@doc("The identity of this item.")
|
||||
@visibility("read")
|
||||
@key("model_id")
|
||||
id: string;
|
||||
|
||||
@doc("The base model ID if this is a fine tune model; otherwise `null`.")
|
||||
@visibility("read")
|
||||
"model"?: string;
|
||||
|
||||
@doc("The fine tune job ID if this is a fine tune model; otherwise `null`.")
|
||||
@visibility("read")
|
||||
fine_tune?: string;
|
||||
|
||||
@doc("The capabilities of a base or fine tune model.")
|
||||
capabilities?: Capabilities;
|
||||
|
||||
@doc("""
|
||||
Defines the dates of deprecation for the different use cases of a
|
||||
model.
|
||||
Usually base models support 1 year of fine tuning after creation.
|
||||
Inference is typically supported 2 years after creation of base or
|
||||
fine tuned
|
||||
models. The exact dates are specified in the properties.
|
||||
""")
|
||||
deprecation?: Deprecation;
|
||||
}
|
||||
|
||||
@doc("The capabilities of a base or fine tune model.")
|
||||
model Capabilities {
|
||||
@doc("A value indicating whether a model can be used for fine tuning.")
|
||||
@visibility("read")
|
||||
fine_tune?: boolean;
|
||||
|
||||
@doc("A value indicating whether a model can be deployed.")
|
||||
@visibility("read")
|
||||
inference?: boolean;
|
||||
|
||||
@doc("A value indicating whether a model supports completion.")
|
||||
@visibility("read")
|
||||
completion?: boolean;
|
||||
|
||||
@doc("A value indicating whether a model supports embeddings.")
|
||||
@visibility("read")
|
||||
embeddings?: boolean;
|
||||
|
||||
@doc("The supported scale types for deployments of this model.")
|
||||
@visibility("read")
|
||||
scale_types?: ScaleType[];
|
||||
}
|
||||
|
||||
@doc("""
|
||||
Defines the dates of deprecation for the different use cases of a
|
||||
model.
|
||||
Usually base models support 1 year of fine tuning after creation.
|
||||
Inference is typically supported 2 years after creation of base or
|
||||
fine tuned
|
||||
models. The exact dates are specified in the properties.
|
||||
""")
|
||||
model Deprecation {
|
||||
@doc("""
|
||||
The end date of fine tune support of this model. Will be `null` for fine tune
|
||||
models.
|
||||
""")
|
||||
@visibility("read")
|
||||
fine_tune_end_date?: int32;
|
||||
|
||||
@doc("The end date of inference support of this model.")
|
||||
@visibility("read")
|
||||
inference?: int32;
|
||||
}
|
||||
|
||||
@doc("Settings for the manual scale type.")
|
||||
model ManualScaleSettings extends ScaleSettings {
|
||||
@doc("The constant reserved capacity of the inference endpoint for this deployment.")
|
||||
capacity: int32;
|
||||
|
||||
@doc("Defines how scaling operations will be executed.")
|
||||
scale_type: "manual";
|
||||
}
|
||||
|
||||
@doc("Settings for the standard scale type.")
|
||||
model StandardScaleSettings extends ScaleSettings {
|
||||
@doc("Defines how scaling operations will be executed.")
|
||||
scale_type: "standard";
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
import "@azure-tools/typespec-azure-core";
|
||||
import "./common.tsp";
|
||||
|
||||
namespace Azure.OpenAI.ServiceCustomizations;
|
||||
|
||||
@friendlyName("{name}List", T)
|
||||
model OpenAiList<T extends object, TType extends Azure.OpenAI.TypeDiscriminator> {
|
||||
@doc("Defines the type of this object")
|
||||
object?: TType;
|
||||
@doc("The list of {name}s", T)
|
||||
data?: T[];
|
||||
}
|
||||
|
||||
// TODO: enum value types not supported in csharp emitter, change TypeDiscriminator to TypeDiscriminatorKnownValues enum when fixed
|
||||
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Internal template - no need for public documentation"
|
||||
op OpenAIListOperation<T extends object, TType extends Azure.OpenAI.TypeDiscriminator> is Azure.Core.Foundations.ResourceList<T, {}, OpenAiList<T, TType>>;
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
autorest --reset
|
||||
autorest --require=README.md --cadl-init --use=https://aka.ms/autorest.cadl --output-folder="." --input-file="https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2022-06-01-preview/azureopenai.json"
|
|
@ -1,16 +0,0 @@
|
|||
emit:
|
||||
- "@azure-tools/typespec-autorest"
|
||||
- "@azure-tools/cadl-apiview"
|
||||
# options:
|
||||
# Uncomment this line and add "@azure-tools/cadl-python" to your package.json to generate Python code
|
||||
# "@azure-tools/cadl-python":
|
||||
# "basic-setup-py": true
|
||||
# "package-version":
|
||||
# "package-name":
|
||||
# "output-path":
|
||||
# Uncomment this line and add "@azure-tools/cadl-java" to your package.json to generate Java code
|
||||
# "@azure-tools/cadl-java": true
|
||||
# Uncomment this line and add "@azure-tools/cadl-csharp" to your package.json to generate C# code
|
||||
# "@azure-tools/cadl-csharp": true
|
||||
# Uncomment this line and add "@azure-tools/cadl-typescript" to your package.json to generate Typescript code
|
||||
# "@azure-tools/cadl-typescript": true
|
Загрузка…
Ссылка в новой задаче