Skip to content

Commit

Permalink
Merge pull request #18 from mengaims/lixiangliu/acs-ir-1030-update
Browse files Browse the repository at this point in the history
Update incident contract
  • Loading branch information
mengaims authored Oct 27, 2023
2 parents 1c5c3af + 36b459e commit 397ec52
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 43 deletions.
34 changes: 25 additions & 9 deletions specification/cognitiveservices/ContentSafety/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,16 @@ model AnalyzeTextOptions {
outputType?: AnalyzeTextOutputType = AnalyzeTextOutputType.FourSeverityLevels;

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("The incidents to detect.")
incidents?: IncidentOptions;
}

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("The text analysis request.")
model IncidentOptions {
@doc("The accept decision made by service.")
incidentNames?: string[];

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("When set to true, further analyses of harmful content will not be performed in cases where incidents are hit. When set to false, all analyses of harmful content will be performed, whether or not incidents are hit.")
haltOnIncidentHit?: boolean;
}
Expand Down Expand Up @@ -124,12 +130,8 @@ model AnalyzeImageOptions {
outputType?: AnalyzeImageOutputType = AnalyzeImageOutputType.FourSeverityLevels;

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("The accept decision made by service.")
incidentNames?: string[];

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("When set to true, further analyses of harmful content will not be performed in cases where incidents are hit. When set to false, all analyses of harmful content will be performed, whether or not incidents are hit.")
haltOnIncidentHit?: boolean;
@doc("The incidents to detect.")
incidents?: IncidentOptions;
}

