Package com.sap.ai.sdk.orchestration
Class AzureContentFilter
java.lang.Object
com.sap.ai.sdk.orchestration.AzureContentFilter
- All Implemented Interfaces:
ContentFilter
A content filter wrapping Azure Content Safety.
This class allows setting filtration thresholds for different content categories such as hate, self-harm, sexual, and violence.
Example usage:
AzureContentFilter filter = new AzureContentFilter()
.hate(AzureFilterThreshold.ALLOW_SAFE)
.selfHarm(AzureFilterThreshold.ALLOW_SAFE_LOW);
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConvertsAzureContentFilterto its serializable counterpartAzureContentSafetyInputFilterConfig.ConvertsAzureContentFilterto its serializable counterpartAzureContentSafetyOutput.hate(AzureFilterThreshold hate) The filter category for hate content.promptShield(Boolean promptShield) A flag to set prompt shield on input filer.protectedMaterialCode(boolean protectedMaterialCode) The filter category for protected material content.selfHarm(AzureFilterThreshold selfHarm) The filter category for self-harm content.sexual(AzureFilterThreshold sexual) The filter category for sexual content.violence(AzureFilterThreshold violence) The filter category for violence content.
-
Constructor Details
-
AzureContentFilter
public AzureContentFilter()
-
-
Method Details
-
createInputFilterConfig
ConvertsAzureContentFilterto its serializable counterpartAzureContentSafetyInputFilterConfig.- Specified by:
createInputFilterConfigin interfaceContentFilter- Returns:
- the corresponding
AzureContentSafetyInputFilterConfigobject. - Throws:
IllegalArgumentException- if no policies are set.
-
createOutputFilterConfig
ConvertsAzureContentFilterto its serializable counterpartAzureContentSafetyOutput.- Specified by:
createOutputFilterConfigin interfaceContentFilter- Returns:
- the corresponding
AzureContentSafetyOutputFilterConfigobject. - Throws:
IllegalArgumentException- if no policies are set.
-
hate
The filter category for hate content.- Returns:
this.
-
selfHarm
The filter category for self-harm content.- Returns:
this.
-
sexual
The filter category for sexual content.- Returns:
this.
-
violence
The filter category for violence content.- Returns:
this.
-
protectedMaterialCode
The filter category for protected material content.- Returns:
this.
-
promptShield
A flag to set prompt shield on input filer.- Returns:
this.- Since:
- 1.9.0
-