System messages for email assistant
Redwood Consulting handles C-suite clients who expect fast and clear emails. The new AI email assistant you're developing must use a concise tone, always include a subject, be brief, and close with actionable steps. Setting these rules once in a system message will save hundreds of keystrokes, and keep the brand voice rock-solid.
The anthropic
library, client
, and email_request
prompt are pre-loaded.
This exercise is part of the course
Introduction to Claude Models
Exercise instructions
- Write a system message that defines the email assistant's behavior as professional and limits it to 150 words.
- Pass in the
system_msg
as a parameter. - Pass the complete
messages
array to the API call.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create system message for email assistant behavior
system_msg = ____
messages = [
{"role": "user", "content": email_request}]
# Make API call with system message applied
response = client.messages.create(
model="claude-3-7-sonnet-latest", max_tokens=75, system=____,
# Pass in the messages array
messages=____)
print(response.content[0].text)