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 exercício faz parte do curso
Introduction to Claude Models
Instruções do exercício
- Set the
rolefor the user's content request. - Write an
improved_systemmessage that addresses social media requirements, including to use emojis. - Apply the
improved_systemmessage to the final test.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# 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)