Loading...
Loading...
Interactive tutorial teaching Snowflake Cortex CLASSIFY_TEXT for categorizing unstructured text. Guide users through classifying customer reviews using Python and SQL. Use when user wants to learn text classification, Cortex LLM functions, or analyze unstructured feedback data.
npx skill4agent add snowflake-labs/sfguides cortex-classify-tutorial1. "Now we'll use cortex.classify_text to determine if this customer would recommend the food truck. It takes the review text and a list of categories."
2. [Show the code in a code block]
3. "Ready to run this?"
4. [Wait for user confirmation]
5. [Execute after they confirm]
6. [Explain the results]-- Check if SNOWFLAKE_LEARNING environment exists
SHOW ROLES LIKE 'SNOWFLAKE_LEARNING_ROLE';
SHOW WAREHOUSES LIKE 'SNOWFLAKE_LEARNING_WH';
SHOW DATABASES LIKE 'SNOWFLAKE_LEARNING_DB';USE ROLE SNOWFLAKE_LEARNING_ROLE;
USE DATABASE SNOWFLAKE_LEARNING_DB;
USE WAREHOUSE SNOWFLAKE_LEARNING_WH;USE ROLE ACCOUNTADMIN; -- or user's current role with appropriate privileges
USE DATABASE <user's database>;
USE WAREHOUSE COMPUTE_WH; -- or user's warehouseweb_fetchhttps://docs.snowflake.com/en/sql-reference/functions/classify_text-snowflake-cortex"Tasty Bytes is a global food truck network. They collect customer reviews and want to understand if customers would recommend their trucks. We'll use AI to classify each review as 'Likely', 'Unlikely', or 'Unsure' to recommend."
references/LESSONS.md| Lesson | Topic | What They'll Learn |
|---|---|---|
| 1 | Setup & Data | Load truck reviews, preview the data |
| 2 | Classify Single String | Use Python cortex.classify_text on one review |
| 3 | Classify DataFrame | Add classification column to entire dataset |
| 4 | Classify in SQL | Use SNOWFLAKE.CORTEX.CLASSIFY_TEXT directly |
references/CORTEX_CLASSIFY_DEEP_DIVE.mdreferences/TASK_DESCRIPTIONS.mdreferences/CATEGORIES_GUIDE.mdreferences/PYTHON_VS_SQL.mdreferences/TROUBLESHOOTING.mdreferences/FAQ.md-- Show classified results
SELECT REVIEW_ID, REVIEW, RECOMMEND
FROM classified_reviews
LIMIT 10;
-- Show distribution of recommendations
SELECT RECOMMEND, COUNT(*) as count
FROM classified_reviews
GROUP BY RECOMMEND;["Positive", "Negative", "Neutral"]["Good", "Great", "Excellent"]references/LESSONS.mdreferences/CORTEX_CLASSIFY_DEEP_DIVE.mdreferences/TASK_DESCRIPTIONS.mdreferences/CATEGORIES_GUIDE.mdreferences/PYTHON_VS_SQL.mdreferences/TROUBLESHOOTING.mdreferences/FAQ.md