A practical guide to using Snowflake's AI_CLASSIFY Cortex function for text classification directly in SQL. Covers single-label and multi-label classification, parsing JSON output with Snowflake's semi-structured data features, improving accuracy with label descriptions and task descriptions, teaching the model with few-shot examples, and building production-ready dynamic category arrays from lookup tables using ARRAY_AGG and CTEs. All examples include runnable SQL with setup scripts.

10m read timeFrom medium.com
Post cover image
Table of contents
What is AI_CLASSIFY?What We’ll CoverSetup1. Single-Label Classification (Simplest Usage)2. Single-Label on a Table Column

Sort: