跳到主要内容

LLM_CLASSIFY

描述

用于将文本分类到指定的标签集合中

语法

LLM_CLASSIFY([<resource_name>], <text>, <labels>)

参数

参数说明
<resource_name>指定的资源名称, 可空
<text>需要分类的文本
<labels>分类标签数组

返回值

返回文本最匹配的单个标签字符串

当输入有值为 NULL 时返回 NULL

结果为大模型生成,所以返回内容并不固定

示例

SET default_llm_resource = 'resource_name';
SELECT LLM_CLASSIFY('Apache Doris is a databases system.', ['useage', 'introduce']) AS Result;
+-----------+
| Result |
+-----------+
| introduce |
+-----------+
SELECT LLM_CLASSIFY('resource_name', 'Apache Doris is developing rapidly.', ['science', 'sport']) AS Result;
+---------+
| Result |
+---------+
| science |
+---------+