Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update async batch image APIs in 2023-10-30-preview #54

Merged
merged 8 commits into from
Jan 29, 2024
58 changes: 45 additions & 13 deletions specification/cognitiveservices/ContentSafety/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -250,43 +250,75 @@ model ImageCategoriesAnalysis {
@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("The image batch analysis request.")
model BatchAnalyzeImagesOptions {
@doc("The URL of the Azure Storage Blob containing all the images to be analyzed in the batch task.")
imagesBlobFolderUrl: url;
@doc("The blob parameters of images to be analyzed.")
images: BatchAnalyzeImages;

@doc("The URL of the Azure Storage Blob where the batch task results will be written.")
analysisResultsBlobFolderUrl: url;
@doc("The blob parameters of result files.")
analysisResults: BatchAnalyzeImagesResults;

@doc("The storage mode for the batch task results, either 'CollectiveResultFile' or 'IndividualResultFiles'.")
resultsStorageMode?: BatchResultsStorageMode = BatchResultsStorageMode.CollectiveResultFile;

@doc("The categories will be analyzed. If they are not assigned, a default set of analysis results for the categories will be returned.")
categories?: ImageCategory[];

@doc("This refers to the type of image analysis output. If no value is assigned, the default value will be \"FourSeverityLevels\".")
@doc("This refers to the type of image analysis output. If no value is assigned, the default value will be 'FourSeverityLevels'.")
outputType?: AnalyzeImageOutputType = AnalyzeImageOutputType.FourSeverityLevels;

@doc("The incidents to detect.")
incidents?: IncidentOptions;
}

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("The image batch analysis input.")
model BatchAnalyzeImages {
@doc("The URL to a blob prefix which represents a directory containing all the images to be analyzed in this batch task.")
blobPrefixLocation: url;

@doc("The delimiter character you desire to use in the location URL, typically '/'.")
delimiter: string;

@doc("An array of strings indicating file extensions of desired images within the logical folder.")
extensions: string[];

@doc("The last modified time (in RFC1123 format) of blobs. Only images that were modified before this time will be analyzed.")
lastModified?: utcDateTime;
}

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("The image batch analysis output.")
model BatchAnalyzeImagesResults {
@doc("The URL to a blob prefix which represents a directory. The analysis result file(s) will be written to this directory.")
blobPrefixLocation: url;

@doc("The delimiter character you desire to use in the location URL, typically '/'.")
delimiter: string;
}

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("Image batch analyze task.")
@resource("image/batchAnalyzeTasks")
@resource("image/batchAnalyses")
model ImageBatchTaskDetail {
@doc("The id of image batch analysis task.")
@key("taskId")
@visibility("read")
@key("operationId")
@visibility("read", "create", "query")
@maxLength(64)
taskId: string;
id: string;

@doc("The kind of operation.")
kind: string;

@doc("The status of the batch image analysis task.")
status: BatchTaskStatus;

@doc("The progress of the batch image analysis task, represented as a percentage (0-100).")
progressPercentage: float64;

@doc("The timestamp of when batch image analysis task was created.")
taskCreatedTime: utcDateTime;
createdTime: utcDateTime;

@doc("The blob parameters of result files.")
analysisResults: BatchAnalyzeImagesResults;

@doc("The progress of the batch image analysis task, represented as a percentage (0-100).")
progressPercentage: float32;

@doc("Return error detail when the task failed.")
error?: Azure.Core.Foundations.Error;
Expand Down
17 changes: 15 additions & 2 deletions specification/cognitiveservices/ContentSafety/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,14 @@ interface ImageBatchOperations {
@added(ContentSafety.Versions.v2023_10_30_Preview)
@summary("Start Batch Analyze Images")
@doc("An asynchronous API for the batch analysis of potentially harmful image content. Currently, it supports four categories: Hate, SelfHarm, Sexual, and Violence.")
@route("/image:batchAnalyze")
@route("/image/batchAnalyses")
@put
batchAnalyzeImage is ContentSafetyLongRunningRpcOperation<
{
@path
@doc("The unique operation id.")
operationId: string;

@body
@doc("The image batch analysis request.")
body: BatchAnalyzeImagesOptions;
Expand All @@ -96,9 +101,17 @@ interface ImageBatchOperations {
>;

@added(ContentSafety.Versions.v2023_10_30_Preview)
@summary("Get Batch Analyze Status")
@summary("Get Image Batch Analysis task Status")
@doc("Check the status of a batch image analysis task.")
getBatchTaskStatus is Azure.Core.ResourceRead<ImageBatchTaskDetail>;

@added(ContentSafety.Versions.v2023_10_30_Preview)
@summary("List All Image Batch Analysis Tasks")
@doc("List all batch image analysis tasks.")
listBatchTasks is Azure.Core.ResourceList<
ImageBatchTaskDetail,
ListQueryParametersTrait<StandardListQueryParameters>
>;
}

@doc("Long running RPC operation template")
Expand Down
Loading