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 batch image API contract #60

Merged
merged 1 commit into from
Feb 5, 2024
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
19 changes: 13 additions & 6 deletions specification/cognitiveservices/ContentSafety/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -274,17 +274,24 @@ model ImageBatchTaskDetail {
@doc("The status of the batch image analysis task.")
status: BatchTaskStatus;

@doc("Batch task result.")
result: ImageBatchTaskResult;

@doc("Return error detail when the task failed.")
error?: Azure.Core.Foundations.Error;
}

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("Image batch task result.")
model ImageBatchTaskResult {
@doc("The timestamp of when batch image analysis task was created.")
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;
@doc("The blob parameters of result files.")
analysisResults: BatchAnalyzeImagesResults;
}

@doc("Text Blocklist.")
Expand Down
12 changes: 1 addition & 11 deletions specification/cognitiveservices/ContentSafety/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ interface ImageBatchOperations {
@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/batchAnalyses")
@put
batchAnalyzeImage is ContentSafetyLongRunningRpcOperation<
batchAnalyzeImage is Azure.Core.RpcOperation<
{
@path
@doc("The unique operation id.")
Expand All @@ -114,16 +114,6 @@ interface ImageBatchOperations {
>;
}

@doc("Long running RPC operation template")
op ContentSafetyLongRunningRpcOperation<
TParams extends TypeSpec.Reflection.Model,
TResponse extends TypeSpec.Reflection.Model
> is Azure.Core.Foundations.Operation<
TParams,
Azure.Core.Foundations.AcceptedResponse & TResponse,
Azure.Core.Foundations.ErrorResponse
>;

interface BatchOps
extends Azure.Core.ResourceOperations<NoRepeatableRequests &
NoConditionalRequests &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@
}
],
"responses": {
"202": {
"description": "The request has been accepted for processing, but processing has not yet completed.",
"200": {
"description": "The request has succeeded.",
"schema": {
"$ref": "#/definitions/ImageBatchTaskDetail"
}
Expand Down Expand Up @@ -2576,32 +2576,45 @@
"$ref": "#/definitions/BatchTaskStatus",
"description": "The status of the batch image analysis task."
},
"result": {
"$ref": "#/definitions/ImageBatchTaskResult",
"description": "Batch task result."
},
"error": {
"$ref": "#/definitions/Azure.Core.Foundations.Error",
"description": "Return error detail when the task failed."
}
},
"required": [
"id",
"kind",
"status",
"result"
]
},
"ImageBatchTaskResult": {
"type": "object",
"description": "Image batch task result.",
"properties": {
"createdTime": {
"type": "string",
"format": "date-time",
"description": "The timestamp of when batch image analysis task was created."
},
"analysisResults": {
"$ref": "#/definitions/BatchAnalyzeImagesResults",
"description": "The blob parameters of result files."
},
"progressPercentage": {
"type": "number",
"format": "float",
"description": "The progress of the batch image analysis task, represented as a percentage (0-100)."
},
"error": {
"$ref": "#/definitions/Azure.Core.Foundations.Error",
"description": "Return error detail when the task failed."
"analysisResults": {
"$ref": "#/definitions/BatchAnalyzeImagesResults",
"description": "The blob parameters of result files."
}
},
"required": [
"id",
"kind",
"status",
"createdTime",
"analysisResults",
"progressPercentage"
"progressPercentage",
"analysisResults"
]
},
"ImageCategoriesAnalysis": {
Expand Down