Operator: AICLASSIFY
Description
The AICLASSIFY operator is a semantic classifier that assigns each row to one of a provided set of class labels. It specifies a column whose content is classified. This column must be of SQL type TEXT, and can contain multimodal (text-encoded) content such as images or audio data, in addition to pure text.
Syntax
To integrate the AI classifier in an SQL query, use the syntax:
AICLASSIFY(<column>, '<label_1>', '<label_2>'[, ...])
The semantics of the parameters are as follows:
<column>: SQL column (TEXT) containing text, images, or audio data.<label_1>,<label_2>, ...: class labels (at least two).
The operator returns one TEXT class label per row. Output is one of the provided labels whenever classification succeeds. If output cannot be mapped to a valid class, it returns "Unable to classify".
Example
The following query classifies car images in the cars_images table into one of three labels based on the image in the content column:
SELECT filename,
AICLASSIFY(content, 'red car', 'black car', 'other') AS class_label
FROM cars_images;