How to get recommendations from Domain dataset recommender with the SDK for Python (Boto3).

0

We use domain dataset group at Amazon Personalize. We finished to import data (interactions, users, items) and create an recommender (Recommended for you). We can get recommendations from the recommender with the Amazon Personalize console.

Then, we would like to get recommendations with the SDK for Python (Boto3). We sent request per following Developer Guide, however ParamValidationError occured. Getting recommendations with a recommender (AWS SDKs): https://docs.aws.amazon.com/personalize/latest/dg/domain-dsg-recommendations.html#get-domain-rec-sdk

How can we get recommendations from Domain dataset recommender with the SDK for Python (Boto3)?

We tried following pattens;

pattern1

Request

response = personalizeRt.get_recommendations(
    recommenderArn = 'Recommender ARN',
    userId = 'User ID',
    numResults = 10
)

Error

ParamValidationError: Parameter validation failed:
Missing required parameter in input: "campaignArn"
Unknown parameter in input: "recommenderArn", must be one of: campaignArn, itemId, userId, numResults, context, filterArn, filterValues

pattern2

Request

response = personalizeRt.get_recommendations(
    campaignArn = 'Recommender ARN',
    userId = 'User ID',
    numResults = 10
)

Error

InvalidInputException: An error occurred (InvalidInputException) when calling the GetRecommendations operation: The given campaign ARN is invalid: Recommender ARN
質問済み 2年前419ビュー
1回答
1
承認された回答

Pattern 1 is the correct way to get recommendations from a domain recommender. Since the release of domain recommenders introduced an API change for the GetRecommendations API, ensure that you are using boto3 1.20.15 or newer. If you're using a Lambda function, keep in mind that dependencies like boto3 are updated less frequently in the base Lambda runtimes. Therefore, you may need to setup a requirements.txt to specify your min version and upload the boto3 package version you need with your function.

AWS
James_J
回答済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