BaşlayınÜcretsiz Başlayın

Generating a product description

Imagine you're writing marketing copy for SonicPro headphones. Your goal is to generate a persuasive product description using the OpenAI API.

Test how different prompting techniques, response lengths, and temperature settings influence the output!

Bu egzersiz

Working with the OpenAI API

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Create a detailed prompt to generate a product description for SonicPro headphones, including:
    • Active noise cancellation (ANC)
    • 40-hour battery life
    • Foldable design
  • Experiment with max_completion_tokens and temperature settings to see how they affect the output.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

client = OpenAI(api_key="")

# Create a detailed prompt
prompt = """
____
"""

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": prompt}],
    # Experiment with max_completion_tokens and temperature settings
    max_completion_tokens=____,
    temperature=____
)

print(response.choices[0].message.content)
Kodu Düzenle ve Çalıştır