Domain: Snowflake Features & Architecture
· 912 words · 10 min read

Snowflake Cortex AI

Overview

Snowflake Cortex AI is a suite of fully managed machine learning and AI features built directly into the Snowflake Data Cloud. It democratizes AI by allowing users to leverage industry-leading Large Language Models (LLMs) and ML algorithms using standard SQL or Python, without needing to move data or manage complex AI infrastructure. For the SnowPro Core exam, you must understand the categories of functions available, the newer AI services (Search, Analyst, Agents), and the underlying security and compute models.

Key Concepts

1. LLM Functions (Generative AI)

Cortex provides access to industry-leading models (like Meta Llama, Mistral, Snowflake Arctic) through simple SQL functions. These functions process unstructured text data.

| Function | Description | Example Use Case |

| :--- | :--- | :--- |

| SNOWFLAKE.CORTEX.COMPLETE (or AI_COMPLETE) | Generates text based on a prompt. | Drafting emails, answering questions. |

| SNOWFLAKE.CORTEX.CLASSIFY (or AI_CLASSIFY) | Categorizes text into predefined labels. | Categorizing support tickets (e.g., 'Billing', 'Tech'). |

| SNOWFLAKE.CORTEX.EXTRACT_ANSWER | Extracts a specific answer from a document based on a question. | Finding the contract expiration date in a legal PDF. |

| SNOWFLAKE.CORTEX.SENTIMENT | Returns a score between -1 and 1 indicating sentiment. | Analyzing customer product reviews. |

| SNOWFLAKE.CORTEX.TRANSLATE | Translates text between supported languages. | Localizing a product catalog. |

| SNOWFLAKE.CORTEX.SUMMARIZE | Generates a concise summary of a larger text block. | Summarizing long call transcripts. |

| SNOWFLAKE.CORTEX.EMBED_TEXT_768 | Generates vector embeddings for text. | Creating vectors for a vector database / similarity search. |

*(Note: Snowflake occasionally aliases these as AI_COMPLETE, AI_CLASSIFY, etc. Understand both naming conventions).*

2. Machine Learning (ML) Functions

These functions are designed for structured, time-series, or tabular data.

3. Cortex Advanced AI Services

Snowflake has expanded Cortex into managed AI services to build full AI applications:

How It Works

Compute Model

Security Model

SQL Examples


-- 1. Text Summarization
SELECT SNOWFLAKE.CORTEX.SUMMARIZE(email_body) AS summary
FROM customer_emails;

-- 2. Sentiment Analysis
SELECT 
    review_text,
    SNOWFLAKE.CORTEX.SENTIMENT(review_text) AS sentiment_score
FROM product_reviews
WHERE sentiment_score < -0.5; -- Find strongly negative reviews

-- 3. Text Completion (using a specific model)
SELECT SNOWFLAKE.CORTEX.COMPLETE(
    'mistral-large', 
    'Write a polite rejection letter for a software engineering candidate.'
);

-- 4. Creating a Cortex Search Service (requires a warehouse)
CREATE CORTEX SEARCH SERVICE my_kb_search
  ON document_chunk
  ATTRIBUTES category, author
  WAREHOUSE = compute_wh
  TARGET_LAG = '1 hour'
  AS (
    SELECT document_chunk, category, author 
    FROM parsed_knowledge_base
  );

Exam Tips

⚠️ Data Privacy: A very common exam scenario involves a company wanting to use LLMs but with a strict policy against data leaving their cloud perimeter. Snowflake Cortex AI is the correct answer.

⚠️ Compute Type: Remember that LLM functions (Complete, Summarize, Sentiment) are generally serverless, whereas creating a Search Service or training an ML model requires a virtual warehouse.

⚠️ Search vs. Analyst: Know the difference: Cortex Search is for finding information (text/RAG). Cortex Analyst is for querying structured data (Natural Language to SQL).

⚠️ Roles: To use these functions, a user must be granted the CORTEX_USER role via the SNOWFLAKE database.

Key Takeaways