Skip to content

Commit b915cd8

Browse files
committed
chat/moderation: extract common fields for before-publish rules
1 parent cecc2bb commit b915cd8

File tree

5 files changed

+19
-24
lines changed

5 files changed

+19
-24
lines changed

src/pages/docs/chat/moderation/custom/index.mdx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,7 @@ Before publish moderation is where your moderation logic is invoked before the m
1313

1414
### Integration configuration <a id="configuration"/>
1515

16-
To fine-tune how Ably handles messages according to your use-case, you can configure before publish rule behavior using the following fields:
17-
18-
| Field | Description |
19-
| ----- | ----------- |
20-
| Retry timeout | Maximum duration (in milliseconds) that an attempt to invoke the rule may take (including any retries). |
21-
| Max retries | Maximum number of retries after the first attempt at invoking the rule. |
22-
| Failed action | The action to take in the event that a rule fails to invoke. Options are reject the request or publish anyway. |
23-
| Too many requests action | The action to take if your endpoint returns `429 Too Many Requests`, which may happen if your endpoint is overloaded. The options are to fail moderation, or retry. |
24-
| Room filter (optional) | A regular expression to match to specific chat rooms. |
16+
To fine-tune how Ably handles messages according to your use-case, see the [common configuration fields](/docs/chat/moderation#common-config) shared across all before-publish moderation rules.
2517

2618
### The API <a id="api"/>
2719

src/pages/docs/chat/moderation/direct/bodyguard.mdx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@ The following are the fields specific to Bodyguard configuration:
1919
| Channel ID | The ID of your Bodyguard channel where moderation rules are configured. |
2020
| Default Language (optional) | The default language to use for content analysis. This will be used as a fallback in case automatic language detection fails. |
2121
| Model URL (optional) | A custom URL if using a custom moderation model. |
22-
| Retry timeout | Maximum duration (in milliseconds) that an attempt to invoke the rule may take (including any retries). The possible range is 0 - 5000ms. |
23-
| Max retries | Maximum number of retries after the first attempt at invoking the rule. |
24-
| Failed action | The action to take in the event that a rule fails to invoke. Options are reject the request or publish anyway. |
25-
| Too many requests action | The action to take in the event that Bodyguard returns a 429 (Too Many Requests Response). Options are to fail rule invocation, or retry. |
26-
| Room filter (optional) | A regular expression to match to specific chat rooms. |
22+
23+
For additional configuration options shared across all before-publish moderation rules, see the [common configuration fields](/docs/chat/moderation#common-config).
2724

2825
Messages will be rejected if Bodyguard's analysis returns a `REMOVE` recommended action based on the moderation rules configured in your Bodyguard channel.
2926

src/pages/docs/chat/moderation/direct/hive-model-only.mdx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ The following are the fields specific to Hive (model only) configuration:
1818
| Hive API key | The API key for your Hive account. |
1919
| Thresholds | A map of text [text moderation classes](https://docs.thehive.ai/reference/text-moderation) to [severity](https://docs.thehive.ai/docs/detailed-class-descriptions-text-moderation). When moderating text, any message deemed to be at or above a specified threshold will be rejected and not published to the chat room. |
2020
| Model URL (optional) | A custom URL if using a custom moderation model. |
21-
| Retry timeout | Maximum duration (in milliseconds) that an attempt to invoke the rule may take (including any retries). The possible range is 0 - 5000ms. |
22-
| Max retries | Maximum number of retries after the first attempt at invoking the rule. |
23-
| Failed action | The action to take in the event that a rule fails to invoke. Options are reject the request or publish anyway. |
24-
| Too many requests action | The action to take in the event that Hive returns a 429 (Too Many Requests Response). Options are to fail rule invocation, or retry. |
25-
| Room filter (optional) | A regular expression to match to specific chat rooms. |
21+
22+
For additional configuration options shared across all before-publish moderation rules, see the [common configuration fields](/docs/chat/moderation#common-config).
2623

2724
## Text length <a id="text-length"/>
2825

src/pages/docs/chat/moderation/direct/tisane.mdx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@ The following are the fields specific to Tisane configuration:
1919
| Thresholds | A map of [text moderation categories](https://docs.tisane.ai/apis/tisane-api-response-guide#supported-types) to severity levels (`low`, `medium`, `high`, `extreme`). When moderating text, any message deemed to be at or above a specified threshold will be rejected and not published to the chat room. |
2020
| Default Language | The language to use for content analysis. |
2121
| Model URL (optional) | A custom URL if using a custom moderation model. |
22-
| Retry timeout | Maximum duration (in milliseconds) that an attempt to invoke the rule may take (including any retries). The possible range is 0 - 5000ms. |
23-
| Max retries | Maximum number of retries after the first attempt at invoking the rule. |
24-
| Failed action | The action to take in the event that a rule fails to invoke. Options are reject the request or publish anyway. |
25-
| Too many requests action | The action to take in the event that Tisane returns a 429 (Too Many Requests Response). Options are to fail rule invocation, or retry. |
26-
| Room filter (optional) | A regular expression to match to specific chat rooms. |
22+
23+
For additional configuration options shared across all before-publish moderation rules, see the [common configuration fields](/docs/chat/moderation#common-config).
2724

2825
## Handling rejections <a id="rejections"/>
2926

src/pages/docs/chat/moderation/index.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ When using before publish moderation, a message is reviewed by an automated mode
1919

2020
This approach provides additional safety guarantees, but may come at the cost of a small amount of latency, as messages must be vetted prior to being published.
2121

22+
#### Common Configuration Fields <a id="common-config"/>
23+
24+
All before-publish moderation rules share the following configuration fields:
25+
26+
| Field | Description |
27+
| ----- | ----------- |
28+
| Retry timeout | Maximum duration (in milliseconds) that an attempt to invoke the rule may take (including any retries). The possible range is 0 - 5000ms. |
29+
| Max retries | Maximum number of retries after the first attempt at invoking the rule. |
30+
| Failed action | The action to take in the event that a rule fails to invoke. Options are reject the request or publish anyway. |
31+
| Too many requests action | The action to take in the event that the moderation provider returns a 429 (Too Many Requests Response). Options are to fail rule invocation, or retry. |
32+
| Room filter (optional) | A regular expression to match to specific chat rooms. |
33+
2234
### After publish <a id="after-publish"/>
2335

2436
When using after publish moderation, a message is published as normal, but is forwarded to a moderation engine after the fact. This enables you to avoid the latency penalty of vetting content prior to publish, at the expense of bad content being visible in the chat room (at least briefly). Many automated moderation solutions are able to process and delete offending messages within a few seconds of publication.

0 commit comments

Comments
 (0)