Skip to main content

Parameters

See plugin common configurations for configuration options available to all plugins.

This plugin supports referencing sensitive parameter values from environment variables using the env:// prefix, or from a secret manager, such as HashiCorp Vault’s KV secrets engine, using the secret:// prefix. For more information, see environment variables in plugin and secrets.

  • comprehend

    object

    required


    AWS Comprehend configurations.

    • access_key_id

      string

      required


      AWS access key ID.

    • secret_access_key

      string

      required


      AWS secret access key. The value is encrypted with AES before being stored in etcd.

    • region

      string

      required


      AWS region.

    • endpoint

      string


      AWS Comprehend service endpoint. If not set, defaults to https://comprehend.{region}.amazonaws.com.

    • ssl_verify

      boolean

      default: true


      If true, enable TLS certificate verification.

  • moderation_categories

    object


    Key-value pairs of moderation category and their corresponding threshold.

    In each pair, the key should be one of the PROFANITY, HATE_SPEECH, INSULT, HARASSMENT_OR_ABUSE, SEXUAL, or VIOLENCE_OR_THREAT; and the threshold value should be between 0 and 1 (inclusive).

  • moderation_threshold

    number

    default: 0.5

    vaild vaule:

    between 0 and 1 inclusive


    Overall toxicity threshold. A higher value means more toxic content allowed.

    This option differs from the individual category thresholds in moderation_categories. For example, if moderation_categories is set with a PROFANITY threshold of 0.5, and a request has a PROFANITY score of 0.1, the request will not exceed the category threshold. However, if the request has other categories like SEXUAL or VIOLENCE_OR_THREAT exceeding the moderation_threshold, the request will be rejected.

  • check_request

    boolean

    default: true


    If true, moderate request content.

    Available in API7 Enterprise 3.9.16+ or 3.10.3+.

  • deny_code

    integer

    default: 200

    vaild vaule:

    between 200 and 599 inclusive


    HTTP status code returned when a request is rejected. Set a 4xx value to expose the rejection as an HTTP error.

    Available in API7 Enterprise 3.9.16+ or 3.10.3+.

  • deny_message

    string


    Message returned when a request is rejected. If unset, the plugin returns the threshold failure reason.

    Available in API7 Enterprise 3.9.16+ or 3.10.3+.

  • fail_mode

    string

    default: skip

    vaild vaule:

    skip, warn, or error


    Behavior when the plugin is bound to a Consumer and receives a request whose format it does not recognize, such as a non-AI request. With skip, the unrecognized request is passed through unchecked. With warn, the request is passed through and a warning is logged. With error, the request is rejected with HTTP 400.

    Available in API7 Enterprise from version 3.9.14.

  • request_check_roles

    array[string]

    default: ["user", "assistant", "system", "tool"]

    vaild vaule:

    user, assistant, system, or tool


    Message roles to moderate on the request side. user, tool, and assistant follow request_check_mode; system is checked on every request because system content can be affected by malicious tool-call arguments. assistant messages are client-supplied conversation history, so they are moderated by default as well.

    Selecting system also covers developer messages, which is the role OpenAI uses in place of system on newer models and on the Responses API. There is no separate developer entry.

    Tool-result moderation applies to OpenAI-compatible formats where tool output is represented as a distinct tool role or item.

    Available in API7 Enterprise from version 3.9.18 on the 3.9 line and from version 3.10.5 on the 3.10 line.

  • request_check_mode

    string

    default: all

    vaild vaule:

    all or last


    Which messages of the selected roles are moderated. With all, every message of a selected role is checked. With last, only the latest consecutive block of selected-role messages is checked. The system role is unaffected and is always checked when selected.

    Selecting assistant together with last widens the block that is considered latest, because assistant turns no longer end it.

    Available in API7 Enterprise from version 3.9.18 on the 3.9 line and from version 3.10.5 on the 3.10 line.

  • request_check_length_limit

    integer

    default: 1000

    vaild vaule:

    between 4 and 1024 inclusive


    Maximum number of bytes of request content per Amazon Comprehend text segment. Longer content is split across several segments so that it is moderated in full instead of being truncated.

    Available in API7 Enterprise from version 3.9.18 on the 3.9 line and from version 3.10.5 on the 3.10 line.

  • check_response

    boolean

    default: false


    If true, moderate the content of the LLM response in addition to the request. A non-streaming response is moderated before it is returned to the client; a streaming response is moderated according to stream_check_mode.

    Available in API7 Enterprise from version 3.9.18 on the 3.9 line and from version 3.10.5 on the 3.10 line.

  • response_check_length_limit

    integer

    default: 1000

    vaild vaule:

    between 4 and 1024 inclusive


    Maximum number of bytes of response content per Amazon Comprehend text segment. Longer content is split across several segments.

    Available in API7 Enterprise from version 3.9.18 on the 3.9 line and from version 3.10.5 on the 3.10 line.

  • stream_check_mode

    string

    default: final_packet

    vaild vaule:

    final_packet or realtime


    How a streaming response is moderated when check_response is enabled. With final_packet, the assembled response is moderated once and the last chunk is annotated with its risk level. With realtime, batches are moderated while the response streams, and the remainder of the stream is replaced with the denial message as soon as a batch is flagged.

    Available in API7 Enterprise from version 3.9.18 on the 3.9 line and from version 3.10.5 on the 3.10 line.

  • stream_check_cache_size

    integer

    default: 128

    vaild vaule:

    greater than or equal to 1


    Maximum number of characters accumulated per moderation batch in realtime mode. A smaller value detects harmful content earlier at the cost of more moderation calls.

    Available in API7 Enterprise from version 3.9.18 on the 3.9 line and from version 3.10.5 on the 3.10 line.

  • stream_check_interval

    number

    default: 3

    vaild vaule:

    greater than or equal to 0.1


    Number of seconds between batch checks in realtime mode.

    Available in API7 Enterprise from version 3.9.18 on the 3.9 line and from version 3.10.5 on the 3.10 line.

  • timeout

    integer

    default: 10000

    vaild vaule:

    greater than or equal to 1


    Timeout in milliseconds for a request to Amazon Comprehend.

    Available in API7 Enterprise from version 3.9.18 on the 3.9 line and from version 3.10.5 on the 3.10 line.

  • keepalive

    boolean

    default: true


    If true, keep the connection to Amazon Comprehend alive so that it is reused across the moderation calls of a request instead of being reopened for each of them.

    Available in API7 Enterprise from version 3.9.18 on the 3.9 line and from version 3.10.5 on the 3.10 line.

  • keepalive_timeout

    integer

    default: 60000

    vaild vaule:

    greater than or equal to 1000


    Idle time in milliseconds after which a pooled connection to Amazon Comprehend is closed.

    Available in API7 Enterprise from version 3.9.18 on the 3.9 line and from version 3.10.5 on the 3.10 line.