Snowflake Solutions Expertise and
Community Trusted By

Enter Your Email Address Here To Join Our Snowflake Solutions Community For Free

Snowflake Solutions Community

How do you use Python on Snowflake Cortex?

299 viewsSnowflake Cortex

How do you use Python on Snowflake Cortex?

Daniel Steinhold Asked question April 3, 2024

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].

  • 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].

  • 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

Maximize Your Data Potential With ITS

Feedback on Q&A