ComenzarEmpieza gratis

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.

Este ejercicio forma parte del curso

Introduction to Claude Models

Ver curso

Instrucciones del ejercicio

  • 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.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# 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)
Editar y ejecutar código