June 17, 2024 — New LLM helper functions - TRY_COMPLETE and COUNT_TOKENS

With this release, we are pleased to announce the availability of two Cortex LLM helper functions, TRY_COMPLETE and COUNT_TOKENS. These functions are purpose-built and managed functions that help to reduce cases of query failures when the number of input tokens exceed a model limit.

For more information, see Snowflake Cortex AI Functions (including LLM functions).

New SQL function

The following functions are now generally available with this release:

Function CategoryNew FunctionDescription
LLM FunctionTRY_COMPLETE (SNOWFLAKE.CORTEX)Tries to run the COMPLETE function but returns NULL instead of an error code if unable to run.
LLM FunctionCOUNT_TOKENS (SNOWFLAKE.CORTEX)Counts the tokens in a given input text based on the model or function specified.