Temperature 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 başlık testi istiyor: biri özenli ve bilgilendirici, diğeri eğlenceli ve hype ağırlıklı.
anthropic kütüphanesi, client ve product_info dizesi önceden yüklendi.
Bu egzersiz
Claude Modellerine Giriş
kursunun bir parçasıdırEgzersiz talimatları
- Tutarlı, profesyonel çıktılar için düşük bir
temperaturedeğeri ayarla (0.1-0.3). - Yaratıcı, çeşitli çıktılar için yüksek bir
temperaturedeğeri ayarla (0.7-0.9). - Tutucu 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-6", 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-6", 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:", ____)