Created
April 22, 2023 08:18
-
-
Save jaeyow/79bb5986f71285fa2aa36095174e35b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_recommended_items(user_id): | |
ssm = boto3.client("ssm") | |
recommenderArn = ssm.get_parameter( | |
Name="/cevo-shopping-demo/recommender/arn-retaildemostore-recommended-for-you", | |
WithDecryption=False, | |
) | |
response = personalizeRuntime.get_recommendations( | |
recommenderArn=recommenderArn["Parameter"]["Value"], | |
userId=user_id, | |
numResults=30, | |
) | |
rec_items = [item["itemId"] for item in response["itemList"]] | |
print(f"Recommended items: {rec_items}") | |
return rec_items |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment