Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add AWS Amazon Personalize as a Provider for the Recommended Content Feature #790

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

dkotter
Copy link
Collaborator

@dkotter dkotter commented Aug 2, 2024

Description of the Change

Currently the only Provider we have for the Recommended Content Feature is Azure Personalizer. That Provider has been deprecated by Azure and is no longer available to use. In doing lots of research, a fairly close drop-in replacement is AWS Amazon Personalize. This PR adds a new Provider for that.

Worth noting there are lots of use cases that Amazon Personalize provides, some more out of the box and some that require a bit more setup. This PR is focusing on the Personalized Ranking recipe as that very closely matches what we were doing with Azure Personalizer. We could look to support other use cases in the future though.

Closes #

How to test the Change

More to come

Changelog Entry

Added - AWS Amazon Personalize as a new Provider for the Recommended Content Feature

Credits

Props @dkotter, @Sidsector9

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@dkotter dkotter added this to the 3.2.0 milestone Aug 2, 2024
@dkotter dkotter self-assigned this Aug 2, 2024
@dkotter dkotter requested review from jeffpaul and a team as code owners August 2, 2024 20:34
@github-actions github-actions bot added the needs:code-review This requires code review. label Aug 2, 2024
@dkotter dkotter removed request for a team and jeffpaul August 2, 2024 20:35
@dkotter
Copy link
Collaborator Author

dkotter commented Aug 2, 2024

@jeffpaul The dependency review workflow is failing on this PR: https://github.com/10up/classifai/actions/runs/10221897513/job/28285404935?pr=790#step:3:11.

Looking at the licenses it's flagging (Apache-2.0 and MIT) seems both of those should be allowed based off our config: https://github.com/10up/.github/blob/trunk/.github/dependency-review-config.yml

I'm not familiar enough with this action to know if this is an issue with that, an issue with our config or something else that needs fixed up

return new WP_Error( 'client_not_found', esc_html__( 'Client not found.', 'classifai' ) );
}

$id = uniqid(); // TODO: Is this the best way to generate a session ID?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will create a new ID for every event. We'll need to generate a session ID that remains the same through the session. We can do something like the following?

add_action( 'init', function() {
    if ( ! session_id() ) {
        session_start();
    }
} );

Few points from the docs:

  1. Your application generates a unique sessionId when a user first visits your website or uses your application. You must use the same sessionId in all events throughout the session. Amazon Personalize uses the sessionId to associate events with the user before they log in (is anonymous).
  2. To provide real-time personalization for anonymous users, specify the sessionId as the userId in your GetRecommendations or GetActionRecommendations request.

],
'sessionId' => $id,
'trackingId' => $settings['event_tracker_id'] ?? '',
'userId' => $id, // TODO: We need a user ID that can be tracked across page views.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For logged-in users, can this be the value returned by get_current_user_id(), something like:

'userId' => get_current_user_id() ?? session_id(),

@iamdharmesh
Copy link
Member

@jeffpaul The dependency review workflow is failing on this PR: https://github.com/10up/classifai/actions/runs/10221897513/job/28285404935?pr=790#step:3:11.

Looking at the licenses it's flagging (Apache-2.0 and MIT) seems both of those should be allowed based off our config: https://github.com/10up/.github/blob/trunk/.github/dependency-review-config.yml

I'm not familiar enough with this action to know if this is an issue with that, an issue with our config or something else that needs fixed up

@jeffpaul, I'm seeing a similar failure in PR #771 as well. I'm not sure of the exact reason for this. Could it be because Apache-2.0 is compatible with GNU GPL-v3 but not with GPL-v2, as mentioned here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:code-review This requires code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants