Exploring Snowflake Cortex

Snowflake Cortex AI Functions: Translate, Summarize, Sentiment and Classify in SQL

Celestinfo Software Solutions Pvt. Ltd. • Oct 24, 2024

Last updated: October 2026

Quick answer: Snowflake Cortex AI Functions run language-model tasks inside SQL. The current functions for the tasks in this article are AI_TRANSLATE, AI_SUMMARIZE (in preview), AI_SENTIMENT and AI_CLASSIFY. The legacy SNOWFLAKE.CORTEX.TRANSLATE, SUMMARIZE, SENTIMENT and CLASSIFY_TEXT functions are due to be deprecated by the end of 2026, and moving off them is more than a rename: AI_SENTIMENT returns labels instead of a numeric score, and AI_CLASSIFY returns an array of labels.

Introduction

Snowflake Cortex brings language-model tasks into SQL, so data teams can translate, summarise, score and classify text without moving it out of Snowflake or running their own models. This article was first written in 2024 around the original SNOWFLAKE.CORTEX functions. Snowflake has since replaced them with a new family of AI functions, so this version covers the current functions, what changes when you migrate, and two small worked examples.

What changed since 2024

Snowflake now documents these capabilities as Cortex AI Functions, with names that start with AI_. The reference pages for the original functions, TRANSLATE, SUMMARIZE, SENTIMENT and CLASSIFY_TEXT in the SNOWFLAKE.CORTEX schema, say each legacy function will be deprecated by the end of 2026, and they point to AI_TRANSLATE, AI_SUMMARIZE, AI_SENTIMENT and AI_CLASSIFY.


The timing matters. Snowflake's 2026_08 behavior change bundle removes the legacy functions from accounts that did not use them between 9 July and 6 October 2026, and calls to them are not redirected to the new functions. If you have code that still calls SNOWFLAKE.CORTEX.SENTIMENT or CLASSIFY_TEXT, it needs to change, and as the sections below show, the output shapes are different.


Forecasting and anomaly detection, which earlier descriptions grouped with Cortex, are documented separately as Snowflake ML Functions.


Translate with AI_TRANSLATE

AI_TRANSLATE takes the text, a source language code and a target language code. If the source code is an empty string, the source language is detected automatically. It supports 23 languages: Arabic, Chinese, Croatian, Czech, Dutch, English, Finnish, French, German, Greek, Hebrew, Hindi, Italian, Japanese, Korean, Norwegian, Polish, Portuguese, Romanian, Russian, Spanish, Swedish and Turkish. The legacy TRANSLATE function supported 14, not the hundred or so an earlier version of this article suggested.


AI_TRANSLATE examples
-- Explicit source and target languages (ISO 639-1 codes)
SELECT AI_TRANSLATE('Welcome to my blog', 'en', 'hi');

-- Detect the source language automatically
SELECT AI_TRANSLATE('Voy a likear tus fotos en Insta.', '', 'en');

-- Translate a column
SELECT review_id, AI_TRANSLATE(review_text, '', 'en') AS review_en
FROM product_reviews;

Summarise with AI_SUMMARIZE

AI_SUMMARIZE produces a short summary of a piece of text, and it can also summarise a staged file passed with TO_FILE. It was still a preview feature in October 2026, available to all accounts. Typical uses are condensing support tickets, call transcripts or long reviews so that someone can scan them quickly.


AI_SUMMARIZE examples (preview)
SELECT ticket_id, AI_SUMMARIZE(ticket_body) AS summary
FROM support_tickets
WHERE created_at >= DATEADD(day, -7, CURRENT_DATE());

-- Summarise a document on a stage
SELECT AI_SUMMARIZE(TO_FILE('@my_docs', 'meeting_notes.pdf')) AS summary;

Sentiment with AI_SENTIMENT

This is the change most likely to break existing code. The legacy SENTIMENT function returned a number between -1 and 1. AI_SENTIMENT returns an object with a categories array, where each entry has a name and a sentiment label: positive, negative, neutral, mixed or unknown. The overall entry is always included, and you can ask for up to ten aspects of your own, each up to 30 characters long, such as price or staff.


AI_SENTIMENT: overall label and aspect labels
-- Overall sentiment as a single label
SELECT r.review_id, f.value:sentiment::STRING AS overall_sentiment
FROM product_reviews r,
     LATERAL FLATTEN(input => AI_SENTIMENT(r.review_text):categories) f
WHERE f.value:name::STRING = 'overall';

-- Sentiment about specific aspects of the review
SELECT review_id, AI_SENTIMENT(review_text, ['Price', 'Staff', 'Delivery']) AS aspects
FROM product_reviews;

Code that stored the old score in a FLOAT column and banded it with ranges such as BETWEEN -1 AND -0.1 cannot be migrated by renaming the function. Store the label instead. If you genuinely need a numeric score, Snowflake suggests using AI_COMPLETE with structured output.


Classify with AI_CLASSIFY

AI_CLASSIFY assigns text to categories you supply. It needs at least two distinct categories, and Snowflake notes that more than about twenty can reduce accuracy. An optional configuration object can add a task description of up to 50 words, switch to multi-label output with 'output_mode': 'multi', or provide few-shot examples. The result is an object with a labels array, so code that read ['label'] from CLASSIFY_TEXT should read :labels[0] instead.


AI_CLASSIFY examples
-- Single label
SELECT AI_CLASSIFY('One day I will see the world', ['travel', 'cooking']):labels[0]::STRING AS label;

-- With a task description, applied to a column
SELECT ticket_id,
       AI_CLASSIFY(
           ticket_body,
           ['technical issue', 'billing', 'general inquiry'],
           {'task_description': 'Classify the main reason the customer contacted support'}
       ):labels[0]::STRING AS ticket_type
