Associate a Product Recommendation (PR) model with a query pipeline — Coveo Merchandising Hub

Important

Instructions in this article are only relevant for Coveo for Commerce implementations that leverage the Coveo Merchandising Hub (CMH) to manage recommendation slot configurations. If you’re associating a PR model with a query pipeline that serves a recommendation interface that isn’t configured through the CMH, refer to the generic PR model association instructions.

When associating a PR model with the query pipeline for recommendations, you must configure an association for each of the CMH recommendation strategies you want to use in your storefront. For example, if you use the Most purchased and Viewed together CMH strategies in your storefront, you must configure an association for each of these strategies.

This process involves:

Step 1: Create the query pipeline conditions:

You must create a query pipeline condition for each of the CMH recommendation strategies you want to use in your storefront.

The following table provides the conditions you must create based on the CMH strategy you want to use in your storefront:

CMH strategy Query pipeline condition

Viewed together

Recommendation is viewed_together

Purchased together

Recommendation is bought_together

Intent-aware

Recommendation is session_recommender_single_seed

Most viewed

Recommendation is popular_viewed

Most purchased

Recommendation is popular_bought

Recently viewed

Recommendation is recently_viewed

Recently purchased

Recommendation is recently_bought

Purchased with recently purchased

Recommendation is bought_with_recently_bought

Buy again

Recommendation is buy_again

For each query pipeline condition you configure, take note of the condition ID as you’ll need it when associating the model with the query pipeline. You can find the condition ID in the URL of the Conditions (platform-ca | platform-eu | platform-au) page when accessing the condition in the Coveo Administration Console.

find the condition ID in the URL | Coveo

For instructions on how to create query pipeline conditions, see Manage query pipeline conditions.

Step 2: Associate a PR model with the query pipeline for recommendations:

To associate a PR model with a query pipeline, use the JSON editor of the Query Pipelines (platform-ca | platform-eu | platform-au) page in the Coveo Administration Console.

  1. In the Coveo Administration Console, access the Query Pipelines page.

  2. In the Query Pipelines page, click the query pipeline you configured for recommendations, and then click Edit components.

  3. Click the Machine Learning tab, and then click the ellipsis in the upper right part of the page to select Associate a model in JSON view.

  4. In the JSON editor, add the following configuration, replacing the placeholder values with your data, and then click Associate model.

    {
      "modelId": "<MY_MODEL_ID>", 1
      "condition": "<MY_CONDITION_ID>", 2
      "maxRecommendations": 50,
      "cacheMaximumAge": "<CACHE_MAXIMUM_AGE>", 3
      "exclusive": true,
      "customQueryParameters": {
        "strategy": "<STRATEGY_VALUE>" 4
      },
      "useAdvancedConfiguration": true
    }
1 Replace <MY_MODEL_ID> with the ID of the model you want to associate with the query pipeline. See Review model information to learn how to find the model ID.
2 Replace <MY_CONDITION_ID> with the ID of the query pipeline condition you created for the strategy you want to associate the model with.
3 When associating an SBPR model, we recommend adjusting the default value of PT10S to a shorter duration between 0 and 5 seconds (that is, PT0S to PT5S). This adjustment ensures the model responds more quickly to user behavior. Note that the value must be in the ISO-8601 format.
4 Replace <STRATEGY_VALUE> with the the strategy you want to associate the model with. The following table provides the strategy values for each CMH strategy:
CMH strategy Value to use

Viewed together

frequentViewed

Purchased together

frequentBought

Intent-aware

sessionRecommenderWithFallbackEnriched

Most viewed

popularViewed

Most purchased

popularBought

Recently viewed

recentlyViewed

Recently purchased

recentlyBought

Purchased with recently purchased

recommendationsUsingRecentlyBought

Buy again

buyAgain