Generování nového obsahu

Introduction to Claude Models

Nikhil Rangarajan

Data Scientist

Generování kreativního obsahu

  • Od transformace textu k původní tvorbě
    • Příběhy

Otevřená kniha

Introduction to Claude Models

Generování kreativního obsahu

  • Od transformace textu k původní tvorbě
    • Příběhy
    • Marketingové texty

Otevřená kniha a webová stránka s marketingovým textem

Introduction to Claude Models

Generování kreativního obsahu

  • Od transformace textu k původní tvorbě
    • Příběhy
    • Marketingové texty
    • Kód

Otevřená kniha, webová stránka s marketingovým textem a ukázka kódu

Introduction to Claude Models

Generování kreativního obsahu

  • Od transformace textu k původní tvorbě
    • Příběhy
    • Marketingové texty
    • Kód
    • E-maily

Otevřená kniha, webová stránka s marketingovým textem, ukázka kódu a e-mail

Introduction to Claude Models

Generování kreativního obsahu

  • Od transformace textu k původní tvorbě
    • Příběhy
    • Marketingové texty
    • Kód
    • E-maily
    • Skripty

Otevřená kniha, webová stránka s marketingovým textem, ukázka kódu, e-mail a skript

Introduction to Claude Models

Jak psát efektivní prompty pro generování

$$

  • Specificita
  • Vágní prompt: obecné výsledky
  • Konkrétní prompt: cílený obsah
# Vague prompt
prompt = "Write a product description"

# Specific prompt prompt = """Write a 150-word product description for a wireless bluetooth speaker targeting college students. Use an energetic, casual tone and highlight portability, battery life, and sound quality."""
Introduction to Claude Models

Jak psát efektivní prompty pro generování

$$

  • Nejčastější použití Clauda: kód
  • Konkrétní prompty vedou k přesným výstupům
    • Programovací jazyk
    • Konkrétní funkcionalita
    • Požadavky na ošetření chyb
    • Očekávané výstupy
# Vague prompt
prompt = "Write some code"

# Specific prompt  
prompt = """Write a Python function 
that validates email addresses 
using regex. 
Include error handling for invalid 
inputs and return both boolean result 
and descriptive error message."""
Introduction to Claude Models

Parametr teploty

  • Rozsah teploty: 0,0 (deterministické) až 1,0 (vysoce kreativní)
    • Nízká teplota (0,1–0,3): konzistentní, předvídatelné výstupy
    • Střední teplota (0,4–0,7): rovnováha kreativity a koherence
    • Vysoká teplota (0,8–1,0): maximální kreativita, méně předvídatelné

Teplota v rozsahu od 0 do 1

Introduction to Claude Models

Teplota ve volání modelu

# Conservative generation
response1 = client.messages.create(
    model="claude-sonnet-4-6",
    temperature=0.2,
    messages=[{"role": "user", "content": prompt}])

# Creative generation response2 = client.messages.create( temperature=0.8, messages=[{"role": "user", "content": prompt}])
print("Temperature 0.2 Response (Conservative)") print(response1.content[0].text)
print("Temperature 0.8 Response (Creative)") print(response2.content[0].text)
Introduction to Claude Models

Teplota ve volání modelu

Temperature 0.2 Response (Conservative)
A rainbow is an optical phenomenon that occurs when sunlight and rain are present 
simultaneously. It forms when white light from the sun passes through water 
droplets in the atmosphere, causing the light to refract, reflect, and disperse 
into its component colors...

Temperature 0.8 Response (Creative)
Ah, rainbows! Those magical bridges painted across stormy skies that never fail 
to make us pause and wonder. Picture this: millions of tiny water droplets hanging 
in the air after a rainfall, each one acting like a miniature crystal ball. When 
sunlight hits these droplets, something absolutely enchanting happens...
Introduction to Claude Models

Parametr `top_p`

$$

  • top_p (nucleus sampling): alternativa k teplotě pro řízení kreativity
  • Typické hodnoty: 0,1 (zaměřené) až 0,9 (různorodé)
  • Kombinované použití: teplotu a top_p lze kombinovat pro přesné nastavení

$$

client.messages.create(
model="claude-sonnet-4-6",
temperature=0.7,
top_p=0.3, #Likely words
messages=[{"role":"user", 
           "content":prompt}])
Introduction to Claude Models

Bezpečnostní funkce Clauda

$$

  • 📝 Silné stránky: psaní, analýza, kódování, kreativní úkoly
  • 🚫 Zabudovaná bezpečnost: odmítá škodlivý obsah, dodržuje etické zásady
  • ✅ Osvědčené postupy: jasné prompty, experimentování s parametry, kontrola výstupů
Introduction to Claude Models

Pojďme cvičit!

Introduction to Claude Models

Preparing Video For Download...