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

Testing and refining system messages

At Redwood Consulting, the marketing team is promoting the annual Tech Forecast whitepaper on LinkedIn. Posts need to feel conversational yet professional, but your first iteration produced bland, hashtag-free posts. You’ll have to write an improved system message that delivers lively, on-brand content every time.

The anthropic library, client, content_request, and current_system strings are pre-loaded.

Bu egzersiz

Introduction to Claude Models

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

Egzersiz talimatları

  • Set the role for the user's content request.
  • Write an improved_system message that addresses social media requirements, including to use emojis.
  • Apply the improved_system message to the final test.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Test current system message
test_response = client.messages.create(
    model="claude-3-7-sonnet-latest", max_tokens=75, system=current_system,
    messages=[{"role": ____, "content": content_request}])
print("Current output:", test_response.content[0].text)
# Create improved system message based on problems identified
improved_system = ____
final_response = client.messages.create(
          # Apply the improved system message
    model="claude-3-7-sonnet-latest", max_tokens=75, system=____,
    messages=[{"role": "user", "content": content_request}])
print("\nImproved output:", final_response.content[0].text)
Kodu Düzenle ve Çalıştır