How do you use Python on Snowflake Cortex?

79 viewsSnowflake Cortex
0

How do you use Python on Snowflake Cortex?

Daniel Steinhold Asked question April 3, 2024
0

Here are some things you should know when using Python and some guides.

 

How to use Snowflake Cortex LLM functions in Python:

  • Snowpark ML version required: You need Snowpark ML version 1.1.2 or later to use these functions. Check the instructions for Installing Snowpark ML: [search how to install snowpark ml ON Snowflake docs.snowflake.com].

  • Running outside Snowflake: If your Python script isn't running within Snowflake itself, you'll need to create a Snowpark session first. Find instructions for Connecting to Snowflake: [search how to connect to snowflake ON docs.snowflake.com].

  • Using functions with single values: The provided code example shows how to use different Cortex LLM functions on individual pieces of text. It demonstrates functions like Complete for generating text, ExtractAnswer for finding answers within text, Sentiment for analyzing emotions, Summarize for creating summaries, and Translate for translating languages.

  • Using functions with tables: This section explains how to use Cortex LLM functions on data stored in tables. It requires a Snowpark session and a table with a text column. The example creates a new column containing summaries of the existing text data using the Summarize function.

Daniel Steinhold Changed status to publish April 3, 2024
You are viewing 1 out of 1 answers, click here to view all answers.
Feedback on Q&A