Used to classify text into a specified set of labels.
AI_CLASSIFY([<resource_name>], <text>, <labels>)
| Parameter | Description |
|---|---|
<resource_name> | The specified resource name, optional |
<text> | The text to be classified |
<labels> | Array of classification labels |
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.
SET default_ai_resource = 'resource_name'; SELECT AI_CLASSIFY('Apache Doris is a databases system.', ['useage', 'introduce']) AS Result;
+-----------+ | Result | +-----------+ | introduce | +-----------+
SELECT AI_CLASSIFY('resource_name', 'Apache Doris is developing rapidly.', ['science', 'sport']) AS Result;
+---------+ | Result | +---------+ | science | +---------+