टेक्स्ट जेनरेशन

Snowflake में Generative AI परिचय

James Cha-Earley

Senior Developer Advocate, Snowflake

होटल रिव्यू के जवाब प्रबंधित करना

सूर्यास्त पर तट का होटल

1 Image generated with Google Gemini 2.5 Pro
Snowflake में Generative AI परिचय

summarize()

long_review = """
This hotel was nothing short of amazing. The best views; the best location;
and the best staff. It's clean; conveniently located to other restaurants
on the strip; although we ate at the restaurants on site and each was so good
there's really no reason to leave. Ohhh the views. The beach was free of seaweed; 
amazingly clean and plenty of space; it wasn't crowded at all. 
Stay here; you will not regret it. Did I mention how comfortable the beds were. 
Yes save yourself trouble and stay here. It's really perfect.
"""

from snowflake.cortex import summarize summarized_review = summarize(text=long_review)
Snowflake में Generative AI परिचय

सारांश प्रिंट करना

print(summarized_review)
The hotel exceeded expectations with stunning views, exceptional staff,
comfortable beds, and top-notch on-site dining, making it a perfect and 
highly recommended stay.
Snowflake में Generative AI परिचय

डेटाबेस से निकालना

सेल1 में SQL क्वेरी

सेल2 में Python कोड

Snowflake में Generative AI परिचय

जवाब जनरेट करना

from snowflake.cortex import complete


prompt = f"Write a short response to this hotel review: {latest_review}."
# Pass the prompt response = complete(prompt=prompt,
Snowflake में Generative AI परिचय

जवाब जनरेट करना

from snowflake.cortex import complete


prompt = f"Write a short response to this hotel review: {latest_review}."
# Specify the model response = complete(prompt=prompt, model='llama3.1-8b',
Snowflake में Generative AI परिचय

जवाब जनरेट करना

from snowflake.cortex import complete


prompt = f"Write a short response to this hotel review: {latest_review}."
# Set the temperature - control predictability of output response = complete(prompt=prompt, model='llama3.1-8b', options={ 'temperature':0.3,
Snowflake में Generative AI परिचय

जवाब जनरेट करना

from snowflake.cortex import complete


prompt = f"Write a short response to this hotel review: {latest_review}."
# Limit the number of tokens with max_tokens response = complete(prompt=prompt, model='llama3.1-8b', options={ 'temperature':0.3, 'max_tokens':150 } )
Snowflake में Generative AI परिचय

जवाब देखना

print(response)
Thank you so much for sharing your wonderful experience at the Hyatt Nice! 
We're thrilled to hear that you had a fantastic stay with us.
  • तेज, लचीला, विश्वसनीय
Snowflake में Generative AI परिचय

AI_COMPLETE() के साथ टेक्स्ट जेनरेशन

SELECT
  DESCRIPTION,
  AI_COMPLETE(

'llama3.1-8b',
PROMPT('Write a short response to this hotel review: {0}.', DESCRIPTION),
{'temperature': 0.3, 'max_tokens': 150}
) AS completion FROM HOTELS.REVIEWS ORDER BY date DESC LIMIT 1;
Snowflake में Generative AI परिचय

Snowflake नोटबुक में आउटपुट

Snowflake नोटबुक में AI_COMPLETE() आउटपुट

  • AI_COMPLETE() बॉक्स से बाहर उपलब्ध है
Snowflake में Generative AI परिचय

Snowflake में टेक्स्ट जेनरेशन

-- SQL सेल्स में कोडिंग
AI_COMPLETE(
  'llama3.1-8b',
  PROMPT('Write a short response 
          to this hotel review: {0}.', 
          DESCRIPTION),
  {'temperature': 0.3, 
   'max_tokens': 150}
    )
  • पंक्तियों के बैच के लिए टेक्स्ट जनरेट करें
# Python सेल्स में कोडिंग
complete(
    model='llama3.1-8b', 
    prompt = f"""Write a short response
        to this hotel review: 
        {latest_review}.""",
    options={'temperature':0.3,
             'max_tokens':150}
    )
  • मल्टी-स्टेप वर्कफ़्लो चेन करने के लिए उपयोग करें
Snowflake में Generative AI परिचय

अभ्यास करते हैं!

Snowflake में Generative AI परिचय

Preparing Video For Download...