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
preguntada hace 2 años419 visualizaciones
1 Respuesta
1
Respuesta aceptada

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
respondido hace 2 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas