AI_AGG

functiondeferredAI & ML

docs.snowflake.com ↗

Aggregate functionsString & binary functions

Reduces a column of text data using a natural language instruction. For example, AI_AGG(reviews, 'Describe the most common complaints mentioned in the book reviews') will return a summary of user feedback. Unlike COMPLETE (SNOWFLAKE.CORTEX) and AI_SUMMARIZE, this function supports datasets larger than the maximum language model context window. See also: AI_SUMMARIZE_AGG

Syntax

AI_AGG( <expr>, <instruction> )

Parameters

NameRequiredDescription
exprrequiredThis is an expression that contains text on which an aggregation operation is to be performed, such as restaurant reviews or phone transcripts.
instructionrequiredA string containing a natural language specification of the aggregation to perform, for example “Summarize the reviews” or “Identify all people mentioned and write a short biography for each of them”.

Returns

Returns a string containing the result of the aggregation. The function may indicate that the data you’ve provided doesn’t contain the answer if: - You don’t provide a clear instruction specifying how to aggregate the data - The data doesn’t have the information necessary to complete your instruction

Usage notes

Legal notices

Refer to Snowflake AI and ML for legal notices.

Known gaps

Parts not fully supported, and recorded divergences from Snowflake.