Package com.sap.ai.sdk.orchestration

# Class AzureContentFilter

java.lang.Object
com.sap.ai.sdk.orchestration.AzureContentFilter

All Implemented Interfaces:
  `ContentFilter`

public class AzureContentFilter extends Object implements 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
  Constructor
  Description
  `AzureContentFilter()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AzureContentSafetyInputFilterConfig`
  `createInputFilterConfig()`
  Converts `AzureContentFilter` to its serializable counterpart `AzureContentSafetyInputFilterConfig`.
  `AzureContentSafetyOutputFilterConfig`
  `createOutputFilterConfig()`
  Converts `AzureContentFilter` to its serializable counterpart `AzureContentSafetyOutput`.
  `AzureContentFilter`
  `hate(AzureFilterThreshold hate)`
  The filter category for hate content.
  `AzureContentFilter`
  `promptShield(Boolean promptShield)`
  A flag to set prompt shield on input filer.
  `AzureContentFilter`
  `protectedMaterialCode(boolean protectedMaterialCode)`
  The filter category for protected material content.
  `AzureContentFilter`
  `selfHarm(AzureFilterThreshold selfHarm)`
  The filter category for self-harm content.
  `AzureContentFilter`
  `sexual(AzureFilterThreshold sexual)`
  The filter category for sexual content.
  `AzureContentFilter`
  `violence(AzureFilterThreshold violence)`
  The filter category for violence content.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AzureContentFilter

    public AzureContentFilter()

- ## Method Details

  - ### createInputFilterConfig

    @Nonnull public AzureContentSafetyInputFilterConfig createInputFilterConfig()
    Converts `AzureContentFilter` to its serializable counterpart `AzureContentSafetyInputFilterConfig`.
    Specified by:
      `createInputFilterConfig` in interface `ContentFilter`
    Returns:
      the corresponding `AzureContentSafetyInputFilterConfig` object.
    Throws:
      `IllegalArgumentException` - if no policies are set.

  - ### createOutputFilterConfig

    @Nonnull public AzureContentSafetyOutputFilterConfig createOutputFilterConfig()
    Converts `AzureContentFilter` to its serializable counterpart `AzureContentSafetyOutput`.
    Specified by:
      `createOutputFilterConfig` in interface `ContentFilter`
    Returns:
      the corresponding `AzureContentSafetyOutputFilterConfig` object.
    Throws:
      `IllegalArgumentException` - if no policies are set.

  - ### hate

    public AzureContentFilter hate(@Nullable AzureFilterThreshold hate)
    The filter category for hate content.
    Returns:
      `this`.

  - ### selfHarm

    public AzureContentFilter selfHarm(@Nullable AzureFilterThreshold selfHarm)
    The filter category for self-harm content.
    Returns:
      `this`.

  - ### sexual

    public AzureContentFilter sexual(@Nullable AzureFilterThreshold sexual)
    The filter category for sexual content.
    Returns:
      `this`.

  - ### violence

    public AzureContentFilter violence(@Nullable AzureFilterThreshold violence)
    The filter category for violence content.
    Returns:
      `this`.

  - ### protectedMaterialCode

    public AzureContentFilter protectedMaterialCode(boolean protectedMaterialCode)
    The filter category for protected material content.
    Returns:
      `this`.

  - ### promptShield

    public AzureContentFilter promptShield(@Nullable Boolean promptShield)
    A flag to set prompt shield on input filer.
    Returns:
      `this`.
    Since:
      1.9.0