liveBook · Manning

Snowflake Cortex LLM function

As explained in Snowflake Data Engineering

A Snowflake Cortex LLM function is a Snowflake-hosted function that invokes a large language model capability such as completion, embedding, extraction, sentiment analysis, summarization, or translation.

A Snowflake Cortex LLM function is a Snowflake-hosted function that invokes managed large language model capabilities from SQL. It can augment stored data with generated or interpreted outputs, such as sentiment scores, summaries, translations, embeddings, extracted answers, and completions. section 7.0 section 7.3

Common functions include:

  • COMPLETE returns a response that completes a prompt. section 7.3
  • EMBED_TEXT_768 returns a vector embedding for text. section 7.3
  • EXTRACT_ANSWER derives an answer from unstructured data; SUMMARIZE, TRANSLATE, and SENTIMENT provide specialized text operations. section 7.3

Classify customer reviews

Grant the required Cortex privilege, select the target database and schema, then apply SENTIMENT to each review. The function returns a floating-point score from −1 to 1; a CASE expression can map score ranges to Negative, Neutral, or Positive labels. section 7.3

How Snowflake Data Engineering covers it

How deep it goes
Defines several functions and demonstrates privilege setup, SQL invocation, scores, and label mapping, but defers broader operational detail.
Examples
Uses bakery customer reviews, direct sentiment calls, score thresholds, and a CUSTOMER_REVIEWS query producing labeled results.
What it assumes
Assumes Snowflake access and a review table, while requiring the SNOWFLAKE.CORTEX_USER database role before invocation.
What you can do after
Apply it via Snowflake SQL to generate language-model outputs and classify stored customer reviews by sentiment.
How it connects
Connects LLM functions with sentiment analysis, embeddings, summarization, translation, information extraction, prompts, and Snowflake SQL.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Snowflake Data Engineering. The section links point to the parts of the book it draws on.