Amazon Personalize and generative AI - Amazon Personalize
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Amazon Personalize and generative AI

Amazon Personalize works well with generative artificial intelligence (generative AI). Amazon Personalize Content Generator, with the help of generative AI, can add engaging themes to batch recommendations for related items. Content Generator is a generative AI capability managed by Amazon Personalize.

You can also use Amazon Personalize recommendations to integrate Amazon Personalize with your generative AI workflow and enhance your users' experience. For example, you can add recommendations to generative AI prompts to create marketing content tailored to each of your user's interests. You can also generate concise summaries for recommended content, or recommend products or content through chat bots.

The following video shows how you can enhance recommendations with Amazon Personalize and generative AI.

The following Amazon Personalize features use generative AI or can help you build generative AI solutions that create personalized content.

Recommendations with themes from Content Generator

Amazon Personalize Content Generator can add descriptive themes to batch recommendations. Content Generator is a generative AI capability managed by Amazon Personalize.

When you get batch recommendations with themes, Amazon Personalize Content Generator adds a descriptive theme for each set of similar items. For example, if you get similar items recommendations for a breakfast food item, Amazon Personalize might generate a theme like Rise and shine or Morning essentials. You might use the theme to replace a generic carousel title, like Frequently bought together. Or you might incorporate the theme in a promotional email or marketing campaign for new menu options.

To generate themes, you import data into Item interactions and Items datasets, create a custom solution with the Similar-Items recipe, and generate batch recommendations. Your item data must include item description and title information. Detailed item descriptions and titles help Content Generator create more accurate and engaging themes.

Recommendation metadata

When you get recommendations, you can have Amazon Personalize return metadata about each recommended item from your Items dataset. You can add this metadata, along with Amazon Personalize recommendations, to your generative AI prompts to generate more compelling content.

For example, you might use generative AI to create marketing emails. You can use Amazon Personalize recommendations and their metadata, such as movie genres, as part of prompt engineering for generative AI. With personalized prompts, you can use generative AI to create engaging marketing emails tailored to each of your customer's interests.

To get recommendation metadata, you first complete the Amazon Personalize workflow to import data and create domain or custom resources. When you create an Amazon Personalize recommender or a campaign, enable the option to include metadata in recommendations. When you get recommendations, you can specify which columns of item data you want to include.

Pre-configured LangChain code for personalization

LangChain is a framework for developing applications powered by language models. It features code built for Amazon Personalize. You can use this code to integrate Amazon Personalize recommendations with your generative AI solution.

For example, you can use the following code to add Amazon Personalize recommendations for a user to your chain.

from aws_langchain import AmazonPersonalize from aws_langchain import AmazonPersonalizeChain from langchain.llms.bedrock import Bedrock recommender_arn="RECOMMENDER ARN" bedrock_llm = Bedrock(model_id="anthropic.claude-v2", region_name="us-west-2") client=AmazonPersonalize(credentials_profile_name="default",region_name="us-west-2",recommender_arn=recommender_arn) # Create personalize chain # Use return_direct=True if you do not want summary chain = AmazonPersonalizeChain.from_llm( llm=bedrock_llm, client=client, return_direct=False ) response = chain({'user_id': '1'}) print(response)