AWS Personalize 的分页 GetRecommendations API

Paginate GetRecommendations API of AWS Personalize

我目前正在尝试创建一个包含无限滚动分页(类似于 Instagram Explore)的推荐页面,但找不到开箱即用的 AWS SDK 来完成此操作。

是否有任何其他方法以分页方式从 AWS Personalize 获取数据并确保检索到的数据不重复?

GetRecommendations API for Personalize currently does not support pagination so the only way to use this API directly would be to fetch up to 500 items from the client in one call and then progressively reveal recommended items as the user scrolls. Or you could create an intermediate public API endpoint using something like API Gateway & Lambda that supports pagination and then lazily fetch and load recommendations for a user in a datastore like Redis. A Redis lrange or zrange分页。

检索最大数量的推荐然后对它们进行分页的优点是它们代表某个时刻推荐的快照。由于 Personalize 可能 adjust recommendations based on new interactions streamed into the service,建议可能会从一次调用 GetRecommendations 更改为下一次调用。这可能会造成用户体验相同的项目似乎是重复的,因为它在调用之间的相关性下降并显示在结果的多个“页面”中。