diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/BlocklistAsyncClient.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/BlocklistAsyncClient.java index 9715d66b3aa7..58f652c3884f 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/BlocklistAsyncClient.java +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/BlocklistAsyncClient.java @@ -135,7 +135,7 @@ public Mono> addOrUpdateBlocklistItemsWithResponse(String n public Mono> createOrUpdateTextBlocklistWithResponse(String name, BinaryData options, RequestOptions requestOptions) { // Convenience API is not generated, as operation 'createOrUpdateTextBlocklist' is - // 'application/merge-patch+json' + // 'application/merge-patch+json' and stream-style-serialization is not enabled return this.serviceClient.createOrUpdateTextBlocklistWithResponseAsync(name, options, requestOptions); } diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/BlocklistClient.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/BlocklistClient.java index 552d942caafb..9d50db14d61a 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/BlocklistClient.java +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/BlocklistClient.java @@ -128,7 +128,7 @@ public Response addOrUpdateBlocklistItemsWithResponse(String name, B public Response createOrUpdateTextBlocklistWithResponse(String name, BinaryData options, RequestOptions requestOptions) { // Convenience API is not generated, as operation 'createOrUpdateTextBlocklist' is - // 'application/merge-patch+json' + // 'application/merge-patch+json' and stream-style-serialization is not enabled return this.serviceClient.createOrUpdateTextBlocklistWithResponse(name, options, requestOptions); } diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/BlocklistClientBuilder.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/BlocklistClientBuilder.java index e54e01262bb1..69a756753b58 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/BlocklistClientBuilder.java +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/BlocklistClientBuilder.java @@ -316,7 +316,7 @@ private HttpPipeline createHttpPipeline() { this.pipelinePolicies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) .forEach(p -> policies.add(p)); HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(httpLogOptions)); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient).clientOptions(localClientOptions).build(); return httpPipeline; diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyAsyncClient.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyAsyncClient.java index b689c8a0642e..a0314e06a62e 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyAsyncClient.java +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyAsyncClient.java @@ -6,7 +6,11 @@ import com.azure.ai.contentsafety.implementation.ContentSafetyClientImpl; import com.azure.ai.contentsafety.models.AnalyzeImageOptions; import com.azure.ai.contentsafety.models.AnalyzeImageResult; +import com.azure.ai.contentsafety.models.AnalyzeTextJailbreakOptions; +import com.azure.ai.contentsafety.models.AnalyzeTextJailbreakResult; import com.azure.ai.contentsafety.models.AnalyzeTextOptions; +import com.azure.ai.contentsafety.models.AnalyzeTextProtectedMaterialOptions; +import com.azure.ai.contentsafety.models.AnalyzeTextProtectedMaterialResult; import com.azure.ai.contentsafety.models.AnalyzeTextResult; import com.azure.ai.contentsafety.models.ContentSafetyImageData; import com.azure.core.annotation.Generated; @@ -61,6 +65,12 @@ public final class ContentSafetyAsyncClient { * ] * haltOnBlocklistHit: Boolean (Optional) * outputType: String(FourSeverityLevels/EightSeverityLevels) (Optional) + * incidents (Optional): { + * incidentNames (Optional): [ + * String (Optional) + * ] + * haltOnIncidentHit: Boolean (Optional) + * } * } * } *

@@ -81,6 +91,14 @@ public final class ContentSafetyAsyncClient { * severity: Integer (Optional) * } * ] + * incidentMatches (Optional): [ + * (Optional){ + * incidentName: String (Required) + * } + * ] + * citation (Optional): [ + * String (Optional) + * ] * } * } * @@ -116,6 +134,12 @@ public Mono> analyzeTextWithResponse(BinaryData options, Re * String(Hate/SelfHarm/Sexual/Violence) (Optional) * ] * outputType: String(FourSeverityLevels) (Optional) + * incidents (Optional): { + * incidentNames (Optional): [ + * String (Optional) + * ] + * haltOnIncidentHit: Boolean (Optional) + * } * } * } *

