Snowflake Cortex AI Functions (including LLM functions)¶
Use Cortex AI Functions in Snowflake to run unstructured analytics on text and images with industry-leading LLMs from OpenAI, Anthropic, Meta, Mistral AI, and DeepSeek. AI Functions support use cases such as:
- Extracting entities to enrich metadata and streamline validation
- Aggregating insights across customer tickets
- Filtering and classifying content by natural language
- Sentiment and aspect-based analysis for service improvement
- Translating and localizing multilingual content
- Parsing documents for analytics and RAG pipelines
All the LLMs that Snowflake provides access to via our Snowflake AI Features are deployed within the Snowflake Service perimeter.
Available functions¶
Snowflake Cortex features are provided as SQL functions and are also available in Python. To call any of these functions, your role needs the USE AI FUNCTIONS account-level privilege and one of the CORTEX_USER or AI_FUNCTIONS_USER database roles. For details, see Privileges and model access for Cortex AI Functions.
Cortex AI Functions can be grouped into the following categories:
Cortex AI functions¶
These task-specific functions are purpose-built managed functions that automate routine tasks, like simple summaries and quick translations, that don’t require any customization.
- AI_COMPLETE: Generates a completion for a given text string or image using a selected LLM. Use this function for most generative AI tasks.
- AI_CLASSIFY: Classifies text or images into user-defined categories.
- AI_FILTER: Returns True or False for a given text or image input, allowing you to filter results in SELECT, WHERE, or JOIN … ON clauses.
- AI_AGG: Aggregates a text column and returns insights across multiple rows based on a user-defined prompt. This function isn’t subject to context window limitations.
- AI_EMBED: Generates an embedding vector for a text or image input, which can be used for similarity search, clustering, and classification tasks.
- AI_EXTRACT: Extracts information from an input string or file, for example, text, images, and documents. Supports multiple languages.
- AI_SENTIMENT: Extracts sentiment from text.
- AI_SUMMARIZE_AGG: Aggregates a text column and returns a summary across multiple rows. This function isn’t subject to context window limitations.
- AI_SIMILARITY: Calculates the embedding similarity between two inputs.
- AI_TRANSCRIBE: Transcribes audio and video files stored in a stage, extracting text, timestamps, and speaker information.
- AI_PARSE_DOCUMENT: Extracts text (using OCR mode) or text with layout information (using LAYOUT mode) from documents in an internal or external stage. Can also extract images found in a document.
- AI_REDACT: Redact personally identifiable information (PII) from text.
- AI_TRANSLATE: Translates text between supported languages.
- SUMMARIZE (SNOWFLAKE.CORTEX): Returns a summary of the text that you’ve specified.
Helper functions¶
Helper functions are purpose-built managed functions that reduce cases of failures when running other Cortex AI Functions, for example by getting the count of tokens in an input prompt to ensure the call doesn’t exceed a model limit.
- TO_FILE: Creates a reference to a file in an internal or external stage for use with AI_COMPLETE and other functions that accept files.
- AI_COUNT_TOKENS: Given an input text, returns the token count based on the model or Cortex function specified.
- PROMPT: Helps you build prompt objects for use with AI_COMPLETE and other functions.
Performance considerations¶
Cortex AI Functions are optimized for throughput. We recommend using these functions to process numerous inputs such as text from large SQL tables. Batch processing is typically better suited for AI Functions. For more interactive use cases where latency is important, use the REST API. These are available for simple inference (Complete API), embedding (Embed API) and agentic applications (Agents API).
Legal notices¶
The data classification of inputs and outputs are as set forth in the following table.
| Input data classification | Output data classification | Designation |
|---|---|---|
| Usage Data | Customer Data | Generally available functions are Covered AI Features. Preview functions are Preview AI Features. [1] |
For additional information, refer to Snowflake AI and ML.