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년 전434회 조회
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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