Skip to content

Commit a62e726

Browse files
authored
Update LLM to Sonnet 3.7 and update promt to latest best practices (#189)
1 parent 5a69fc4 commit a62e726

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

next_steps/generative_ai/user_personalized_marketing_messaging_with_amazon_personalize_and_gen_ai/04_Personalized_Emails_with_Amazon_Personalize_and_Generative_AI.ipynb

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,8 @@
369369
"outputs": [],
370370
"source": [
371371
"# Model parameters\n",
372-
"# The LLM we will be using\n",
373-
"model_id = 'anthropic.claude-3-sonnet-20240229-v1:0'\n",
374-
" \n",
372+
"# The LLM we will be using is Anthropic Clause Sonnet 3.7\n",
373+
"model_id = 'us.anthropic.claude-3-7-sonnet-20250219-v1:0'\n",
375374
"\n",
376375
"# The maximum number of tokens to use in the generated response\n",
377376
"max_tokens_to_sample = 1000"
@@ -431,16 +430,14 @@
431430
"source": [
432431
"def generate_personalize_simple_prompt(movie_list, model_id, max_tokens_to_sample = 50):\n",
433432
"\n",
434-
" prompt_template = f'''\\n\\nHuman: Write a marketing email advertising several movies available in a video-on-demand streaming platform next week, given the movie and user information below. The movies to recommend and their information is contained in the <movie> tag. Put the email between <email> tags.\n",
433+
" prompt_template = f'''Write a marketing email advertising several movies available in a video-on-demand streaming platform next week, given the movie and user information below. The movies to recommend and their information is contained in the <movie> tag. Put the email between <email> tags.\n",
435434
"\n",
436435
" <movie>\n",
437436
" {movie_list}\n",
438437
" </movie>\n",
439438
"\n",
440439
" Assistant: Email body:\n",
441-
" <email>.\n",
442-
"\n",
443-
" Assistant:\n",
440+
" <email>\n",
444441
" '''\n",
445442
" \n",
446443
" if 'claude' in model_id:\n",
@@ -556,7 +553,7 @@
556553
"source": [
557554
"def generate_personalize_advanced_prompt(user_demographic, favorite_genre, movie_list, model_id, max_tokens_to_sample = 50):\n",
558555
"\n",
559-
" prompt_template = f'''\\n\\nHuman: You are a skilled publicist. Write a high-converting marketing email advertising several movies available in a video-on-demand streaming platform next week, \n",
556+
" prompt_template = f'''You are a skilled publicist. Write a high-converting marketing email advertising several movies available in a video-on-demand streaming platform next week, \n",
560557
" given the movie and user information below. Your email will leverage the power of storytelling and persuasive language. \n",
561558
" You want the email to impress the user, so make it appealing to them based on the information contained in the <user> tags, \n",
562559
" and take into account the user's favorite genre in the <genre> tags. \n",
@@ -576,7 +573,8 @@
576573
" {movie_list}\n",
577574
" </movie>\n",
578575
"\n",
579-
" Assistant:\n",
576+
" Assistant:Email body:\n",
577+
" <email>\n",
580578
" '''\n",
581579
" \n",
582580
" if 'claude' in model_id:\n",
@@ -777,7 +775,7 @@
777775
"name": "python",
778776
"nbconvert_exporter": "python",
779777
"pygments_lexer": "ipython3",
780-
"version": "3.10.14"
778+
"version": "3.10.16"
781779
}
782780
},
783781
"nbformat": 4,

0 commit comments

Comments
 (0)