cortex-classify-tutorial

Classify customer reviews into categories using Snowflake Cortex CLASSIFY_TEXT in Python and SQL.

4|8|Updated Feb 19, 2026
One-click install
npx skills add https://github.com/Snowflake-Labs/sfguides --skill cortex-classify-tutorial
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cortex-classify-tutorial
Source: https://github.com/Snowflake-Labs/sfguides/tree/main/cortex-classify-tutorial
Command: npx skills add https://github.com/Snowflake-Labs/sfguides --skill cortex-classify-tutorial

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This tutorial skill removes the friction of turning unstructured customer feedback into actionable recommendation labels by teaching users how to use Snowflake Cortex CLASSIFY_TEXT in both Python (Snowpark) and SQL to produce label and confidence outputs.

Core Features & Use Cases

  • Step-by-step instructor: Guided lessons that explain concepts before executing code and pause for confirmation.
  • Python and SQL examples: Demonstrates single-string classification, DataFrame column classification, and SQL-based classification and views.
  • Practical use case: Classify food truck customer reviews into categories like Likely, Unlikely, and Unsure and analyze distribution for monitoring and routing.
  • Robust guidance: Includes task description best practices, category design guidance, troubleshooting, and verification queries.

Quick Start

Ask the agent to "Teach me how to classify customer reviews into Likely, Unlikely, and Unsure using Snowflake Cortex in Python and SQL."

Frequently Asked Questions about cortex-classify-tutorial

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I classify text in Snowflake using Python and SQL?

Snowflake Cortex CLASSIFY_TEXT classifies unstructured text into discrete categories using Snowpark Python DataFrames or SQL queries. It processes single strings or batch columns and outputs JSON variant labels with confidence scores.

How do I classify customer reviews into categories using Snowpark Python?

You classify customer reviews in Snowpark Python by applying CLASSIFY_TEXT to a DataFrame column. Define a task description and category array, then execute the operation to generate label and confidence outputs for each review.

Do I need a specific Snowflake account to use Cortex text classification?

Yes, you need a Snowflake account with Cortex AI enabled to use the CLASSIFY_TEXT function. This environment provides the necessary infrastructure to run text classification tasks directly within your data warehouse.

What is the best way to design categories for text classification?

The best way to design categories for text classification is to define clear, discrete labels that match your routing or monitoring goals. Provide a descriptive task description and a category array so the model can accurately assign labels and confidence values.

Can I create a SQL view with classified text labels in Snowflake?

Yes, you can create a SQL view with classified text labels by embedding the CLASSIFY_TEXT function in your view definition. This allows continuous classification of new unstructured text data as it enters your tables.

Why does my Snowflake Cortex classification return low confidence scores?

Low confidence scores in Cortex classification often occur when the task description is vague or the category array lacks distinct labels. Refine your category design and ensure the task description accurately reflects the text input.