-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
[Cognitive Services - Azure AI Content Safety] - [Private Preview] - Add Image Batch Detection #27353
[Cognitive Services - Azure AI Content Safety] - [Private Preview] - Add Image Batch Detection #27353
Changes from 14 commits
8775b51
f76e444
cd1c274
f6d9bb4
429adca
f2dc0f5
4681f0b
10b3271
5766d32
9a375d4
5757924
12d34b1
967700a
835312a
e54dd6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -40,6 +40,32 @@ enum AnalyzeImageOutputType { | |||||
FourSeverityLevels, | ||||||
} | ||||||
|
||||||
@added(ContentSafety.Versions.v2023_10_30_Preview) | ||||||
@doc("The type of batch results storage mode.") | ||||||
enum BatchResultsStorageMode { | ||||||
@doc("Merge each result into one file.") | ||||||
CollectiveResultFile, | ||||||
|
||||||
@doc("Store each result in a single file.") | ||||||
IndividualResultFiles, | ||||||
} | ||||||
|
||||||
@added(ContentSafety.Versions.v2023_10_30_Preview) | ||||||
@doc("The type of batch analysis task status.") | ||||||
enum BatchTaskStatus { | ||||||
@doc("The task has not started yet.") | ||||||
NotStarted, | ||||||
|
||||||
@doc("The task is in progress.") | ||||||
Running, | ||||||
|
||||||
@doc("The task has failed.") | ||||||
Failed, | ||||||
|
||||||
@doc("The task has been succeeded.") | ||||||
Succeeded, | ||||||
} | ||||||
|
||||||
@doc("The text analysis request.") | ||||||
model AnalyzeTextOptions { | ||||||
@doc("The text needs to be analyzed. We support a maximum of 10k Unicode characters (Unicode code points) in the text of one request.") | ||||||
|
@@ -85,7 +111,7 @@ model AnalyzeTextResult { | |||||
@doc("The incident match details.") | ||||||
incidentMatches?: IncidentMatch[]; | ||||||
|
||||||
@added(ContentSafety.Versions.v2024_01_30_Preview) | ||||||
@added(ContentSafety.Versions.v2023_10_30_Preview) | ||||||
@doc("Chunks in the original text detected as harmful content. Analysis result and scores are caused by these.") | ||||||
citation?: string[]; | ||||||
} | ||||||
|
@@ -169,6 +195,90 @@ model ImageCategoriesAnalysis { | |||||
severity?: int32; | ||||||
} | ||||||
|
||||||
@added(ContentSafety.Versions.v2023_10_30_Preview) | ||||||
@doc("The image batch analysis request.") | ||||||
model BatchAnalyzeImagesOptions { | ||||||
@doc("The blob parameters of images to be analyzed.") | ||||||
images: BatchAnalyzeImages; | ||||||
|
||||||
@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'.") | ||||||
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/batchAnalyses") | ||||||
model ImageBatchTaskDetail { | ||||||
@doc("The id of image batch analysis task.") | ||||||
@key("operationId") | ||||||
@visibility("read", "create", "query") | ||||||
@maxLength(64) | ||||||
id: string; | ||||||
|
||||||
@doc("The kind of operation.") | ||||||
kind: string; | ||||||
|
||||||
@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 progress of the batch image analysis task, represented as a percentage (0-100).") | ||||||
progressPercentage: int32; | ||||||
|
||||||
@doc("The blob parameters of result files.") | ||||||
analysisResults: BatchAnalyzeImagesResults; | ||||||
} | ||||||
|
||||||
@doc("Text Blocklist.") | ||||||
@resource("text/blocklists") | ||||||
model TextBlocklist { | ||||||
|
@@ -450,15 +560,20 @@ model AnnotateTextResult { | |||||
@added(Versions.v2023_10_30_Preview) | ||||||
@doc("Pre-defined concept.") | ||||||
model PreDefinedConcept { | ||||||
@doc("The concept name.") | ||||||
concept: string; | ||||||
@doc("The concept description.") | ||||||
description: string; | ||||||
} | ||||||
|
||||||
@added(Versions.v2023_10_30_Preview) | ||||||
@doc("Label definition.") | ||||||
model SubCategory { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Subcategory is a single word. This is not going to look good in a public-facing API. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You even use it as such below in docs. Be consistent. Use single word casing everywhere. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for pointing out! Changed it to Subcategory |
||||||
@doc("The id of subcategory.") | ||||||
id: int32; | ||||||
@doc("The name of subcategory.") | ||||||
name: string; | ||||||
@doc("The description of subcategory.") | ||||||
statements: string[]; | ||||||
} | ||||||
|
||||||
|
@@ -473,9 +588,16 @@ model TextCustomizedCategory { | |||||
@maxLength(64) | ||||||
categoryName: string; | ||||||
|
||||||
@doc("Some pre defined concepts used in definition.") | ||||||
preDefinedConcepts?: PreDefinedConcept[]; | ||||||
|
||||||
@doc("Subcategories in the customized category.") | ||||||
subCategories: SubCategory[]; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
It's a single word. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. |
||||||
|
||||||
@doc("Text customizedCategories emphases.") | ||||||
emphases?: string[]; | ||||||
|
||||||
@doc("Text url of example jsonl blob.") | ||||||
exampleBlobUrl?: url; | ||||||
} | ||||||
|
||||||
|
@@ -539,6 +661,7 @@ enum Task { | |||||
QnA, | ||||||
} | ||||||
|
||||||
#suppress "@azure-tools/typespec-azure-core/casing-style" "MUST fix in next update" | ||||||
@added(Versions.v2023_10_30_Preview) | ||||||
@doc("Connection details for the GPT resource.") | ||||||
model GptResource { | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very confusing name. Even I had to review this several times over again. You might consider not putting anything called "results" in a request model, or at least something like
saveResultsLocation
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the name to "resultsBlob" as ChatGPT suggested. I did not use the word "location" because there is one "blobPrefixLocation" under this concept.