Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 80 additions & 41 deletions specification/ai/Azure.AI.Unified/common/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -223,59 +223,26 @@ model OutputPathAssetReference extends AssetReferenceBase {

#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance"
@doc("Base definition for an asset.")
model AssetBase extends ResourceBase {
@doc("If the name version are system generated (anonymous registration).")
@visibility("read", "create")
isAnonymous?: boolean;

@doc("Is the asset archived?")
model AssetBase {
@doc("Asset stage")
@visibility("read", "create", "update")
isArchived?: boolean;
}

@doc("Enum to determine the type of data.")
union DatasetType {
string,

@doc("URI file.")
uri_file: "uri_file",

@doc("URI folder.")
uri_folder: "uri_folder",
}
stage?: string;

#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance"
@doc("AssetContainer definition")
model AssetContainer extends ResourceBase {
@doc("Is the asset archived?")
@visibility("read", "create", "update")
isArchived?: boolean;

@doc("The latest version inside this container.")
@visibility("read")
latestVersion?: string;

@doc("The next auto incremental version")
@visibility("read")
nextVersion?: string;
}

@doc("ResourceBase definition")
model ResourceBase {
@doc("A unique identifier for the asset")
@doc("A unique identifier for the asset, assetId probably?")
@visibility("read")
id?: string;

@doc("The name of the resource")
@visibility("read")
name?: string;

@doc("The version of the resource")
@visibility("read")
version?: string;

@doc("The asset description text.")
description?: string;

@doc("The asset property dictionary.")
properties?: Record<string>;

@doc("Tag dictionary. Tags can be added, removed, and updated.")
tags?: Record<string>;

Expand All @@ -284,6 +251,27 @@ model ResourceBase {
systemData?: SystemData;
}

#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance"
@doc("AssetContainer definition")
model AssetContainer {
@doc("The next auto incremental version")
@visibility("read")
nextVersion?: string;

@doc("Key is label name, value is version.")
@visibility("read, update")
labels: Record<string>;

@doc("A unique identifier for the asset, assetId probably?")
@visibility("read")
id?: string;

@doc("The name of the resource")
@visibility("read")
name?: string;
}


#suppress "@azure-tools/typespec-providerhub/no-inline-model" "Need to create reponses correctly"
alias ResourceCreatedResponse<T extends TypeSpec.Reflection.Model> = TypeSpec.Http.Response<201> &
T;
Expand Down Expand Up @@ -316,8 +304,59 @@ alias OkResponse<T extends TypeSpec.Reflection.Model> = TypeSpec.Http.Response<2
pass_through: "pass-through",
}

// Pending upload spec

// Define a URI alias for clarity.
alias Uri = string;

enum PendingUploadType {
None,
TemporaryBlobReference,
}

enum PendingUploadCredentialType {
SAS,
}

model PendingUploadRequestDto {
/// If PendingUploadId is not provided, a random guid will be used.
pendingUploadId?: string;
/// TemporaryBlobReference is the only supported type.
pendingUploadType: PendingUploadType = PendingUploadType.TemporaryBlobReference;
}

model PendingUploadResponseDto {
/// Container-level read, write, list SAS.
blobReferenceForConsumption: BlobReferenceForConsumptionDto;
/// ID for this upload request.
pendingUploadId: string;
/// TemporaryBlobReference is the only supported type.
pendingUploadType: PendingUploadType = PendingUploadType.TemporaryBlobReference;
}

/// Use a discriminated union to represent the abstract credential DTO.
/// The “credentialType” property acts as the discriminator.
@discriminator("credentialType")
union PendingUploadCredentialDto = SASCredentialDto;

model SASCredentialDto {
/// The credential type is always SAS.
credentialType: PendingUploadCredentialType = PendingUploadCredentialType.SAS;
/// Full SAS Uri, including the storage, container/blob path and SAS token.
/// (SwaggerSecret attribute from C# can be noted here as a comment or using a custom decorator if needed.)
sasUri: Uri;
}

model BlobReferenceForConsumptionDto {
/// Blob URI path for client to upload data.
/// Example: https://blob.windows.core.net/Container/Path
blobUri: Uri;
/// ARM ID of the storage account to use.
storageAccountArmId: string;
/// Credential info to access the storage account.
credential: PendingUploadCredentialDto;
}

@doc("""
The definition of a caller-specified function that chat completions may invoke in response to matching user input.
""")
Expand Down
19 changes: 9 additions & 10 deletions specification/ai/Azure.AI.Unified/datasets/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,18 @@ model DatasetContainer extends AssetContainer {

}

@doc("PagedDataContainer Definition")
@pagedResult
model PagedDatasetContainer {
@doc("The list of DatasetContainers.")
@extension("x-ms-identifiers", [])
@items
value: DatasetContainer[];
@doc("Enum to determine the type of data.")
union DatasetType {
string,

@doc("The link to the next page of results, if any.")
@nextLink
nextLink?: string;
@doc("URI file.")
uri_file: "uri_file",

@doc("URI folder.")
uri_folder: "uri_folder",
}


#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance"
@doc("DatasetVersion Definition")
@discriminator("datasetType")
Expand Down
46 changes: 25 additions & 21 deletions specification/ai/Azure.AI.Unified/datasets/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,15 @@ interface Datasets {
@doc("List datasets in a project.")
@route("/datasets")
@get
listDatasets(
@doc("Continuation token for pagination.")
@query("$skip")
$skip?: string,
listLatestDatasets(
@doc("Continuation token for pagination. This is the nextLink from the previous response.")
@query("$continuationToken")
$continuationToken?: string,

@doc("View type for including/excluding (for example) archived entities.")
@query("listViewType")
listViewType?: ListViewType,
): PagedDatasetContainer;

#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("Delete container.")
@route("/datasets/{name}")
@delete
delete(
@doc("Name of Azure Machine Learning workspace.")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$")
@path
workspaceName: string,

@doc("Container name.")
@path
name: string,
): void;
): PagedDatasetVersion;

#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
Expand Down Expand Up @@ -129,4 +113,24 @@ interface Datasets {
@body
body: DatasetVersion,
): DatasetVersion;

#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("Start pending upload.")
@post
@route("/datasets/{name}/versions/{version}/startPendingUpload")
createOrGetStartPendingUpload(
@doc("Container name.")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")
@path
name: string,

@doc("Version identifier.")
@path
version: string,

@doc("Pensing upload request.")
@body
body: PendingUploadRequestDto
): PendingUploadResponseDto;
}
Loading