@@ -129,6 +153,11 @@ public Mono> analyzeTextWithResponse(BinaryData options, Re * severity: Integer (Optional) * } * ] + * incidentMatches (Optional): [ + * (Optional){ + * incidentName: String (Required) + * } + * ] * } * } * @@ -259,4 +288,129 @@ public Mono analyzeImage(BinaryData content) { AnalyzeImageOptions options = new AnalyzeImageOptions(new ContentSafetyImageData().setContent(content)); return analyzeImage(options); } + + /** + * Analyze Text Jailbreak + * + * A synchronous API for the analysis of text jailbreak. + *

+ * Request Body Schema + *

+ *
{@code
+     * {
+     *     text: String (Required)
+     * }
+     * }
+ *

+ * Response Body Schema + *

+ *
{@code
+     * {
+     *     jailbreakAnalysis (Required): {
+     *         detected: boolean (Required)
+     *     }
+     * }
+     * }
+ * + * @param options The text jailbreak 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 jailbreak analysis request along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> detectTextJailbreakWithResponse(BinaryData options, + RequestOptions requestOptions) { + return this.serviceClient.detectTextJailbreakWithResponseAsync(options, requestOptions); + } + + /** + * Analyze Protected Material + * + * A synchronous API for the analysis of protected material. + *

+ * Request Body Schema + *

+ *
{@code
+     * {
+     *     text: String (Required)
+     * }
+     * }
+ *

+ * Response Body Schema + *

+ *
{@code
+     * {
+     *     protectedMaterialAnalysis (Required): {
+     *         detected: boolean (Required)
+     *     }
+     * }
+     * }
+ * + * @param options The text protected material 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 protected material analysis response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> detectTextProtectedMaterialWithResponse(BinaryData options, + RequestOptions requestOptions) { + return this.serviceClient.detectTextProtectedMaterialWithResponseAsync(options, requestOptions); + } + + /** + * Analyze Text Jailbreak + * + * A synchronous API for the analysis of text jailbreak. + * + * @param options The text jailbreak analysis request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the text jailbreak analysis request on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono detectTextJailbreak(AnalyzeTextJailbreakOptions options) { + // Generated convenience method for detectTextJailbreakWithResponse + RequestOptions requestOptions = new RequestOptions(); + return detectTextJailbreakWithResponse(BinaryData.fromObject(options), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AnalyzeTextJailbreakResult.class)); + } + + /** + * Analyze Protected Material + * + * A synchronous API for the analysis of protected material. + * + * @param options The text protected material analysis request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the protected material analysis response on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono + detectTextProtectedMaterial(AnalyzeTextProtectedMaterialOptions options) { + // Generated convenience method for detectTextProtectedMaterialWithResponse + RequestOptions requestOptions = new RequestOptions(); + return detectTextProtectedMaterialWithResponse(BinaryData.fromObject(options), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AnalyzeTextProtectedMaterialResult.class)); + } } diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyClient.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyClient.java index bfde1c9964b6..6e47fc606931 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyClient.java +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyClient.java @@ -6,7 +6,11 @@ import com.azure.ai.contentsafety.implementation.ContentSafetyClientImpl; import com.azure.ai.contentsafety.models.AnalyzeImageOptions; import com.azure.ai.contentsafety.models.AnalyzeImageResult; +import com.azure.ai.contentsafety.models.AnalyzeTextJailbreakOptions; +import com.azure.ai.contentsafety.models.AnalyzeTextJailbreakResult; import com.azure.ai.contentsafety.models.AnalyzeTextOptions; +import com.azure.ai.contentsafety.models.AnalyzeTextProtectedMaterialOptions; +import com.azure.ai.contentsafety.models.AnalyzeTextProtectedMaterialResult; import com.azure.ai.contentsafety.models.AnalyzeTextResult; import com.azure.ai.contentsafety.models.ContentSafetyImageData; import com.azure.core.annotation.Generated; @@ -59,6 +63,12 @@ public final class ContentSafetyClient { * ] * haltOnBlocklistHit: Boolean (Optional) * outputType: String(FourSeverityLevels/EightSeverityLevels) (Optional) + * incidents (Optional): { + * incidentNames (Optional): [ + * String (Optional) + * ] + * haltOnIncidentHit: Boolean (Optional) + * } * } * } *

@@ -79,6 +89,14 @@ public final class ContentSafetyClient { * severity: Integer (Optional) * } * ] + * incidentMatches (Optional): [ + * (Optional){ + * incidentName: String (Required) + * } + * ] + * citation (Optional): [ + * String (Optional) + * ] * } * } * @@ -114,6 +132,12 @@ public Response analyzeTextWithResponse(BinaryData options, RequestO * String(Hate/SelfHarm/Sexual/Violence) (Optional) * ] * outputType: String(FourSeverityLevels) (Optional) + * incidents (Optional): { + * incidentNames (Optional): [ + * String (Optional) + * ] + * haltOnIncidentHit: Boolean (Optional) + * } * } * } *

@@ -127,6 +151,11 @@ public Response analyzeTextWithResponse(BinaryData options, RequestO * severity: Integer (Optional) * } * ] + * incidentMatches (Optional): [ + * (Optional){ + * incidentName: String (Required) + * } + * ] * } * } * @@ -257,4 +286,125 @@ public AnalyzeImageResult analyzeImage(BinaryData content) { AnalyzeImageOptions body = new AnalyzeImageOptions(new ContentSafetyImageData().setContent(content)); return analyzeImage(body); } + + /** + * Analyze Text Jailbreak + * + * A synchronous API for the analysis of text jailbreak. + *

+ * Request Body Schema + *

+ *
{@code
+     * {
+     *     text: String (Required)
+     * }
+     * }
+ *

+ * Response Body Schema + *

+ *
{@code
+     * {
+     *     jailbreakAnalysis (Required): {
+     *         detected: boolean (Required)
+     *     }
+     * }
+     * }
+ * + * @param options The text jailbreak 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 jailbreak analysis request along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response detectTextJailbreakWithResponse(BinaryData options, RequestOptions requestOptions) { + return this.serviceClient.detectTextJailbreakWithResponse(options, requestOptions); + } + + /** + * Analyze Protected Material + * + * A synchronous API for the analysis of protected material. + *

+ * Request Body Schema + *

+ *
{@code
+     * {
+     *     text: String (Required)
+     * }
+     * }
+ *

+ * Response Body Schema + *

+ *
{@code
+     * {
+     *     protectedMaterialAnalysis (Required): {
+     *         detected: boolean (Required)
+     *     }
+     * }
+     * }
+ * + * @param options The text protected material 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 protected material analysis response along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response detectTextProtectedMaterialWithResponse(BinaryData options, + RequestOptions requestOptions) { + return this.serviceClient.detectTextProtectedMaterialWithResponse(options, requestOptions); + } + + /** + * Analyze Text Jailbreak + * + * A synchronous API for the analysis of text jailbreak. + * + * @param options The text jailbreak analysis request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the text jailbreak analysis request. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AnalyzeTextJailbreakResult detectTextJailbreak(AnalyzeTextJailbreakOptions options) { + // Generated convenience method for detectTextJailbreakWithResponse + RequestOptions requestOptions = new RequestOptions(); + return detectTextJailbreakWithResponse(BinaryData.fromObject(options), requestOptions).getValue() + .toObject(AnalyzeTextJailbreakResult.class); + } + + /** + * Analyze Protected Material + * + * A synchronous API for the analysis of protected material. + * + * @param options The text protected material analysis request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the protected material analysis response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AnalyzeTextProtectedMaterialResult detectTextProtectedMaterial(AnalyzeTextProtectedMaterialOptions options) { + // Generated convenience method for detectTextProtectedMaterialWithResponse + RequestOptions requestOptions = new RequestOptions(); + return detectTextProtectedMaterialWithResponse(BinaryData.fromObject(options), requestOptions).getValue() + .toObject(AnalyzeTextProtectedMaterialResult.class); + } } diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyClientBuilder.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyClientBuilder.java index 0dfc91c6f627..66d449e02fe8 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyClientBuilder.java +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyClientBuilder.java @@ -316,7 +316,7 @@ private HttpPipeline createHttpPipeline() { this.pipelinePolicies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) .forEach(p -> policies.add(p)); HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(httpLogOptions)); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient).clientOptions(localClientOptions).build(); return httpPipeline; diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyServiceVersion.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyServiceVersion.java index 17bdff7f6bf8..322d9502223e 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyServiceVersion.java +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyServiceVersion.java @@ -13,7 +13,22 @@ public enum ContentSafetyServiceVersion implements ServiceVersion { /** * Enum value 2023-10-01. */ - V2023_10_01("2023-10-01"); + V2023_10_01("2023-10-01"), + + /** + * Enum value 2023-10-15-preview. + */ + V2023_10_15_PREVIEW("2023-10-15-preview"), + + /** + * Enum value 2023-10-30-preview. + */ + V2023_10_30_PREVIEW("2023-10-30-preview"), + + /** + * Enum value 2024-01-30-preview. + */ + V2024_01_30_PREVIEW("2024-01-30-preview"); private final String version; @@ -35,6 +50,6 @@ public String getVersion() { * @return The latest {@link ContentSafetyServiceVersion}. */ public static ContentSafetyServiceVersion getLatest() { - return V2023_10_01; + return V2024_01_30_PREVIEW; } } 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 74de26118073..046d187c96b6 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 @@ -191,6 +191,46 @@ Mono> analyzeImage(@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("/text:detectJailbreak") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> detectTextJailbreak(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept, + @BodyParam("application/json") BinaryData options, RequestOptions requestOptions, Context context); + + @Post("/text:detectJailbreak") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response detectTextJailbreakSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept, + @BodyParam("application/json") BinaryData options, RequestOptions requestOptions, Context context); + + @Post("/text:detectProtectedMaterial") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> detectTextProtectedMaterial(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept, + @BodyParam("application/json") BinaryData options, RequestOptions requestOptions, Context context); + + @Post("/text:detectProtectedMaterial") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response detectTextProtectedMaterialSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept, + @BodyParam("application/json") BinaryData options, RequestOptions requestOptions, Context context); } /** @@ -212,6 +252,12 @@ Response analyzeImageSync(@HostParam("endpoint") String endpoint, * ] * haltOnBlocklistHit: Boolean (Optional) * outputType: String(FourSeverityLevels/EightSeverityLevels) (Optional) + * incidents (Optional): { + * incidentNames (Optional): [ + * String (Optional) + * ] + * haltOnIncidentHit: Boolean (Optional) + * } * } * } *

@@ -232,6 +278,14 @@ Response analyzeImageSync(@HostParam("endpoint") String endpoint, * severity: Integer (Optional) * } * ] + * incidentMatches (Optional): [ + * (Optional){ + * incidentName: String (Required) + * } + * ] + * citation (Optional): [ + * String (Optional) + * ] * } * } * @@ -269,6 +323,12 @@ public Mono> analyzeTextWithResponseAsync(BinaryData option * ] * haltOnBlocklistHit: Boolean (Optional) * outputType: String(FourSeverityLevels/EightSeverityLevels) (Optional) + * incidents (Optional): { + * incidentNames (Optional): [ + * String (Optional) + * ] + * haltOnIncidentHit: Boolean (Optional) + * } * } * } *

@@ -289,6 +349,14 @@ public Mono> analyzeTextWithResponseAsync(BinaryData option * severity: Integer (Optional) * } * ] + * incidentMatches (Optional): [ + * (Optional){ + * incidentName: String (Required) + * } + * ] + * citation (Optional): [ + * String (Optional) + * ] * } * } * @@ -325,6 +393,12 @@ public Response analyzeTextWithResponse(BinaryData options, RequestO * String(Hate/SelfHarm/Sexual/Violence) (Optional) * ] * outputType: String(FourSeverityLevels) (Optional) + * incidents (Optional): { + * incidentNames (Optional): [ + * String (Optional) + * ] + * haltOnIncidentHit: Boolean (Optional) + * } * } * } *

@@ -338,6 +412,11 @@ public Response analyzeTextWithResponse(BinaryData options, RequestO * severity: Integer (Optional) * } * ] + * incidentMatches (Optional): [ + * (Optional){ + * incidentName: String (Required) + * } + * ] * } * } * @@ -374,6 +453,12 @@ public Mono> analyzeImageWithResponseAsync(BinaryData optio * String(Hate/SelfHarm/Sexual/Violence) (Optional) * ] * outputType: String(FourSeverityLevels) (Optional) + * incidents (Optional): { + * incidentNames (Optional): [ + * String (Optional) + * ] + * haltOnIncidentHit: Boolean (Optional) + * } * } * } *

@@ -387,6 +472,11 @@ public Mono> analyzeImageWithResponseAsync(BinaryData optio * severity: Integer (Optional) * } * ] + * incidentMatches (Optional): [ + * (Optional){ + * incidentName: String (Required) + * } + * ] * } * } * @@ -404,4 +494,160 @@ public Response analyzeImageWithResponse(BinaryData options, Request return service.analyzeImageSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, options, requestOptions, Context.NONE); } + + /** + * Analyze Text Jailbreak + * + * A synchronous API for the analysis of text jailbreak. + *

+ * Request Body Schema + *

+ *
{@code
+     * {
+     *     text: String (Required)
+     * }
+     * }
+ *

+ * Response Body Schema + *

+ *
{@code
+     * {
+     *     jailbreakAnalysis (Required): {
+     *         detected: boolean (Required)
+     *     }
+     * }
+     * }
+ * + * @param options The text jailbreak 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 jailbreak analysis request along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> detectTextJailbreakWithResponseAsync(BinaryData options, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.detectTextJailbreak(this.getEndpoint(), + this.getServiceVersion().getVersion(), accept, options, requestOptions, context)); + } + + /** + * Analyze Text Jailbreak + * + * A synchronous API for the analysis of text jailbreak. + *

+ * Request Body Schema + *

+ *
{@code
+     * {
+     *     text: String (Required)
+     * }
+     * }
+ *

+ * Response Body Schema + *

+ *
{@code
+     * {
+     *     jailbreakAnalysis (Required): {
+     *         detected: boolean (Required)
+     *     }
+     * }
+     * }
+ * + * @param options The text jailbreak 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 jailbreak analysis request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response detectTextJailbreakWithResponse(BinaryData options, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.detectTextJailbreakSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, + options, requestOptions, Context.NONE); + } + + /** + * Analyze Protected Material + * + * A synchronous API for the analysis of protected material. + *

+ * Request Body Schema + *

+ *
{@code
+     * {
+     *     text: String (Required)
+     * }
+     * }
+ *

+ * Response Body Schema + *

+ *
{@code
+     * {
+     *     protectedMaterialAnalysis (Required): {
+     *         detected: boolean (Required)
+     *     }
+     * }
+     * }
+ * + * @param options The text protected material 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 protected material analysis response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> detectTextProtectedMaterialWithResponseAsync(BinaryData options, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.detectTextProtectedMaterial(this.getEndpoint(), + this.getServiceVersion().getVersion(), accept, options, requestOptions, context)); + } + + /** + * Analyze Protected Material + * + * A synchronous API for the analysis of protected material. + *

+ * Request Body Schema + *

+ *
{@code
+     * {
+     *     text: String (Required)
+     * }
+     * }
+ *

+ * Response Body Schema + *

+ *
{@code
+     * {
+     *     protectedMaterialAnalysis (Required): {
+     *         detected: boolean (Required)
+     *     }
+     * }
+     * }
+ * + * @param options The text protected material 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 protected material analysis response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response detectTextProtectedMaterialWithResponse(BinaryData options, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.detectTextProtectedMaterialSync(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/implementation/JsonMergePatchHelper.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/JsonMergePatchHelper.java new file mode 100644 index 000000000000..f942bb2b34c4 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/JsonMergePatchHelper.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.implementation; + +import com.azure.ai.contentsafety.models.TextBlocklist; + +/** + * This is the Helper class to enable json merge patch serialization for a model. + */ +public class JsonMergePatchHelper { + private static TextBlocklistAccessor textBlocklistAccessor; + + public interface TextBlocklistAccessor { + TextBlocklist prepareModelForJsonMergePatch(TextBlocklist textBlocklist, boolean jsonMergePatchEnabled); + } + + public static void setTextBlocklistAccessor(TextBlocklistAccessor accessor) { + textBlocklistAccessor = accessor; + } + + public static TextBlocklistAccessor getTextBlocklistAccessor() { + return textBlocklistAccessor; + } +} 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 d599b95471f7..686938657e69 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 @@ -106,4 +106,33 @@ public AnalyzeImageOptions setOutputType(AnalyzeImageOutputType outputType) { this.outputType = outputType; return this; } + + /* + * The incidents to detect. + */ + @Generated + @JsonProperty(value = "incidents") + private IncidentOptions incidents; + + /** + * Get the incidents property: The incidents to detect. + * + * @return the incidents value. + */ + @Generated + public IncidentOptions getIncidents() { + return this.incidents; + } + + /** + * Set the incidents property: The incidents to detect. + * + * @param incidents the incidents value to set. + * @return the AnalyzeImageOptions object itself. + */ + @Generated + public AnalyzeImageOptions setIncidents(IncidentOptions incidents) { + this.incidents = incidents; + return this; + } } diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeImageResult.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeImageResult.java index c81638c92d42..5d7f447530fe 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeImageResult.java +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeImageResult.java @@ -43,4 +43,21 @@ private AnalyzeImageResult( public List getCategoriesAnalysis() { return this.categoriesAnalysis; } + + /* + * The incident match details. + */ + @Generated + @JsonProperty(value = "incidentMatches") + private List incidentMatches; + + /** + * Get the incidentMatches property: The incident match details. + * + * @return the incidentMatches value. + */ + @Generated + public List getIncidentMatches() { + return this.incidentMatches; + } } diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextJailbreakOptions.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextJailbreakOptions.java new file mode 100644 index 000000000000..25643ab84ece --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextJailbreakOptions.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The text jailbreak analysis request. + */ +@Immutable +public final class AnalyzeTextJailbreakOptions { + /* + * The text needs to be analyzed if it attempt to jailbreak. We support a maximum of 1k Unicode characters (Unicode + * code points) in the text of one request. + */ + @Generated + @JsonProperty(value = "text") + private String text; + + /** + * Creates an instance of AnalyzeTextJailbreakOptions class. + * + * @param text the text value to set. + */ + @Generated + @JsonCreator + public AnalyzeTextJailbreakOptions(@JsonProperty(value = "text") String text) { + this.text = text; + } + + /** + * Get the text property: The text needs to be analyzed if it attempt to jailbreak. We support a maximum of 1k + * Unicode characters (Unicode code points) in the text of one request. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextJailbreakResult.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextJailbreakResult.java new file mode 100644 index 000000000000..1853942fdf9b --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextJailbreakResult.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The text jailbreak analysis request. + */ +@Immutable +public final class AnalyzeTextJailbreakResult { + /* + * Analysis result for jailbreak. + */ + @Generated + @JsonProperty(value = "jailbreakAnalysis") + private JailbreakAnalysisResult jailbreakAnalysis; + + /** + * Creates an instance of AnalyzeTextJailbreakResult class. + * + * @param jailbreakAnalysis the jailbreakAnalysis value to set. + */ + @Generated + @JsonCreator + private AnalyzeTextJailbreakResult( + @JsonProperty(value = "jailbreakAnalysis") JailbreakAnalysisResult jailbreakAnalysis) { + this.jailbreakAnalysis = jailbreakAnalysis; + } + + /** + * Get the jailbreakAnalysis property: Analysis result for jailbreak. + * + * @return the jailbreakAnalysis value. + */ + @Generated + public JailbreakAnalysisResult getJailbreakAnalysis() { + return this.jailbreakAnalysis; + } +} 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 21ff6f5a2dd7..d2a5735e74b9 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 @@ -171,4 +171,33 @@ public AnalyzeTextOptions setOutputType(AnalyzeTextOutputType outputType) { this.outputType = outputType; return this; } + + /* + * The incidents to detect. + */ + @Generated + @JsonProperty(value = "incidents") + private IncidentOptions incidents; + + /** + * Get the incidents property: The incidents to detect. + * + * @return the incidents value. + */ + @Generated + public IncidentOptions getIncidents() { + return this.incidents; + } + + /** + * Set the incidents property: The incidents to detect. + * + * @param incidents the incidents value to set. + * @return the AnalyzeTextOptions object itself. + */ + @Generated + public AnalyzeTextOptions setIncidents(IncidentOptions incidents) { + this.incidents = incidents; + return this; + } } diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextProtectedMaterialOptions.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextProtectedMaterialOptions.java new file mode 100644 index 000000000000..bd78d6bb71c6 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextProtectedMaterialOptions.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The protected material analysis request. + */ +@Immutable +public final class AnalyzeTextProtectedMaterialOptions { + /* + * The text needs to be analyzed. We support a maximum of 1k Unicode characters (Unicode code points) in the text + * of one request. + */ + @Generated + @JsonProperty(value = "text") + private String text; + + /** + * Creates an instance of AnalyzeTextProtectedMaterialOptions class. + * + * @param text the text value to set. + */ + @Generated + @JsonCreator + public AnalyzeTextProtectedMaterialOptions(@JsonProperty(value = "text") String text) { + this.text = text; + } + + /** + * Get the text property: The text needs to be analyzed. We support a maximum of 1k Unicode characters (Unicode + * code points) in the text of one request. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextProtectedMaterialResult.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextProtectedMaterialResult.java new file mode 100644 index 000000000000..27d94e2315eb --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextProtectedMaterialResult.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The protected material analysis response. + */ +@Immutable +public final class AnalyzeTextProtectedMaterialResult { + /* + * Analysis result for protected material. + */ + @Generated + @JsonProperty(value = "protectedMaterialAnalysis") + private ProtectedMaterialAnalysisResult protectedMaterialAnalysis; + + /** + * Creates an instance of AnalyzeTextProtectedMaterialResult class. + * + * @param protectedMaterialAnalysis the protectedMaterialAnalysis value to set. + */ + @Generated + @JsonCreator + private AnalyzeTextProtectedMaterialResult( + @JsonProperty(value = "protectedMaterialAnalysis") ProtectedMaterialAnalysisResult protectedMaterialAnalysis) { + this.protectedMaterialAnalysis = protectedMaterialAnalysis; + } + + /** + * Get the protectedMaterialAnalysis property: Analysis result for protected material. + * + * @return the protectedMaterialAnalysis value. + */ + @Generated + public ProtectedMaterialAnalysisResult getProtectedMaterialAnalysis() { + return this.protectedMaterialAnalysis; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextResult.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextResult.java index 21a0a6d33936..2a66252d859e 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextResult.java +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextResult.java @@ -60,4 +60,39 @@ public List getBlocklistsMatch() { public List getCategoriesAnalysis() { return this.categoriesAnalysis; } + + /* + * The incident match details. + */ + @Generated + @JsonProperty(value = "incidentMatches") + private List incidentMatches; + + /* + * Chunks in the original text detected as harmful content. Analysis result and scores are caused by these. + */ + @Generated + @JsonProperty(value = "citation") + private List citation; + + /** + * Get the incidentMatches property: The incident match details. + * + * @return the incidentMatches value. + */ + @Generated + public List getIncidentMatches() { + return this.incidentMatches; + } + + /** + * Get the citation property: Chunks in the original text detected as harmful content. Analysis result and scores + * are caused by these. + * + * @return the citation value. + */ + @Generated + public List getCitation() { + return this.citation; + } } diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/IncidentMatch.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/IncidentMatch.java new file mode 100644 index 000000000000..bd2ad49df861 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/IncidentMatch.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The result of text incident match. + */ +@Immutable +public final class IncidentMatch { + /* + * The name of the matched incident. + */ + @Generated + @JsonProperty(value = "incidentName") + private String incidentName; + + /** + * Creates an instance of IncidentMatch class. + * + * @param incidentName the incidentName value to set. + */ + @Generated + @JsonCreator + private IncidentMatch(@JsonProperty(value = "incidentName") String incidentName) { + this.incidentName = incidentName; + } + + /** + * Get the incidentName property: The name of the matched incident. + * + * @return the incidentName value. + */ + @Generated + public String getIncidentName() { + return this.incidentName; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/IncidentOptions.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/IncidentOptions.java new file mode 100644 index 000000000000..4d5a35f5fda8 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/IncidentOptions.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The text analysis request. + */ +@Fluent +public final class IncidentOptions { + /* + * The accept decision made by service. + */ + @Generated + @JsonProperty(value = "incidentNames") + private List incidentNames; + + /* + * 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. + */ + @Generated + @JsonProperty(value = "haltOnIncidentHit") + private Boolean haltOnIncidentHit; + + /** + * Creates an instance of IncidentOptions class. + */ + @Generated + public IncidentOptions() { + } + + /** + * Get the incidentNames property: The accept decision made by service. + * + * @return the incidentNames value. + */ + @Generated + public List getIncidentNames() { + return this.incidentNames; + } + + /** + * Set the incidentNames property: The accept decision made by service. + * + * @param incidentNames the incidentNames value to set. + * @return the IncidentOptions object itself. + */ + @Generated + public IncidentOptions setIncidentNames(List incidentNames) { + this.incidentNames = incidentNames; + return this; + } + + /** + * Get the haltOnIncidentHit property: 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. + * + * @return the haltOnIncidentHit value. + */ + @Generated + public Boolean isHaltOnIncidentHit() { + return this.haltOnIncidentHit; + } + + /** + * Set the haltOnIncidentHit property: 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. + * + * @param haltOnIncidentHit the haltOnIncidentHit value to set. + * @return the IncidentOptions object itself. + */ + @Generated + public IncidentOptions setHaltOnIncidentHit(Boolean haltOnIncidentHit) { + this.haltOnIncidentHit = haltOnIncidentHit; + return this; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/JailbreakAnalysisResult.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/JailbreakAnalysisResult.java new file mode 100644 index 000000000000..3312852b49db --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/JailbreakAnalysisResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The text jailbreak analysis response. + */ +@Immutable +public final class JailbreakAnalysisResult { + /* + * Analysis result for jailbreak. + */ + @Generated + @JsonProperty(value = "detected") + private boolean detected; + + /** + * Creates an instance of JailbreakAnalysisResult class. + * + * @param detected the detected value to set. + */ + @Generated + @JsonCreator + private JailbreakAnalysisResult(@JsonProperty(value = "detected") boolean detected) { + this.detected = detected; + } + + /** + * Get the detected property: Analysis result for jailbreak. + * + * @return the detected value. + */ + @Generated + public boolean isDetected() { + return this.detected; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/ProtectedMaterialAnalysisResult.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/ProtectedMaterialAnalysisResult.java new file mode 100644 index 000000000000..5cd8734273a4 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/ProtectedMaterialAnalysisResult.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The text protected material analysis response. + */ +@Immutable +public final class ProtectedMaterialAnalysisResult { + /* + * Analysis result for protected material.. + */ + @Generated + @JsonProperty(value = "detected") + private boolean detected; + + /** + * Creates an instance of ProtectedMaterialAnalysisResult class. + * + * @param detected the detected value to set. + */ + @Generated + @JsonCreator + private ProtectedMaterialAnalysisResult(@JsonProperty(value = "detected") boolean detected) { + this.detected = detected; + } + + /** + * Get the detected property: Analysis result for protected material.. + * + * @return the detected value. + */ + @Generated + public boolean isDetected() { + return this.detected; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml b/sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml index f08f1912274a..0fb0464b8cca 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml +++ b/sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml @@ -1,5 +1,5 @@ directory: specification/cognitiveservices/ContentSafety -commit: 91ada2b6fbdb06456e440807e5b4706110930c49 -additionalDirectories: [] +commit: 1c291a85cb9f25c6c3dc67d151b4e2ab75581f5d repo: Azure/azure-rest-api-specs +additionalDirectories: []