Yilialinn commented on code in PR #13167:
URL: https://github.com/apache/apisix/pull/13167#discussion_r3116725559


##########
docs/en/latest/plugins/ai-aliyun-content-moderation.md:
##########
@@ -27,103 +30,646 @@ description: This document contains information about the 
Apache APISIX ai-aliyu
 #
 -->
 
+<head>
+  <link rel="canonical" 
href="https://docs.api7.ai/hub/ai-aliyun-content-moderation"; />
+</head>
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
 ## Description
 
-The `ai-aliyun-content-moderation` plugin integrates with Aliyun's content 
moderation service to check both request and response content for inappropriate 
material when working with LLMs. It supports both real-time streaming checks 
and final packet moderation.
-
-This plugin must be used in routes that utilize the ai-proxy or ai-proxy-multi 
plugins.
-
-## Plugin Attributes
-
-| **Field**                   | **Required** | **Type**  | **Description**     
                                                                                
                                                                        |
-| ---------------------------- | ------------ | --------- | 
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 |
-| endpoint                     | Yes          | String    | Aliyun service 
endpoint URL                                                                    
                                                                             |
-| region_id                    | Yes          | String    | Aliyun region 
identifier                                                                      
                                                                              |
-| access_key_id                | Yes          | String    | Aliyun access key 
ID                                                                              
                                                                          |
-| access_key_secret            | Yes          | String    | Aliyun access key 
secret                                                                          
                                                                          |
-| check_request                | No           | Boolean   | Enable request 
content moderation. Default: `true`                                             
                                                                             |
-| check_response               | No           | Boolean   | Enable response 
content moderation. Default: `false`                                            
                                                                            |
-| stream_check_mode            | No           | String    | Streaming 
moderation mode. Default: `"final_packet"`. Valid values: `["realtime", 
"final_packet"]`                                                                
           |
-| stream_check_cache_size      | No           | Integer   | Max characters per 
moderation batch in realtime mode. Default: `128`. Must be `>= 1`.              
                                                                          |
-| stream_check_interval        | No           | Number    | Seconds between 
batch checks in realtime mode. Default: `3`. Must be `>= 0.1`.                  
                                                                            |
-| request_check_service        | No           | String    | Aliyun service for 
request moderation. Default: `"llm_query_moderation"`                           
                                                                         |
-| request_check_length_limit   | No           | Number    | Max characters per 
request moderation chunk. Default: `2000`.                                      
                                                                         |
-| response_check_service       | No           | String    | Aliyun service for 
response moderation. Default: `"llm_response_moderation"`                       
                                                                        |
-| response_check_length_limit  | No           | Number    | Max characters per 
response moderation chunk. Default: `5000`.                                     
                                                                         |
-| risk_level_bar               | No           | String    | Threshold for 
content rejection. Default: `"high"`. Valid values: `["none", "low", "medium", 
"high", "max"]`                                                                |
-| deny_code                    | No           | Number    | HTTP status code 
for rejected content. Default: `200`.                                           
                                                                           |
-| deny_message                 | No           | String    | Custom message for 
rejected content. Default: `-`.                                                 
                                                                          |
-| timeout                      | No           | Integer   | Request timeout in 
milliseconds. Default: `10000`. Must be `>= 1`.                                 
                                                                         |
-| ssl_verify                   | No           | Boolean   | Enable SSL 
certificate verification. Default: `true`.                                      
                                                                                
 |
-
-## Example usage
-
-First initialise these shell variables:
+The `ai-aliyun-content-moderation` Plugin integrates with [Aliyun 
Machine-Assisted Moderation 
Plus](https://help.aliyun.com/document_detail/2671445.html) to check request 
and response content for risk level when proxying to LLMs, such as profanity, 
hate speech, insult, harassment, violence, and more, rejecting requests if the 
evaluated outcome exceeds the configured threshold.
+
+Please ensure that the `access_key_secret` is correctly configured in the 
Plugin. If misconfigured, all requests will bypass the Plugin to be directly 
forwarded to the LLM Upstream, and you will see a `Specified signature is not 
matched with our calculation` error in the gateway's error log from the Plugin.

Review Comment:
   Fixed — softened the wording to say the moderation check fails and the 
request may still be forwarded upstream, rather than implying it is an 
intentional bypass mode.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to