Skip to content

Commit

Permalink
CodeGen from PR 27353 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 4681f0b474ec0a1c7bce450e93e5f474bee0ef5f into 87e46c2a10b8a6d54ac45522659ec0bc9197de39
  • Loading branch information
SDKAuto committed Jan 19, 2024
1 parent e834412 commit efaf6bd
Show file tree
Hide file tree
Showing 20 changed files with 1,396 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -61,6 +65,18 @@ public final class ContentSafetyAsyncClient {
* ]
* haltOnBlocklistHit: Boolean (Optional)
* outputType: String(FourSeverityLevels/EightSeverityLevels) (Optional)
* incidents (Optional): {
* incidentNames (Optional): [
* String (Optional)
* ]
* haltOnIncidentHit: Boolean (Optional)
* }
* customizedCategories (Optional): [
* (Optional){
* categoryName: String (Required)
* modelId: String (Required)
* }
* ]
* }
* }</pre>
* <p>
Expand All @@ -81,6 +97,25 @@ public final class ContentSafetyAsyncClient {
* severity: Integer (Optional)
* }
* ]
* incidentMatches (Optional): [
* (Optional){
* incidentName: String (Required)
* }
* ]
* citation (Optional): [
* String (Optional)
* ]
* customizedCategoriesAnalysis (Required): [
* (Required){
* categoryName: String (Required)
* customizedCategoriesAnalysis (Required): [
* (Required){
* id: int (Required)
* className: String (Required)
* }
* ]
* }
* ]
* }
* }</pre>
*
Expand Down Expand Up @@ -116,6 +151,12 @@ public Mono<Response<BinaryData>> analyzeTextWithResponse(BinaryData options, Re
* String(Hate/SelfHarm/Sexual/Violence) (Optional)
* ]
* outputType: String(FourSeverityLevels) (Optional)
* incidents (Optional): {
* incidentNames (Optional): [
* String (Optional)
* ]
* haltOnIncidentHit: Boolean (Optional)
* }
* }
* }</pre>
* <p>
Expand All @@ -129,6 +170,11 @@ public Mono<Response<BinaryData>> analyzeTextWithResponse(BinaryData options, Re
* severity: Integer (Optional)
* }
* ]
* incidentMatches (Optional): [
* (Optional){
* incidentName: String (Required)
* }
* ]
* }
* }</pre>
*
Expand Down Expand Up @@ -259,4 +305,129 @@ public Mono<AnalyzeImageResult> 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.
* <p>
* <strong>Request Body Schema</strong>
* </p>
* <pre>{@code
* {
* text: String (Required)
* }
* }</pre>
* <p>
* <strong>Response Body Schema</strong>
* </p>
* <pre>{@code
* {
* jailbreakAnalysis (Required): {
* detected: boolean (Required)
* }
* }
* }</pre>
*
* @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<Response<BinaryData>> detectTextJailbreakWithResponse(BinaryData options,
RequestOptions requestOptions) {
return this.serviceClient.detectTextJailbreakWithResponseAsync(options, requestOptions);
}

/**
* Analyze Protected Material
*
* A synchronous API for the analysis of protected material.
* <p>
* <strong>Request Body Schema</strong>
* </p>
* <pre>{@code
* {
* text: String (Required)
* }
* }</pre>
* <p>
* <strong>Response Body Schema</strong>
* </p>
* <pre>{@code
* {
* protectedMaterialAnalysis (Required): {
* detected: boolean (Required)
* }
* }
* }</pre>
*
* @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<Response<BinaryData>> 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<AnalyzeTextJailbreakResult> 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<AnalyzeTextProtectedMaterialResult>
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));
}
}
Loading

0 comments on commit efaf6bd

Please sign in to comment.