Snowflake Cortex とノートブック入門

Snowflake による Generative AI 入門

James Cha-Earley

Senior Developer Advocate, Snowflake

講師の紹介

 

$$

James Cha-Earley

  • Snowflake シニア デベロッパーアドボケイト

 

講師写真

Snowflake による Generative AI 入門

Snowflake Cortex

Snowflake Cortex AI

  • すぐ使える本番対応の AI
1 Image source: https://www.snowflake.com/en/product/features/cortex/
Snowflake による Generative AI 入門

Cortex AI

$$

  • SQL、Python、ノートブックにネイティブ統合

$$

  • Snowflake 内で実験から本番へ

$$

  • ガバナンス、ポリシー、可観測性を内蔵

Snowflake ロゴアイコン

Snowflake による Generative AI 入門

コースデータ

コースデータの最初の10行のクエリ—date、rating、description、hotel_name、city、country、language

Snowflake による Generative AI 入門

テンプレートコード

テンプレートの Python と SQL コードを含むノートブック

Snowflake による Generative AI 入門

データのクエリ実行

コースデータの列(date、rating、description、hotel_name、city、country、language)と型の説明

Snowflake による Generative AI 入門

Python 変数のインジェクション

  • SQL クエリに代入する Python 変数を作成

target_location という Python 変数を作成し、Cancun を代入

Snowflake による Generative AI 入門

Python 変数のインジェクション

Python 変数を SQL クエリに注入

Snowflake による Generative AI 入門

Cortex のセットアップ

Cortex のセットアップ

Snowflake による Generative 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 による Generative 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 による Generative AI 入門

SQL セルでの Cortex

SQL セルで summarize を実行

$$

  • SQL セルでは import は不要

$$

  • 複数関数の連結は Python セルで実行
Snowflake による Generative AI 入門

練習してみましょう!

Snowflake による Generative AI 入門

Preparing Video For Download...