Sıcaklık ile yaratıcılığı kontrol etme
Luna Gear'da ürün liderisin ve çevre dostu TerraPack sırt çantasını piyasaya sürüyorsun. Ekip bir A/B altyazı testi istiyor: biri pürüzsüz ve bilgilendirici, diğeri ise eğlenceli ve hype odaklı.
anthropic kütüphanesi, client ve product_info string'i önceden yüklendi.
Bu egzersiz
Claude Modellerine Giriş
kursunun bir parçasıdırEgzersiz talimatları
- Tutarlı ve profesyonel çıktı için düşük bir
temperaturedeğeri ayarla (0.1-0.3). - Yaratıcı ve çeşitli çıktı için yüksek bir
temperaturedeğeri ayarla (0.7-0.9). - Temkinli ve yaratıcı yanıt içeriklerini yazdır.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
conservative_response = client.messages.create(
# Conservative caption with low temperature
model="claude-sonnet-4-0", temperature=____, max_tokens=150,
messages=[{"role": "user",
"content": f"Write a professional caption for this product: {product_info}"}])
creative_response = client.messages.create(
# Creative caption with high temperature
model="claude-sonnet-4-0", temperature=____, max_tokens=150,
messages=[{"role": "user",
"content": f"Write a fun, engaging caption for this product: {product_info}"}])
# Print the Conservative and Creative Responses
print("Conservative caption:", ____)
print("\nCreative caption:", ____)