用於掩蓋(mask)文本中與指定標籤相關的敏感資訊。
文法
AI_MASK([<resource_name>], <text>, <labels>)
參數
|
參數 |
說明 |
|
|
指定的資源名稱 |
|
|
包含可能敏感資訊的文本 |
|
|
需要掩蓋的資訊標籤數組,例如 |
傳回值
-
返回掩蓋了敏感資訊的文本,被掩蓋的部分用 "[MASKED]" 替代。
-
當輸入有值為 NULL 時返回 NULL。
-
結果為大模型產生,所以返回內容並不固定。
樣本
SET default_ai_resource = 'resource_name';
SELECT AI_MASK('Wccccat is a 20-year-old SelectDB community contributor.', ['name', 'age']) AS Result;
+-----------------------------------------------------+
| Result |
+-----------------------------------------------------+
| [MASKED] is a [MASKED] SelectDB community contributor. |
+-----------------------------------------------------+
SELECT AI_MASK('resource_name', 'My email is rarity@example.com and my phone is 123-456-7890',
['email', 'phone_num']) AS RESULT
+-----------------------------------------------+
| RESULT |
+-----------------------------------------------+
| My email is [MASKED] and my phone is [MASKED] |
+-----------------------------------------------+