@doc("The image can be either base64 encoded bytes or a blob URL. You can choose only one of these options. If both are provided, the request will be refused. The maximum image size is 2048 x 2048 pixels and should not exceed 4 MB, while the minimum image size is 50 x 50 pixels.")
Expand Down Expand Up @@ -215,7 +217,7 @@ model RemoveTextBlocklistItemsOptions {

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("Text Incident.")
@resource("text/incident")
@resource("text/incidents")
model TextIncident {
@doc("incident name.")
@pattern("^[0-9A-Za-z._~-]+$")
Expand All @@ -227,6 +229,13 @@ model TextIncident {
@doc("Incident description.")
@maxLength(1024)
description?: string;

@doc("Incident created time.")
@visibility("read", "query")
created: utcDateTime;
@doc("Incident updated time.")
@visibility("read", "query")
lastUpdated: utcDateTime;
}

@added(ContentSafety.Versions.v2023_10_30_Preview)
Expand Down Expand Up @@ -268,7 +277,7 @@ model RemoveTextIncidentSamplesOptions {

@added(ContentSafety.Versions.v2023_10_30_Preview)
@doc("Image Incident.")
@resource("image/incident")
@resource("image/incidents")
model ImageIncident {
@doc("incident name.")
@pattern("^[0-9A-Za-z._~-]+$")
Expand All @@ -280,6 +289,13 @@ model ImageIncident {
@doc("Incident description.")
@maxLength(1024)
description?: string;

@doc("Incident created time.")
@visibility("read", "query")
created: utcDateTime;
@doc("Incident updated time.")
@visibility("read", "query")
lastUpdated: utcDateTime;
}

@added(ContentSafety.Versions.v2023_10_30_Preview)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
},
"tags": [],
"paths": {
"/image/incident": {
"/image/incidents": {
"get": {
"operationId": "ImageIncidents_ListIncidents",
"summary": "Get All Image Incidents",
Expand Down Expand Up @@ -94,7 +94,7 @@
}
}
},
"/image/incident/{incidentName}": {
"/image/incidents/{incidentName}": {
"get": {
"operationId": "ImageIncidents_GetIncidents",
"summary": "Get Image Incident By incidentName",
Expand Down Expand Up @@ -228,7 +228,7 @@
}
}
},
"/image/incident/{incidentName}:addIncidentSamples": {
"/image/incidents/{incidentName}:addIncidentSamples": {
"post": {
"operationId": "ImageIncidents_AddIncidentSamples",
"summary": "Add ImageIncidentSamples To Incident",
Expand Down Expand Up @@ -277,7 +277,7 @@
}
}
},
"/image/incident/{incidentName}:removeIncidentSamples": {
"/image/incidents/{incidentName}:removeIncidentSamples": {
"post": {
"operationId": "ImageIncidents_RemoveIncidentSamples",
"summary": "Remove ImageIncidentSamples From Incident",
Expand Down Expand Up @@ -323,7 +323,7 @@
}
}
},
"/image/incident/{incidentName}/incidentSamples": {
"/image/incidents/{incidentName}/incidentSamples": {
"get": {
"operationId": "ImageIncidents_ListIncidentSamples",
"summary": "Get All ImageIncidentSamples By imageIncidentName",
Expand Down Expand Up @@ -376,7 +376,7 @@
}
}
},
"/image/incident/{incidentName}/incidentSamples/{incidentSampleId}": {
"/image/incidents/{incidentName}/incidentSamples/{incidentSampleId}": {
"get": {
"operationId": "ImageIncidents_GetIncidentSample",
"summary": "Get ImageIncidentSample By imageIncidentName And imageIncidentSampleId",
Expand Down Expand Up @@ -1001,7 +1001,7 @@
}
}
},
"/text/incident": {
"/text/incidents": {
"get": {
"operationId": "TextIncidents_ListIncidents",
"summary": "Get All Text Incidents",
Expand Down Expand Up @@ -1036,7 +1036,7 @@
}
}
},
"/text/incident/{incidentName}": {
"/text/incidents/{incidentName}": {
"get": {
"operationId": "TextIncidents_GetIncidents",
"summary": "Get Text Incident By incidentName",
Expand Down Expand Up @@ -1170,7 +1170,7 @@
}
}
},
"/text/incident/{incidentName}:addIncidentSamples": {
"/text/incidents/{incidentName}:addIncidentSamples": {
"post": {
"operationId": "TextIncidents_AddIncidentSamples",
"summary": "Add TextIncidentSamples To Incident",
Expand Down Expand Up @@ -1219,7 +1219,7 @@
}
}
},
"/text/incident/{incidentName}:removeIncidentSamples": {
"/text/incidents/{incidentName}:removeIncidentSamples": {
"post": {
"operationId": "TextIncidents_RemoveIncidentSamples",
"summary": "Remove TextIncidentSamples From Incident",
Expand Down Expand Up @@ -1265,7 +1265,7 @@
}
}
},
"/text/incident/{incidentName}/incidentSamples": {
"/text/incidents/{incidentName}/incidentSamples": {
"get": {
"operationId": "TextIncidents_ListIncidentSamples",
"summary": "Get All TextIncidentSamples By textIncidentName",
Expand Down Expand Up @@ -1318,7 +1318,7 @@
}
}
},
"/text/incident/{incidentName}/incidentSamples/{incidentSampleId}": {
"/text/incidents/{incidentName}/incidentSamples/{incidentSampleId}": {
"get": {
"operationId": "TextIncidents_GetIncidentSample",
"summary": "Get TextIncidentSample By textIncidentName And textIncidentSampleId",
Expand Down Expand Up @@ -1573,16 +1573,9 @@
"description": "This refers to the type of image analysis output. If no value is assigned, the default value will be \"FourSeverityLevels\".",
"default": "FourSeverityLevels"
},
"incidentNames": {
"type": "array",
"description": "The accept decision made by service.",
"items": {
"type": "string"
}
},
"haltOnIncidentHit": {
"type": "boolean",
"description": "When set to true, further analyses of harmful content will not be performed in cases where incidents are hit. When set to false, all analyses of harmful content will be performed, whether or not incidents are hit."
"incidents": {
"$ref": "#/definitions/IncidentOptions",
"description": "The incidents to detect."
}
},
"required": [
Expand Down Expand Up @@ -1711,16 +1704,9 @@
"description": "This refers to the type of text analysis output. If no value is assigned, the default value will be \"FourSeverityLevels\".",
"default": "FourSeverityLevels"
},
"incidentNames": {
"type": "array",
"description": "The accept decision made by service.",
"items": {
"type": "string"
}
},
"haltOnIncidentHit": {
"type": "boolean",
"description": "When set to true, further analyses of harmful content will not be performed in cases where incidents are hit. When set to false, all analyses of harmful content will be performed, whether or not incidents are hit."
"incidents": {
"$ref": "#/definitions/IncidentOptions",
"description": "The incidents to detect."
}
},
"required": [
Expand Down Expand Up @@ -1959,10 +1945,28 @@
"type": "string",
"description": "Incident description.",
"maxLength": 1024
},
"created": {
"type": "string",
"format": "date-time",
"description": "Incident created time.",
"x-ms-mutability": [
"read"
]
},
"lastUpdated": {
"type": "string",
"format": "date-time",
"description": "Incident updated time.",
"x-ms-mutability": [
"read"
]
}
},
"required": [
"incidentName"
"incidentName",
"created",
"lastUpdated"
]
},
"ImageIncidentCreateOrUpdate": {
Expand Down Expand Up @@ -2070,6 +2074,23 @@
"incidentName"
]
},
"IncidentOptions": {
"type": "object",
"description": "The text analysis request.",
"properties": {
"incidentNames": {
"type": "array",
"description": "The accept decision made by service.",
"items": {
"type": "string"
}
},
"haltOnIncidentHit": {
"type": "boolean",
"description": "When set to true, further analyses of harmful content will not be performed in cases where incidents are hit. When set to false, all analyses of harmful content will be performed, whether or not incidents are hit."
}
}
},
"LabelDefinition": {
"type": "object",
"description": "Label definition.",
Expand Down Expand Up @@ -2492,10 +2513,28 @@
"type": "string",
"description": "Incident description.",
"maxLength": 1024
},
"created": {
"type": "string",
"format": "date-time",
"description": "Incident created time.",
"x-ms-mutability": [
"read"
]
},
"lastUpdated": {
"type": "string",
"format": "date-time",
"description": "Incident updated time.",
"x-ms-mutability": [
"read"
]
}
},
"required": [
"incidentName"
"incidentName",
"created",
"lastUpdated"
]
},
"TextIncidentCreateOrUpdate": {
Expand Down

0 comments on commit 397ec52

Please sign in to comment.