A large language model (LLM) is an artificial intelligence algorithm trained with deep-learning techniques on massive data sets to understand, summarize, translate, or generate text. An LLM is driven by a prompt: the instruction must state the intended task and provide enough background for the model to interpret it. Prompt refinement may require several iterations. section 7.5
In a Snowflake data pipeline, an LLM can augment stored data by turning unstructured content into information that can be queried. Typical uses include classifying the sentiment of customer reviews and extracting structured order fields from email bodies, allowing employees to focus on selected reviews or avoid manually transcribing orders. section 7.0
A practical pattern for using an LLM to extract orders is:
- Construct a prompt that tells a Snowflake Cortex COMPLETE function to read an email and return order details in CSV format. section 7.4
- Call the model from a stored procedure when procedural logic is needed to retrieve, transform, and persist the result. section 7.4 section 7.5
- Convert the returned CSV to a Snowpark data frame, define its structure with StructType, and save it as a Snowflake table. section 7.4 section 7.5
- Test the procedure with representative emails and compare generated rows with the original text before relying on the output. section 7.4.4
Extracting orders from an email
A procedure can receive an email requesting six white loaves for September 5 and 16 bagels for September 6, then return rows containing the customer, dates, item, and quantity. The result is useful for loading orders, but dates and ambiguous item names require review: the model may use an outdated current year or map “French bread” to different products on different runs. section 7.4.4
call READ_EMAIL_PROC( 'Hello, please deliver 6 loaves of white bread on Tuesday, September 5. On Wednesday, September 6, we need 16 bagels. Thanks, Lilys Coffee');
Use this sample procedure call to test extraction of two order lines from a single unstructured email. section 7.4.4
Treat LLM output cautiously. Models may not follow instructions exactly, can make incorrect assumptions, and can produce different interpretations for the same ambiguous request across models or executions. Validate results against source content before using them operationally. section 7.4.4 section 7.5


































































