diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/ContentSafetyClientImpl.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/ContentSafetyClientImpl.java index 5c24a16c86a46..af66d0d512d27 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/ContentSafetyClientImpl.java +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/ContentSafetyClientImpl.java @@ -152,65 +152,64 @@ public ContentSafetyClientImpl(HttpPipeline httpPipeline, SerializerAdapter seri @Host("{endpoint}/contentsafety") @ServiceInterface(name = "ContentSafetyClient") public interface ContentSafetyClientService { - @Post("/text:analyze") + @Post("/image:analyze") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> analyzeText(@HostParam("endpoint") String endpoint, + Mono> analyzeImage(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData options, RequestOptions requestOptions, Context context); - @Post("/text:analyze") + @Post("/image:analyze") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response analyzeTextSync(@HostParam("endpoint") String endpoint, + Response analyzeImageSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData options, RequestOptions requestOptions, Context context); - @Post("/image:analyze") + @Post("/text:analyze") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> analyzeImage(@HostParam("endpoint") String endpoint, + Mono> analyzeText(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData options, RequestOptions requestOptions, Context context); - @Post("/image:analyze") + @Post("/text:analyze") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response analyzeImageSync(@HostParam("endpoint") String endpoint, + Response analyzeTextSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData options, RequestOptions requestOptions, Context context); } /** - * Analyze Text + * Analyze Image * - * A synchronous API for the analysis of potentially harmful text content. Currently, it supports four categories: + * A synchronous API for the analysis of potentially harmful image content. Currently, it supports four categories: * Hate, SelfHarm, Sexual, and Violence. *

Request Body Schema

* *
{@code
      * {
-     *     text: String (Required)
+     *     image (Required): {
+     *         content: byte[] (Optional)
+     *         blobUrl: String (Optional)
+     *     }
      *     categories (Optional): [
      *         String(Hate/SelfHarm/Sexual/Violence) (Optional)
      *     ]
-     *     blocklistNames (Optional): [
-     *         String (Optional)
-     *     ]
-     *     haltOnBlocklistHit: Boolean (Optional)
-     *     outputType: String(FourSeverityLevels/EightSeverityLevels) (Optional)
+     *     outputType: String(FourSeverityLevels) (Optional)
      * }
      * }
* @@ -218,13 +217,6 @@ Response analyzeImageSync(@HostParam("endpoint") String endpoint, * *
{@code
      * {
-     *     blocklistsMatch (Optional): [
-     *          (Optional){
-     *             blocklistName: String (Required)
-     *             blocklistItemId: String (Required)
-     *             blocklistItemText: String (Required)
-     *         }
-     *     ]
      *     categoriesAnalysis (Required): [
      *          (Required){
      *             category: String(Hate/SelfHarm/Sexual/Violence) (Required)
@@ -234,39 +226,38 @@ Response analyzeImageSync(@HostParam("endpoint") String endpoint,
      * }
      * }
* - * @param options The text analysis request. + * @param options The image analysis request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the text analysis response along with {@link Response} on successful completion of {@link Mono}. + * @return the image analysis response along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> analyzeTextWithResponseAsync(BinaryData options, RequestOptions requestOptions) { + public Mono> analyzeImageWithResponseAsync(BinaryData options, RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil.withContext(context -> service.analyzeText(this.getEndpoint(), + return FluxUtil.withContext(context -> service.analyzeImage(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, options, requestOptions, context)); } /** - * Analyze Text + * Analyze Image * - * A synchronous API for the analysis of potentially harmful text content. Currently, it supports four categories: + * A synchronous API for the analysis of potentially harmful image content. Currently, it supports four categories: * Hate, SelfHarm, Sexual, and Violence. *

Request Body Schema

* *
{@code
      * {
-     *     text: String (Required)
+     *     image (Required): {
+     *         content: byte[] (Optional)
+     *         blobUrl: String (Optional)
+     *     }
      *     categories (Optional): [
      *         String(Hate/SelfHarm/Sexual/Violence) (Optional)
      *     ]
-     *     blocklistNames (Optional): [
-     *         String (Optional)
-     *     ]
-     *     haltOnBlocklistHit: Boolean (Optional)
-     *     outputType: String(FourSeverityLevels/EightSeverityLevels) (Optional)
+     *     outputType: String(FourSeverityLevels) (Optional)
      * }
      * }
* @@ -274,13 +265,6 @@ public Mono> analyzeTextWithResponseAsync(BinaryData option * *
{@code
      * {
-     *     blocklistsMatch (Optional): [
-     *          (Optional){
-     *             blocklistName: String (Required)
-     *             blocklistItemId: String (Required)
-     *             blocklistItemText: String (Required)
-     *         }
-     *     ]
      *     categoriesAnalysis (Required): [
      *          (Required){
      *             category: String(Hate/SelfHarm/Sexual/Violence) (Required)
@@ -290,38 +274,39 @@ public Mono> analyzeTextWithResponseAsync(BinaryData option
      * }
      * }
* - * @param options The text analysis request. + * @param options The image analysis request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the text analysis response along with {@link Response}. + * @return the image analysis response along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response analyzeTextWithResponse(BinaryData options, RequestOptions requestOptions) { + public Response analyzeImageWithResponse(BinaryData options, RequestOptions requestOptions) { final String accept = "application/json"; - return service.analyzeTextSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, options, + return service.analyzeImageSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, options, requestOptions, Context.NONE); } /** - * Analyze Image + * Analyze Text * - * A synchronous API for the analysis of potentially harmful image content. Currently, it supports four categories: + * A synchronous API for the analysis of potentially harmful text content. Currently, it supports four categories: * Hate, SelfHarm, Sexual, and Violence. *

Request Body Schema

* *
{@code
      * {
-     *     image (Required): {
-     *         content: byte[] (Optional)
-     *         blobUrl: String (Optional)
-     *     }
+     *     text: String (Required)
      *     categories (Optional): [
      *         String(Hate/SelfHarm/Sexual/Violence) (Optional)
      *     ]
-     *     outputType: String(FourSeverityLevels) (Optional)
+     *     blocklistNames (Optional): [
+     *         String (Optional)
+     *     ]
+     *     haltOnBlocklistHit: Boolean (Optional)
+     *     outputType: String(FourSeverityLevels/EightSeverityLevels) (Optional)
      * }
      * }
* @@ -329,6 +314,13 @@ public Response analyzeTextWithResponse(BinaryData options, RequestO * *
{@code
      * {
+     *     blocklistsMatch (Optional): [
+     *          (Optional){
+     *             blocklistName: String (Required)
+     *             blocklistItemId: String (Required)
+     *             blocklistItemText: String (Required)
+     *         }
+     *     ]
      *     categoriesAnalysis (Required): [
      *          (Required){
      *             category: String(Hate/SelfHarm/Sexual/Violence) (Required)
@@ -338,38 +330,39 @@ public Response analyzeTextWithResponse(BinaryData options, RequestO
      * }
      * }
* - * @param options The image analysis request. + * @param options The text analysis request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the image analysis response along with {@link Response} on successful completion of {@link Mono}. + * @return the text analysis response along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> analyzeImageWithResponseAsync(BinaryData options, RequestOptions requestOptions) { + public Mono> analyzeTextWithResponseAsync(BinaryData options, RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil.withContext(context -> service.analyzeImage(this.getEndpoint(), + return FluxUtil.withContext(context -> service.analyzeText(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, options, requestOptions, context)); } /** - * Analyze Image + * Analyze Text * - * A synchronous API for the analysis of potentially harmful image content. Currently, it supports four categories: + * A synchronous API for the analysis of potentially harmful text content. Currently, it supports four categories: * Hate, SelfHarm, Sexual, and Violence. *

Request Body Schema

* *
{@code
      * {
-     *     image (Required): {
-     *         content: byte[] (Optional)
-     *         blobUrl: String (Optional)
-     *     }
+     *     text: String (Required)
      *     categories (Optional): [
      *         String(Hate/SelfHarm/Sexual/Violence) (Optional)
      *     ]
-     *     outputType: String(FourSeverityLevels) (Optional)
+     *     blocklistNames (Optional): [
+     *         String (Optional)
+     *     ]
+     *     haltOnBlocklistHit: Boolean (Optional)
+     *     outputType: String(FourSeverityLevels/EightSeverityLevels) (Optional)
      * }
      * }
* @@ -377,6 +370,13 @@ public Mono> analyzeImageWithResponseAsync(BinaryData optio * *
{@code
      * {
+     *     blocklistsMatch (Optional): [
+     *          (Optional){
+     *             blocklistName: String (Required)
+     *             blocklistItemId: String (Required)
+     *             blocklistItemText: String (Required)
+     *         }
+     *     ]
      *     categoriesAnalysis (Required): [
      *          (Required){
      *             category: String(Hate/SelfHarm/Sexual/Violence) (Required)
@@ -386,18 +386,18 @@ public Mono> analyzeImageWithResponseAsync(BinaryData optio
      * }
      * }
* - * @param options The image analysis request. + * @param options The text analysis request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the image analysis response along with {@link Response}. + * @return the text analysis response along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response analyzeImageWithResponse(BinaryData options, RequestOptions requestOptions) { + public Response analyzeTextWithResponse(BinaryData options, RequestOptions requestOptions) { final String accept = "application/json"; - return service.analyzeImageSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, options, + return service.analyzeTextSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, options, requestOptions, Context.NONE); } } diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeImageOptions.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeImageOptions.java index 938f82eb5e132..72d04176b574a 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeImageOptions.java +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeImageOptions.java @@ -19,7 +19,7 @@ public final class AnalyzeImageOptions implements JsonSerializable { /* - * The image needs to be analyzed. + * The image to be analyzed. */ @Generated private final ContentSafetyImageData image; @@ -49,7 +49,7 @@ public AnalyzeImageOptions(ContentSafetyImageData image) { } /** - * Get the image property: The image needs to be analyzed. + * Get the image property: The image to be analyzed. * * @return the image value. */ diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextOptions.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextOptions.java index 7db5199352924..a9ec9d3c390ce 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextOptions.java +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextOptions.java @@ -19,8 +19,8 @@ public final class AnalyzeTextOptions implements JsonSerializable { /* - * The text needs to be analyzed. We support a maximum of 10k Unicode characters (Unicode code points) in the text - * of one request. + * The text to be analyzed. We support a maximum of 10k Unicode characters (Unicode code points) in the text of one + * request. */ @Generated private final String text; @@ -63,8 +63,8 @@ public AnalyzeTextOptions(String text) { } /** - * Get the text property: The text needs to be analyzed. We support a maximum of 10k Unicode characters (Unicode - * code points) in the text of one request. + * Get the text property: The text to be analyzed. We support a maximum of 10k Unicode characters (Unicode code + * points) in the text of one request. * * @return the text value. */ diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/ImageCategory.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/ImageCategory.java index 67ee0baa07793..e6a2bf07d4bad 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/ImageCategory.java +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/ImageCategory.java @@ -8,30 +8,30 @@ import java.util.Collection; /** - * Image analyze category. + * The harm category supported in Image content analysis. */ public final class ImageCategory extends ExpandableStringEnum { /** - * Static value Hate for ImageCategory. + * The harm category for Image - Hate. */ @Generated public static final ImageCategory HATE = fromString("Hate"); /** - * Static value SelfHarm for ImageCategory. + * The harm category for Image - SelfHarm. */ @Generated public static final ImageCategory SELF_HARM = fromString("SelfHarm"); /** - * Static value Sexual for ImageCategory. + * The harm category for Image - Sexual. */ @Generated public static final ImageCategory SEXUAL = fromString("Sexual"); /** - * Static value Violence for ImageCategory. + * The harm category for Image - Violence. */ @Generated public static final ImageCategory VIOLENCE = fromString("Violence"); diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextBlocklistItem.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextBlocklistItem.java index 407283f31eec0..69d97eaff5293 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextBlocklistItem.java +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextBlocklistItem.java @@ -30,7 +30,7 @@ public final class TextBlocklistItem implements JsonSerializable { /** - * Static value Hate for TextCategory. + * The harm category for Text - Hate. */ @Generated public static final TextCategory HATE = fromString("Hate"); /** - * Static value SelfHarm for TextCategory. + * The harm category for Text - SelfHarm. */ @Generated public static final TextCategory SELF_HARM = fromString("SelfHarm"); /** - * Static value Sexual for TextCategory. + * The harm category for Text - Sexual. */ @Generated public static final TextCategory SEXUAL = fromString("Sexual"); /** - * Static value Violence for TextCategory. + * The harm category for Text - Violence. */ @Generated public static final TextCategory VIOLENCE = fromString("Violence"); diff --git a/sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml b/sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml index 9ac15f28adb74..384b2c5d714fe 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml +++ b/sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/cognitiveservices/ContentSafety -commit: df3cd3e3d50eec1d1da593750e1ea3a4db3f541d +commit: a5b9c3a88dd231e855833fe4c3a6941b37e3c677 additionalDirectories: [] repo: Azure/azure-rest-api-specs