Class GuardrailContentFilter

  • All Implemented Interfaces:
    Serializable, SdkPojo, ToCopyableBuilder<GuardrailContentFilter.Builder,​GuardrailContentFilter>

    @Generated("software.amazon.awssdk:codegen")
    public final class GuardrailContentFilter
    extends Object
    implements SdkPojo, Serializable, ToCopyableBuilder<GuardrailContentFilter.Builder,​GuardrailContentFilter>

    Contains filter strengths for harmful content. Guardrails support the following content filters to detect and filter harmful user inputs and FM-generated outputs.

    • Hate – Describes language or a statement that discriminates, criticizes, insults, denounces, or dehumanizes a person or group on the basis of an identity (such as race, ethnicity, gender, religion, sexual orientation, ability, and national origin).

    • Insults – Describes language or a statement that includes demeaning, humiliating, mocking, insulting, or belittling language. This type of language is also labeled as bullying.

    • Sexual – Describes language or a statement that indicates sexual interest, activity, or arousal using direct or indirect references to body parts, physical traits, or sex.

    • Violence – Describes language or a statement that includes glorification of or threats to inflict physical pain, hurt, or injury toward a person, group or thing.

    Content filtering depends on the confidence classification of user inputs and FM responses across each of the four harmful categories. All input and output statements are classified into one of four confidence levels (NONE, LOW, MEDIUM, HIGH) for each harmful category. For example, if a statement is classified as Hate with HIGH confidence, the likelihood of the statement representing hateful content is high. A single statement can be classified across multiple categories with varying confidence levels. For example, a single statement can be classified as Hate with HIGH confidence, Insults with LOW confidence, Sexual with NONE confidence, and Violence with MEDIUM confidence.

    For more information, see Guardrails content filters.

    This data type is used in the following API operations:

    See Also:
    Serialized Form
    • Method Detail

      • inputStrength

        public final GuardrailFilterStrength inputStrength()

        The strength of the content filter to apply to prompts. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces.

        If the service returns an enum value that is not available in the current SDK version, inputStrength will return GuardrailFilterStrength.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from inputStrengthAsString().

        Returns:
        The strength of the content filter to apply to prompts. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces.
        See Also:
        GuardrailFilterStrength
      • inputStrengthAsString

        public final String inputStrengthAsString()

        The strength of the content filter to apply to prompts. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces.

        If the service returns an enum value that is not available in the current SDK version, inputStrength will return GuardrailFilterStrength.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from inputStrengthAsString().

        Returns:
        The strength of the content filter to apply to prompts. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces.
        See Also:
        GuardrailFilterStrength
      • outputStrength

        public final GuardrailFilterStrength outputStrength()

        The strength of the content filter to apply to model responses. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces.

        If the service returns an enum value that is not available in the current SDK version, outputStrength will return GuardrailFilterStrength.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from outputStrengthAsString().

        Returns:
        The strength of the content filter to apply to model responses. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces.
        See Also:
        GuardrailFilterStrength
      • outputStrengthAsString

        public final String outputStrengthAsString()

        The strength of the content filter to apply to model responses. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces.

        If the service returns an enum value that is not available in the current SDK version, outputStrength will return GuardrailFilterStrength.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from outputStrengthAsString().

        Returns:
        The strength of the content filter to apply to model responses. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces.
        See Also:
        GuardrailFilterStrength
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public final boolean equals​(Object obj)
        Overrides:
        equals in class Object
      • toString

        public final String toString()
        Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be redacted from this string using a placeholder value.
        Overrides:
        toString in class Object
      • getValueForField

        public final <T> Optional<T> getValueForField​(String fieldName,
                                                      Class<T> clazz)