A prompt is a set of questions or instructions plus supporting context that guides a generative model's output. In a data pipeline, it can direct an LLM to read customer email, extract order details, format them as CSV, and support storage in a Snowflake table. section 7.4 section 7.5
Construct an effective prompt by:
- State the task and intended output unambiguously. section 7.4.2
- Include enough background, such as the email content and permitted item values. section 7.4.2
- Specify the output structure, column names, and formatting rules, including YYYY-MM-DD dates. section 7.4.2
- Refine the instructions across iterations when the model produces unsatisfactory results. section 7.4.2
Email-to-order extraction
A bakery prompt asks the model to read a delivery email and return customer, order date, delivery date, item, and quantity as CSV. The resulting data can be converted to a data frame and saved to Snowflake. section 7.4 section 7.4.2
prompt = f"""You are a bakery employee, reading customer emails asking
for deliveries. Please read the email at the end of this text and
extract information about the ordered items. Format the information in
CSV using the following columns: customer, order_date, delivery_date,
item, and quantity. Format the date as YYYY-MM-DD. If no year is given,
assume the current year. Use the current date in the format YYYY-MM-DD
for the order date. Items should be in this list: [white loaf, rye loaf,
baguette, bagel, croissant, chocolate muffin, blueberry muffin]. The
content of the email follows this line. \n {email_content}"""
Runnable prompt construction combines task instructions, schema, date rules, allowed values, and the email content. section 7.4.2
csv_output = Complete('snowflake-arctic', prompt)
The constructed prompt is passed to Snowflake Cortex COMPLETE with the snowflake-arctic model. section 7.4.2

















































