Hive (Model Only)

Hive Moderation is a powerful suite of moderation tools that can be used to moderate content in chat rooms.

The Hive (model only) rule is a rule applied to chat rooms in Ably Chat which enables you to use Hive's text moderation models to detect and handle inappropriate content before it is published to other users.

Integration setup

Configure the integration rule in your Ably dashboard or using the Control API.

The following are the fields specific to Hive (model only) configuration:

FieldDescription
Hive API keyThe API key for your Hive account.
ThresholdsA map of text text moderation classes to severity. When moderating text, any message deemed to be at or above a specified threshold will be rejected and not published to the chat room.
Model URL (optional)A custom URL if using a custom moderation model.
Retry timeoutMaximum duration (in milliseconds) that an attempt to invoke the rule may take (including any retries). The possible range is 0 - 5000ms.
Max retriesMaximum number of retries after the first attempt at invoking the rule.
Failed actionThe action to take in the event that a rule fails to invoke. Options are reject the request or publish anyway.
Too many requests actionThe action to take in the event that Hive returns a 429 (Too Many Requests Response). Options are to fail rule invocation, or retry.
Room filter (optional)A regular expression to match to specific chat rooms.

Text length

Hive's models accept content with a maximum length of 1024 characters. If sending a message larger than this, Ably will automatically break the text into smaller requests, with crossover between segments to ensure context is preserved.

Ably will aggregate the model responses, rejecting the message as a whole if one or more of the text segments fail to pass the threshold requirements.

Handling rejections

If a message fails moderation and the rule policy is to reject, then it will be rejected by the server.

Moderation rejections will use error code 42213.