根据给定条件对文本进行过滤。
语法
AI_FILTER([<resource_name>], <text>)
参数
|
参数 |
说明 |
|
|
指定的资源名称,可空 |
|
|
判断的信息 |
返回值
-
返回一个布尔值。
-
当输入有值为 NULL 时返回 NULL。
-
结果为大模型生成,所以返回内容并不固定。
示例
假设我有如下表,代表某家快递公司收到的评论:
CREATE TABLE user_comments (
id INT,
comment VARCHAR(500)
) DUPLICATE KEY(id)
DISTRIBUTED BY HASH(id) BUCKETS 10
PROPERTIES (
"replication_num" = "1"
);
当我想查询其中的好评时可以:
SELECT id, comment FROM user_comments
WHERE AI_FILTER('resource_name', CONCAT('This is a positive comment: ', comment));
结果大致如下:
+------+--------------------------------------------+
| id | comment |
+------+--------------------------------------------+
| 1 | Absolutely fantastic, highly recommend it. |
| 3 | This product is amazing and I love it. |
+------+--------------------------------------------+