Skip to main content

LLM_CLASSIFY

Description​

Used to classify text into a specified set of labels.

Syntax​

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

Parameters​

ParameterDescription
<resource_name>The specified resource name, optional
<text>The text to be classified
<labels>Array of classification labels

Return Value​

Returns the single label that best matches the text.

If any input is NULL, returns NULL.

The result is generated by a large language model, so the output may vary.

Examples​

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 |
+---------+