Model / text · All operations
Ask a model about a whole column
A variant of Ask a language model
Send the values of many rows to a language model in one prompt and get one answer back.
Status
- In arcform
Not built yet
arcform does not do this yet. Its place on the roadmap
What other tools call it
Meridian's classification; an independent blind rating agreed on 95.7% of 324 rows (variant, version 3).
VisiData (2)
llm-analyze-columnread 2026-09-23(experimental) Send current column of all rows to an LLM with a query
llm-analyze-selectedread 2026-09-23(experimental) Send current column of selected rows to an LLM with a query
Background
In Snowflake, the AI_AGG function reduces a column of text data using a natural language instruction.[1] Flock, a DuckDB extension, has an llm_reduce aggregate that combines multiple rows into a single output using a language model.[2]
When to use it
In Snowflake, AI_AGG can be used with GROUP BY to return one answer for each group, such as a summary of the reviews of each restaurant.[1] Reach for it when the question is about the column as a whole, such as the most common complaint or a summary of every comment, rather than about each value. (Meridian's view)
Snowflake's AI_AGG may indicate that the data does not contain the answer when the instruction does not clearly say how to aggregate the data, or when the data lacks the information the instruction needs.[1] The context window of a large language model (LLM) is the maximum number of tokens the model can use at one time when generating an output.[3] Information outside an LLM's context window is not directly available to the model.[3] A larger context window does not necessarily mean that a model can use the whole context equally well, an effect sometimes called context rot.[3] In the study Lost in the Middle, by Liu and colleagues, performance on long-context tasks was often worse when the relevant information appeared in the middle of the input rather than near its beginning or end.[3]
A single answer about many rows is a reading of the column, not a count of it: where the answer is a number, such as how many rows mention late delivery, compute it in SQL and ask the model only for the words. (Meridian's view)
The method
Snowflake's AI_AGG takes two arguments: an expression holding the text to aggregate and a string with a natural language instruction for the aggregation.[1] In Snowflake, several columns can be passed to AI_AGG by joining them into one string with CONCAT or the || operator.[1] In the DuckDB ai extension, the ai_summarize_agg aggregate summarises all text values in a group.[4]
Compared with the alternatives
Unlike Snowflake's COMPLETE and AI_SUMMARIZE functions, AI_AGG supports datasets larger than the maximum language model context window.[1]
Sources
- [1]AI_AGG | Snowflake Documentationdocumentation
- [2]flock – DuckDB Community Extensionsdocumentation
- [3]Context window - Wikipediasecondary source
- [4]ai – DuckDB Community Extensionsdocumentation