Operator: AISCORE
Description
The AISCORE operator is a semantic scoring function that assigns a numeric score to each row based on a natural-language criterion. It specifies a column to which the criterion is applied. 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 score in an SQL query, use the syntax:
AISCORE(<column>, <min_score>, <max_score>, '<criterion>')
The semantics of the parameters are as follows:
<column>: SQL column (TEXT) containing text, images, or audio data.<min_score>: numeric lower scoring bound.<max_score>: numeric upper scoring bound.<criterion>: text describing the scoring criterion in natural language.
The operator returns one FLOAT score per input row. Typical usage expects scores between <min_score> and <max_score>. If output cannot be parsed as a number, it returns <min_score> - 1.0.
Example
The following query scores movie reviews in the text column for positivity on a scale from 1 to 10:
SELECT text,
AISCORE(text, 1, 10, 'positivity') AS positivity_score
FROM movie_reviews
ORDER BY positivity_score DESC;