FROM support_tickets;

Trying to get this past a proof of concept? Enterprise AI work rarely stalls on the model. It stalls on what sits underneath: retrieval that returns the wrong chunk, permissions that leak across tenants, and no agreed way to tell a good answer from a bad one. We build the pipeline, the access rules and the evaluation harness so the thing can actually go live.

Book an AI readiness call AI and ML services

Worked example: sentiment of social media comments

A small project shows how these functions fit together. We took a dataset of social media comments, loaded it into a table, and labelled each comment's overall sentiment.


Load the comments and label their sentiment
CREATE OR REPLACE TABLE social_comments (
    comment_id   INTEGER,
    comment_text VARCHAR,
    posted_at    TIMESTAMP_NTZ
);

COPY INTO social_comments
  FROM @comments_stage
  FILE_FORMAT = (TYPE = CSV SKIP_HEADER = 1 FIELD_OPTIONALLY_ENCLOSED_BY = '"');

CREATE OR REPLACE TABLE social_comment_sentiment AS
SELECT c.comment_id, c.comment_text, f.value:sentiment::STRING AS sentiment
FROM social_comments c,
     LATERAL FLATTEN(input => AI_SENTIMENT(c.comment_text):categories) f
WHERE f.value:name::STRING = 'overall';

-- Share of each sentiment
SELECT sentiment, COUNT(*) AS comments,
       ROUND(100 * RATIO_TO_REPORT(COUNT(*)) OVER (), 1) AS pct
FROM social_comment_sentiment
GROUP BY sentiment
ORDER BY comments DESC;

The proportion of positive, negative and neutral comments gives a quick read on public sentiment towards a product or topic. When we first ran this analysis with the original SENTIMENT function, it handled clear opinions well and occasionally struggled with sarcasm. Check a sample of AI_SENTIMENT labels on your own data in the same way before using them to make decisions about individual customers.


Worked example: classifying movie reviews

The second project used a dataset of IMDB movie reviews that already carried a positive or negative label, which makes it possible to measure how often the classifier agrees.


Classify reviews and check agreement with the original labels
CREATE OR REPLACE TABLE imdb_reviews (
    review_id   INTEGER,
    review_text VARCHAR,
    label       VARCHAR   -- 'positive' or 'negative' in the source data
);

CREATE OR REPLACE TABLE imdb_review_predictions AS
SELECT review_id,
       label,
       AI_CLASSIFY(
           review_text,
           ['positive', 'negative'],
           {'task_description': 'Classify the overall opinion expressed in this movie review'}
       ):labels[0]::STRING AS predicted
FROM imdb_reviews;

SELECT ROUND(100 * AVG(IFF(predicted = label, 1, 0)), 1) AS agreement_pct,
       COUNT(*) AS reviews
FROM imdb_review_predictions;

When we ran this project with the original CLASSIFY_TEXT function, classification was most reliable when a review clearly expressed one opinion. Very short reviews, and reviews that praised some aspects while criticising others, were where the predicted label most often disagreed with the original one. A task description helped, and for borderline cases 'output_mode': 'multi' or a third category such as mixed can be more honest than forcing a single label.


Key takeaways


Conclusion

Cortex AI Functions make text analysis a SQL task, which is their main attraction for data teams. If you built on the 2024 functions, plan the migration now, test the new output shapes on real data, and change any downstream columns that expected a numeric sentiment score. For the wider set of AI functions, including AI_COMPLETE, AI_FILTER and AI_AGG, see our article on Snowflake Cortex AI functions in SQL queries.


Frequently Asked Questions

Q: What are Snowflake Cortex AI Functions?

They are SQL functions that run language-model tasks inside Snowflake, such as AI_TRANSLATE, AI_SUMMARIZE, AI_SENTIMENT, AI_CLASSIFY and AI_COMPLETE. They replace the original SNOWFLAKE.CORTEX functions, which are due to be deprecated by the end of 2026.

Q: Is SNOWFLAKE.CORTEX.SENTIMENT deprecated?

Yes. Snowflake's reference page says the legacy function will be deprecated by the end of 2026 and points to AI_SENTIMENT. AI_SENTIMENT returns labels (positive, negative, neutral, mixed or unknown) per category instead of a score from -1 to 1, so code that used the score needs to change.

Q: How many languages does AI_TRANSLATE support?

23: Arabic, Chinese, Croatian, Czech, Dutch, English, Finnish, French, German, Greek, Hebrew, Hindi, Italian, Japanese, Korean, Norwegian, Polish, Portuguese, Romanian, Russian, Spanish, Swedish and Turkish. An empty source language code turns on automatic detection.

Q: How do I read the result of AI_CLASSIFY?

AI_CLASSIFY returns an object with a labels array. For single-label classification, read the first element, for example AI_CLASSIFY(text, ['a', 'b']):labels[0]::STRING.

Pranay Vatsal, Founder & CEO

Pranay Vatsal is the Founder & CEO of CelestInfo with deep expertise in Snowflake, data architecture, and building production-grade data systems for global enterprises.

Related Articles

Burning Questions
About CelestInfo

Simple answers to make things clear.

Our AI insights are continuously trained on large datasets and validated by experts to ensure high accuracy.

Absolutely. CelestInfo supports integration with a wide range of industry-standard software and tools.

We implement enterprise-grade encryption, access controls, and regular audits to ensure your data is safe.

Insights are updated in real-time as new data becomes available.

We offer 24/7 support via chat, email, and dedicated account managers.

Still have questions?

Get Assistance

Ready? Let's Talk!

Get expert insights and answers tailored to your business requirements and transformation.

Get Assistance