Snowflake Cortex LLM Functions Explained (with Examples)
Sep 18, 2025
I have been exploring Snowflake Cortex LLM functions, which were recently released. These functions provide us with instant access to leading LLM models from Mistral, Meta, and Google. The best part is that these LLMs are fully hosted and managed by Snowflake, providing performance, scalability, and governance. The data resides inside Snowflake, eliminating the need for any third-party tools, and it is easily accessible via SQL and Python.
In this blog post, I am explaining Snowflake Cortex functions with examples using SQL functions. The available Cortex functions are COMPLETE
SENTIMENTEXTRACT_ANSWER
SUMMARIZE
TRANSLATE
For demonstration purposes, I have utilized the Amazon UK shoes product reviews dataset, which I loaded into Snowflake under the table called REVIEWS
in the database AIPROJECT
and schema dbo
.
The dataset includes PRODUCT_NAME, REVIEW_TITLE, REVIEW_TEXT, and REVIEW_DATE.

TRANSLATE
Translate function translate text from source language to targeted language
Syntax
This below SQL first creates a common table expression (CTE) called TRANSLATE, which selects REVIEW_TITLE and REVIEW_TEXT columns from the REVIEWS table and determines the country based on the content of the REVIEW_DATE column. Then, it selects REVIEW_TEXT and performs translation for reviews from Mexico using the SNOWFLAKE.CORTEX.TRANSLATE function, translating from Spanish ’es’
to English ’en’
. Finally, it filters the results to include only reviews from Mexico (COUNTRY = ‘MEXICO’).
Result

Another example involves converting German text to English by filtering for the country Germany.
Result

To learn more about supported languages for translation and for additional details, please check here.
SUMMARIZE
Summarize function returns a summary of the given English text. Source text to be in English
Syntax
The below script first categorizes reviews based on the country mentioned in the REVIEW_DATE column. Then, it selects REVIEW_TEXT and generates a summary using SNOWFLAKE.CORTEX.SUMMARIZE function, filtering specifically for reviews from the United States and limiting the output to 8 summaries.
Result

For additional details, please check here.
SENTIMENT
The SENTIMENT function provides a sentiment score ranging from -1 to 1 for English-language input text. A score of -1 indicates the most negative sentiment, while a score of 1 signifies the most positive sentiment. Scores around 0 suggest a neutral sentiment.
Syntax
The below SQL first assigns a country based on the REVIEW_DATE using a Common Table Expression (CTE). Then, in the main query, it calculates the sentiment score for each review using the SNOWFLAKE.CORTEX.SENTIMENT function. The sentiment score ranges from -1 to 1, with -1 indicating the most negative sentiment and 1 indicating the most positive sentiment. Based on these scores, it categorizes the sentiment as follows:
‘AVERAGE’ for scores greater than 0 and less than or equal to 0.5,
‘GOOD’ for scores greater than 0.5 and less than or equal to 0.8,
‘EXCEPTIONAL’ for scores greater than 0.8,
‘BAD’ for scores less than 0,
‘NEUTRAL’ for scores equal to 0. Finally, it filters the results to include only reviews from the United States.
Result

For additional details, please check here.
COMPLETE
Given a prompt, COMPLETE function generates a response (completion) using our choice of supported language model. Currently, the function supports the following models. Each models might different cost and quotas.
'mistral-large'
'mixtral-8x7b'
'llama2-70b-chat'
'mistral-7b'
Syntax
Options are used to define the hyperparameters of the model. We can specify parameters such as temperature, top_p, or max_tokens. Temperaturecontrols the randomness of the model’s output. Top-p influences both the randomness and diversity of the language model. Max_tokens determines the maximum number of output tokens in the response; a smaller number will result in truncated responses.
Below SQL categorizes reviews with ‘UNITED STATES’ as the country based on the presence of ‘United States’ in the review date. It then selects the review text from the REVIEWS table and generates a complete message using the SNOWFLAKE.CORTEX.COMPLETE function by giving this prompt Draft a short message that acknowledges the problem, includes an apology, and provides a short recommendation
I did this for only one record and didn’t use options in this example.
Result

Below message was generated by the COMPLETE function by passing our prompt
For more details on Options, please check here.
EXTRACT_ANSWER
The EXTRACT_ANSWER function retrieves an answer to a specified question from a text document. The document can either be a plain-English document or a string representation of semi-structured (JSON) data
Syntax
Below SQL first creates a Common Table Expression (CTE) named EXTRACT to extract relevant data from the REVIEWS table, identifying the country based on the content of REVIEW_DATE. Then, it executes the main query to extract and parse the answer from the review text using Snowflake Cortex’s SNOWFLAKE.CORTEX.EXTRACT_ANSWER function. I am asking this question What product this review talks about?
Finally, it filters the results to include only reviews from the United States and limits the output to one result. It provides an answer in JSON format, so I parse the extracted answer using the PARSE_JSON function, cast it as a string, and store it in a new column called PARSED_ANSWER
Result

For additional details, please check here.
Current Restrictions
Currently, these functions are available only in selected regions, such as AWS US East (N. Virginia), AWS US West (Oregon), AWS Europe (Frankfurt), Azure East US 2 (Virginia), and Azure West Europe (Netherlands)
The models used for these LLM functions have limitations in terms of tokens
To maintain a performance across customers, Snowflake cortex LLM functions are subject to usage quotas.
Users must use a role that has been granted the SNOWFLAKE.CORTEX_USER database role to access the Cortex LLM functions. By default, this database role is granted only to the ACCOUNTADMIN role. The ACCOUNTADMIN role must then grant this role to user roles to allow users access to Cortex LLM functions
For more details on the cost and restrictions, please refer to the official documentation.