CLASSIFY_TEXT

functiondeferredAI & ML

docs.snowflake.com ↗

String & binary functions

Notice This page is provided for backward compatibility. For new use cases, start with AI_CLASSIFY, which is the canonical surface going forward. This legacy function will be deprecated by the end of 2026. Classifies free-form text into categories that you provide. Available to all accounts in selected regions.

Syntax

supportedpartialnot supportednot scored

SNOWFLAKE.CORTEX.CLASSIFY_TEXT( <input> , <list_of_categories>, [ <options> ] )

Parameters

NameRequiredDescription
inputrequiredString to classify. The input string is case sensitive. You may get different results for the same string that uses different capitalization.
list_of_categoriesrequiredArray that represents the categories. Must contain at least two and at most 100 unique categories. Categories are case sensitive. Categories may be simple strings or SQL objects; all categories must be the same type. Using objects, you can provide a description and examples of each category, providing context that can help improve classification accuracy. It is not required to provide descriptions or examples for each category; you are free to provide a description, examples, both, or neither for each category. label: The name of the category. This key is required. description: A description of the category. Descriptions should be no longer than about 25 words (1-2 sentences) long. This key is optional. examples: An array of examples that are representative of the category. Typically no more than five examples are needed, but there is a limit of 20 examples per category. The number of examples does not need to be the same for every category. This key is optional. Note Descriptions and examples count as input tokens, which increases the cost of the classification operation. Read more in Snowflake Cortex AI functions incur compute cost based on the number of tokens….
optionsoptionalAn object that contains optional configuration (as key/value pairs) for the classification operation. Currently, the only available key is: task_description: A string containing a short explanation of the text classification task. Task descriptions should be no more than about 50 words (3-4 sentences) long.

Returns

An OBJECT value (VARIANT). The object’s label field is a string specifying the category to which the input prompt belongs.

Usage notes

Access control requirements

Users must use a role that has been granted the SNOWFLAKE.CORTEX_USER database role. See Cortex LLM privileges for more information on this privilege.

Known gaps

Parts not fully supported, and recorded divergences from Snowflake.