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 Category | New Function | Description |
|---|---|---|
| LLM Function | TRY_COMPLETE (SNOWFLAKE.CORTEX) | Tries to run the COMPLETE function but returns NULL instead of an error code if unable to run. |
| LLM Function | COUNT_TOKENS (SNOWFLAKE.CORTEX) | Counts the tokens in a given input text based on the model or function specified. |