Snowflake Cortex 与 Notebooks 简介

Snowflake 生成式 AI 入门

James Cha-Earley

Senior Developer Advocate, Snowflake

认识您的讲师!

 

$$

James Cha-Earley

  • Snowflake 高级开发者倡导者

 

讲师照片

Snowflake 生成式 AI 入门

Snowflake Cortex

Snowflake Cortex AI

  • 触手可用的生产级 AI
1 图片来源:https://www.snowflake.com/en/product/features/cortex/
Snowflake 生成式 AI 入门

Cortex AI

$$

  • SQL、Python 与 Notebook 原生集成

$$

  • 在 Snowflake 内从实验到生产

$$

  • 内置治理、策略与可观测性

Snowflake 标志图标

Snowflake 生成式 AI 入门

课程数据

课程数据查询显示前 10 行——date、rating、description、hotel_name、city、country、language

Snowflake 生成式 AI 入门

模板代码

Notebook 含模板 Python 与 SQL 代码

Snowflake 生成式 AI 入门

查询数据

课程数据说明:列包括 date、rating、description、hotel_name、city、country、language 及其数据类型

Snowflake 生成式 AI 入门

Python 变量注入

  • 在 SQL 查询中创建用于替换的 Python 变量

创建名为 target_location 的 Python 变量,赋值为 Cancun

Snowflake 生成式 AI 入门

Python 变量注入

将 Python 变量注入 SQL 查询

Snowflake 生成式 AI 入门

设置 Cortex

设置 Cortex

Snowflake 生成式 AI 入门

文本摘要

from snowflake.cortex import summarize

review = """ I was very impressed with this hotel, especially the service. They make you feel special and you feel like everything is possible. Special shout out to the Kidz Club staff. Our daughter is very picky and for the first time, she begged to go back there. They have a great supervision and they let the kids do fun activities such as cooking classes and crafting. The food was really good (buffet offered a different choice everyday). The all-inclusive program is really worth the price, and the beach was beautiful! """
Snowflake 生成式 AI 入门

文本摘要

result = summarize(text=review)

print(result)

$$

The hotel delivered excellent service with outstanding Kidz Club staff who engaged 
even picky children through supervised activities. The daily buffet offered good
variety, and the all-inclusive program plus beautiful beach provided great value.
Snowflake 生成式 AI 入门

在 SQL 单元中使用 Cortex

在 SQL 单元中运行 summarize

$$

  • 在 SQL 单元中运行无需导入

$$

  • 串联多个函数请使用 Python 单元
Snowflake 生成式 AI 入门

¡Vamos a practicar!

Snowflake 生成式 AI 入门

Preparing Video For Download...