Retail API Recommendation: Are we able to ensure a certain number of items returned after applying t

Hello fellow developers,

I am currently working with the GCP Retail API and implementing filters to refine the results of product recommendations. However, I've encountered a challenge related to the number of items returned after applying the filter.

My goal is to ensure that at least 30 items are returned in the results, even after applying specific filters to narrow down the product recommendations. Unfortunately, in some cases, the filtered results fall short of the desired minimum, which impacts the quality of the user experience.

I have reviewed the GCP Retail API documentation thoroughly, but I haven't found any explicit setting or parameter to enforce a minimum number of items in the results. I wonder if there's a specific approach or workaround that would allow me to achieve this requirement effectively.

Has anyone else faced a similar issue or found a way to resolve it? Are there any best practices or strategies that can help ensure a minimum number of items are returned after applying filters in the GCP Retail API?

Any insights, suggestions, or examples you could share would be greatly appreciated. Thank you for your time and assistance!

My context:

  • GCP Retail API
  • Recommendation model: Recommended for You

Thank you

1 1 451
1 REPLY 1

Hey! I am trying to implement the same thing but got stuck one step before:

To implement a recommendation for the recommended for you model, we should pass to the developers the following code :


I am stuck in what to do with product_id. SHouldn't it be populated automatically? It is for a home page view carrousel recommended for you

curl -X POST \
   
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
   
-H "Content-Type: application/json; charset=utf-8" \
   
--data '{
              "filter": "
FILTER_STRING",
              "validateOnly": false,
              "userEvent": {
                  "eventType": "detail-page-view",
                  "visitorId": "
VISITOR_ID",
                  "userInfo": {
                      "userId": "
USER_ID",
                      "ipAddress": "
IP_ADDRESS",
                      "userAgent": "
USER_AGENT"
                  },
                  "experimentIds": "
EXPERIMENT_GROUP",
                  "productDetails": [{
                      "product": {
                        "id": "
PRODUCT_ID"
                     }
                  }]
              }
            }'
\
https
://retail.googleapis.com/v2/projects/PROJECT_ID/locations/global/catalogs/default_catalog/servingConfigs/SERVING_CONFIG_ID:predict