recombee-api-client 5.1.1 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api-client.js +1 -1
- package/lib/index.d.ts +196 -53
- package/lib/requests/add-detail-view.js +7 -0
- package/lib/requests/composite-recommendation.js +127 -0
- package/lib/requests/index.js +1 -0
- package/lib/requests/recommend-item-segments-to-item-segment.js +39 -0
- package/lib/requests/recommend-item-segments-to-item.js +39 -0
- package/lib/requests/recommend-item-segments-to-user.js +39 -0
- package/lib/requests/recommend-items-to-item-segment.js +42 -0
- package/lib/requests/recommend-items-to-item.js +45 -0
- package/lib/requests/recommend-items-to-user.js +42 -0
- package/lib/requests/recommend-users-to-item.js +45 -0
- package/lib/requests/recommend-users-to-user.js +42 -0
- package/lib/requests/search-item-segments.js +39 -0
- package/lib/requests/search-items.js +42 -0
- package/lib/requests/set-view-portion.js +14 -0
- package/package.json +1 -1
- package/test/add-bookmark-batch_test.js +8 -8
- package/test/add-bookmark-callback_test.js +14 -14
- package/test/add-bookmark-test.js +7 -7
- package/test/add-cart-addition-batch_test.js +8 -8
- package/test/add-cart-addition-callback_test.js +14 -14
- package/test/add-cart-addition-test.js +7 -7
- package/test/add-detail-view-batch_test.js +8 -8
- package/test/add-detail-view-callback_test.js +14 -14
- package/test/add-detail-view-test.js +7 -7
- package/test/add-item-batch_test.js +5 -5
- package/test/add-item-callback_test.js +9 -9
- package/test/add-item-property-batch_test.js +6 -6
- package/test/add-item-property-callback_test.js +10 -10
- package/test/add-item-property-test.js +5 -5
- package/test/add-item-test.js +5 -5
- package/test/add-manual-reql-segment-batch_test.js +3 -3
- package/test/add-manual-reql-segment-callback_test.js +3 -3
- package/test/add-manual-reql-segment-test.js +1 -1
- package/test/add-purchase-batch_test.js +8 -8
- package/test/add-purchase-callback_test.js +14 -14
- package/test/add-purchase-test.js +7 -7
- package/test/add-rating-batch_test.js +8 -8
- package/test/add-rating-callback_test.js +16 -16
- package/test/add-rating-test.js +9 -9
- package/test/add-search-synonym-batch_test.js +5 -5
- package/test/add-search-synonym-callback_test.js +7 -7
- package/test/add-search-synonym-test.js +5 -5
- package/test/add-series-batch_test.js +5 -5
- package/test/add-series-callback_test.js +9 -9
- package/test/add-series-test.js +5 -5
- package/test/add-user-batch_test.js +5 -5
- package/test/add-user-callback_test.js +9 -9
- package/test/add-user-property-batch_test.js +6 -6
- package/test/add-user-property-callback_test.js +10 -10
- package/test/add-user-property-test.js +5 -5
- package/test/add-user-test.js +5 -5
- package/test/composite-recommendation-batch_test.js +33 -0
- package/test/composite-recommendation-callback_test.js +37 -0
- package/test/composite-recommendation-test.js +39 -0
- package/test/create-auto-reql-segmentation-batch_test.js +3 -3
- package/test/create-auto-reql-segmentation-callback_test.js +5 -5
- package/test/create-auto-reql-segmentation-test.js +3 -3
- package/test/create-manual-reql-segmentation-batch_test.js +3 -3
- package/test/create-manual-reql-segmentation-callback_test.js +5 -5
- package/test/create-manual-reql-segmentation-test.js +3 -3
- package/test/create-property-based-segmentation-batch_test.js +3 -3
- package/test/create-property-based-segmentation-callback_test.js +5 -5
- package/test/create-property-based-segmentation-test.js +3 -3
- package/test/delete-all-search-synonyms-batch_test.js +2 -2
- package/test/delete-all-search-synonyms-callback_test.js +2 -2
- package/test/delete-all-search-synonyms-test.js +1 -1
- package/test/delete-bookmark-batch_test.js +3 -3
- package/test/delete-bookmark-callback_test.js +5 -5
- package/test/delete-bookmark-test.js +3 -3
- package/test/delete-cart-addition-batch_test.js +3 -3
- package/test/delete-cart-addition-callback_test.js +5 -5
- package/test/delete-cart-addition-test.js +3 -3
- package/test/delete-detail-view-batch_test.js +3 -3
- package/test/delete-detail-view-callback_test.js +5 -5
- package/test/delete-detail-view-test.js +3 -3
- package/test/delete-item-batch_test.js +5 -5
- package/test/delete-item-callback_test.js +11 -11
- package/test/delete-item-property-batch_test.js +5 -5
- package/test/delete-item-property-callback_test.js +11 -11
- package/test/delete-item-property-test.js +7 -7
- package/test/delete-item-test.js +7 -7
- package/test/delete-manual-reql-segment-batch_test.js +4 -4
- package/test/delete-manual-reql-segment-callback_test.js +4 -4
- package/test/delete-manual-reql-segment-test.js +1 -1
- package/test/delete-more-items-batch_test.js +4 -4
- package/test/delete-more-items-callback_test.js +4 -4
- package/test/delete-more-items-test.js +3 -3
- package/test/delete-purchase-batch_test.js +3 -3
- package/test/delete-purchase-callback_test.js +5 -5
- package/test/delete-purchase-test.js +3 -3
- package/test/delete-rating-batch_test.js +3 -3
- package/test/delete-rating-callback_test.js +5 -5
- package/test/delete-rating-test.js +3 -3
- package/test/delete-search-synonym-batch_test.js +4 -4
- package/test/delete-search-synonym-callback_test.js +6 -6
- package/test/delete-search-synonym-test.js +3 -3
- package/test/delete-segmentation-batch_test.js +4 -4
- package/test/delete-segmentation-callback_test.js +6 -6
- package/test/delete-segmentation-test.js +3 -3
- package/test/delete-series-batch_test.js +5 -5
- package/test/delete-series-callback_test.js +11 -11
- package/test/delete-series-test.js +7 -7
- package/test/delete-user-batch_test.js +5 -5
- package/test/delete-user-callback_test.js +11 -11
- package/test/delete-user-property-batch_test.js +5 -5
- package/test/delete-user-property-callback_test.js +11 -11
- package/test/delete-user-property-test.js +7 -7
- package/test/delete-user-test.js +7 -7
- package/test/delete-view-portion-batch_test.js +3 -3
- package/test/delete-view-portion-callback_test.js +5 -5
- package/test/delete-view-portion-test.js +3 -3
- package/test/get-item-property-info-batch_test.js +5 -5
- package/test/get-item-property-info-callback_test.js +5 -5
- package/test/get-item-property-info-test.js +3 -3
- package/test/get-item-values-batch_test.js +4 -4
- package/test/get-item-values-callback_test.js +4 -4
- package/test/get-item-values-test.js +3 -3
- package/test/get-segmentation-batch_test.js +4 -4
- package/test/get-segmentation-callback_test.js +4 -4
- package/test/get-segmentation-test.js +2 -2
- package/test/get-user-property-info-batch_test.js +5 -5
- package/test/get-user-property-info-callback_test.js +5 -5
- package/test/get-user-property-info-test.js +3 -3
- package/test/get-user-values-batch_test.js +4 -4
- package/test/get-user-values-callback_test.js +4 -4
- package/test/get-user-values-test.js +3 -3
- package/test/insert-to-series-batch_test.js +7 -7
- package/test/insert-to-series-callback_test.js +9 -9
- package/test/insert-to-series-test.js +3 -3
- package/test/list-item-bookmarks-batch_test.js +5 -5
- package/test/list-item-bookmarks-callback_test.js +5 -5
- package/test/list-item-bookmarks-test.js +4 -4
- package/test/list-item-cart-additions-batch_test.js +5 -5
- package/test/list-item-cart-additions-callback_test.js +5 -5
- package/test/list-item-cart-additions-test.js +4 -4
- package/test/list-item-detail-views-batch_test.js +5 -5
- package/test/list-item-detail-views-callback_test.js +5 -5
- package/test/list-item-detail-views-test.js +4 -4
- package/test/list-item-properties-batch_test.js +3 -3
- package/test/list-item-properties-callback_test.js +3 -3
- package/test/list-item-properties-test.js +2 -2
- package/test/list-item-purchases-batch_test.js +5 -5
- package/test/list-item-purchases-callback_test.js +5 -5
- package/test/list-item-purchases-test.js +4 -4
- package/test/list-item-ratings-batch_test.js +5 -5
- package/test/list-item-ratings-callback_test.js +5 -5
- package/test/list-item-ratings-test.js +4 -4
- package/test/list-item-view-portions-batch_test.js +5 -5
- package/test/list-item-view-portions-callback_test.js +5 -5
- package/test/list-item-view-portions-test.js +4 -4
- package/test/list-items-batch_test.js +5 -5
- package/test/list-items-callback_test.js +5 -5
- package/test/list-items-test.js +3 -3
- package/test/list-scenarios-batch_test.js +2 -2
- package/test/list-scenarios-callback_test.js +2 -2
- package/test/list-scenarios-test.js +1 -1
- package/test/list-search-synonyms-batch_test.js +6 -6
- package/test/list-search-synonyms-callback_test.js +6 -6
- package/test/list-search-synonyms-test.js +3 -3
- package/test/list-segmentations-batch_test.js +4 -4
- package/test/list-segmentations-callback_test.js +4 -4
- package/test/list-segmentations-test.js +2 -2
- package/test/list-series-batch_test.js +3 -3
- package/test/list-series-callback_test.js +3 -3
- package/test/list-series-items-batch_test.js +5 -5
- package/test/list-series-items-callback_test.js +5 -5
- package/test/list-series-items-test.js +4 -4
- package/test/list-series-test.js +2 -2
- package/test/list-user-bookmarks-batch_test.js +5 -5
- package/test/list-user-bookmarks-callback_test.js +5 -5
- package/test/list-user-bookmarks-test.js +4 -4
- package/test/list-user-cart-additions-batch_test.js +5 -5
- package/test/list-user-cart-additions-callback_test.js +5 -5
- package/test/list-user-cart-additions-test.js +4 -4
- package/test/list-user-detail-views-batch_test.js +5 -5
- package/test/list-user-detail-views-callback_test.js +5 -5
- package/test/list-user-detail-views-test.js +4 -4
- package/test/list-user-properties-batch_test.js +3 -3
- package/test/list-user-properties-callback_test.js +3 -3
- package/test/list-user-properties-test.js +2 -2
- package/test/list-user-purchases-batch_test.js +5 -5
- package/test/list-user-purchases-callback_test.js +5 -5
- package/test/list-user-purchases-test.js +4 -4
- package/test/list-user-ratings-batch_test.js +5 -5
- package/test/list-user-ratings-callback_test.js +5 -5
- package/test/list-user-ratings-test.js +4 -4
- package/test/list-user-view-portions-batch_test.js +5 -5
- package/test/list-user-view-portions-callback_test.js +5 -5
- package/test/list-user-view-portions-test.js +4 -4
- package/test/list-users-batch_test.js +5 -5
- package/test/list-users-callback_test.js +5 -5
- package/test/list-users-test.js +3 -3
- package/test/merge-users-batch_test.js +4 -4
- package/test/merge-users-callback_test.js +6 -6
- package/test/merge-users-test.js +3 -3
- package/test/recommend-item-segments-to-item-batch_test.js +2 -2
- package/test/recommend-item-segments-to-item-callback_test.js +4 -4
- package/test/recommend-item-segments-to-item-segment-batch_test.js +2 -2
- package/test/recommend-item-segments-to-item-segment-callback_test.js +4 -4
- package/test/recommend-item-segments-to-item-segment-test.js +3 -3
- package/test/recommend-item-segments-to-item-test.js +3 -3
- package/test/recommend-item-segments-to-user-batch_test.js +2 -2
- package/test/recommend-item-segments-to-user-callback_test.js +4 -4
- package/test/recommend-item-segments-to-user-test.js +3 -3
- package/test/recommend-items-to-item-batch_test.js +4 -4
- package/test/recommend-items-to-item-callback_test.js +4 -4
- package/test/recommend-items-to-item-segment-batch_test.js +2 -2
- package/test/recommend-items-to-item-segment-callback_test.js +4 -4
- package/test/recommend-items-to-item-segment-test.js +3 -3
- package/test/recommend-items-to-item-test.js +1 -1
- package/test/recommend-items-to-user-batch_test.js +7 -5
- package/test/recommend-items-to-user-callback_test.js +17 -4
- package/test/recommend-items-to-user-test.js +10 -1
- package/test/recommend-next-items-batch_test.js +6 -6
- package/test/recommend-next-items-callback_test.js +6 -6
- package/test/recommend-next-items-test.js +3 -3
- package/test/recommend-users-to-item-batch_test.js +7 -5
- package/test/recommend-users-to-item-callback_test.js +17 -4
- package/test/recommend-users-to-item-test.js +10 -1
- package/test/recommend-users-to-user-batch_test.js +7 -5
- package/test/recommend-users-to-user-callback_test.js +17 -4
- package/test/recommend-users-to-user-test.js +10 -1
- package/test/remove-from-series-batch_test.js +3 -3
- package/test/remove-from-series-callback_test.js +5 -5
- package/test/remove-from-series-test.js +3 -3
- package/test/search-item-segments-batch_test.js +2 -2
- package/test/search-item-segments-callback_test.js +4 -4
- package/test/search-item-segments-test.js +3 -3
- package/test/search-items-batch_test.js +7 -7
- package/test/search-items-callback_test.js +7 -7
- package/test/search-items-test.js +4 -4
- package/test/set-item-values-batch_test.js +7 -7
- package/test/set-item-values-callback_test.js +9 -9
- package/test/set-item-values-test.js +3 -3
- package/test/set-user-values-batch_test.js +7 -7
- package/test/set-user-values-callback_test.js +9 -9
- package/test/set-user-values-test.js +3 -3
- package/test/set-view-portion-batch_test.js +7 -7
- package/test/set-view-portion-callback_test.js +15 -15
- package/test/set-view-portion-test.js +9 -9
- package/test/update-auto-reql-segmentation-batch_test.js +3 -3
- package/test/update-auto-reql-segmentation-callback_test.js +3 -3
- package/test/update-auto-reql-segmentation-test.js +1 -1
- package/test/update-manual-reql-segment-batch_test.js +4 -4
- package/test/update-manual-reql-segment-callback_test.js +4 -4
- package/test/update-manual-reql-segment-test.js +1 -1
- package/test/update-manual-reql-segmentation-batch_test.js +3 -3
- package/test/update-manual-reql-segmentation-callback_test.js +3 -3
- package/test/update-manual-reql-segmentation-test.js +1 -1
- package/test/update-more-items-batch_test.js +4 -4
- package/test/update-more-items-callback_test.js +4 -4
- package/test/update-more-items-test.js +3 -3
- package/test/update-property-based-segmentation-batch_test.js +3 -3
- package/test/update-property-based-segmentation-callback_test.js +3 -3
- package/test/update-property-based-segmentation-test.js +1 -1
|
@@ -31,6 +31,9 @@ class AddDetailView extends rqs.Request {
|
|
|
31
31
|
* - *additionalData*
|
|
32
32
|
* - Type: object
|
|
33
33
|
* - Description: A dictionary of additional data for the interaction.
|
|
34
|
+
* - *autoPresented*
|
|
35
|
+
* - Type: boolean
|
|
36
|
+
* - Description: Indicates whether the item was automatically presented to the user (e.g., in a swiping feed) or explicitly requested by the user (e.g., by clicking on a link). Defaults to `false`.
|
|
34
37
|
*/
|
|
35
38
|
constructor(userId, itemId, optional) {
|
|
36
39
|
super('POST', '/detailviews/', 3000, false);
|
|
@@ -42,6 +45,7 @@ class AddDetailView extends rqs.Request {
|
|
|
42
45
|
this.cascadeCreate = optional.cascadeCreate;
|
|
43
46
|
this.recommId = optional.recommId;
|
|
44
47
|
this.additionalData = optional.additionalData;
|
|
48
|
+
this.autoPresented = optional.autoPresented;
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
/**
|
|
@@ -68,6 +72,9 @@ class AddDetailView extends rqs.Request {
|
|
|
68
72
|
if(this.additionalData !== undefined)
|
|
69
73
|
params.additionalData = this.additionalData;
|
|
70
74
|
|
|
75
|
+
if(this.autoPresented !== undefined)
|
|
76
|
+
params.autoPresented = this.autoPresented;
|
|
77
|
+
|
|
71
78
|
return params;
|
|
72
79
|
}
|
|
73
80
|
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This file is auto-generated, do not edit
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
'use strict';
|
|
6
|
+
const rqs = require("./request");
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Composite Recommendation returns both a *source entity* (e.g., an Item or [Item Segment](https://docs.recombee.com/segmentations.html)) and a list of related recommendations in a single response.
|
|
10
|
+
* It is ideal for use cases such as personalized homepage sections (*Articles from <category>*), *Because You Watched <movie>*, or *Artists Related to Your Favorite Artist <artist>*.
|
|
11
|
+
* See detailed **examples and configuration guidance** in the [Composite Scenarios documentation](https://docs.recombee.com/scenarios#composite-recommendations).
|
|
12
|
+
* **Structure**
|
|
13
|
+
* The endpoint operates in two stages:
|
|
14
|
+
* 1. Recommends the *source* (e.g., an Item Segment or item) to the user.
|
|
15
|
+
* 2. Recommends *results* (items or Item Segments) related to that *source*.
|
|
16
|
+
* For example, *Articles from <category>* can be decomposed into:
|
|
17
|
+
* - [Recommend Item Segments To User](https://docs.recombee.com/api#recommend-item-segments-to-user) to find the category.
|
|
18
|
+
* - [Recommend Items To Item Segment](https://docs.recombee.com/api#recommend-items-to-item-segment) to recommend articles from that category.
|
|
19
|
+
* Since the first step uses [Recommend Item Segments To User](https://docs.recombee.com/api#recommend-items-to-user), you must include the `userId` parameter in the *Composite Recommendation* request.
|
|
20
|
+
* Each *Composite Recommendation* counts as a single recommendation API request for billing.
|
|
21
|
+
* **Stage-specific Parameters**
|
|
22
|
+
* Additional parameters can be supplied via [sourceSettings](https://docs.recombee.com/api#composite-recommendation-param-sourceSettings) and [resultSettings](https://docs.recombee.com/api#composite-recommendation-param-resultSettings).
|
|
23
|
+
* In the example above:
|
|
24
|
+
* - `sourceSettings` may include any parameter valid for [Recommend Item Segments To User](https://docs.recombee.com/api#recommend-items-to-user) (e.g., `filter`, `booster`).
|
|
25
|
+
* - `resultSettings` may include any parameter valid for [Recommend Items To Item Segment](https://docs.recombee.com/api#recommend-items-to-item-segment).
|
|
26
|
+
* See [this example](https://docs.recombee.com/api#composite-recommendation-example-setting-parameters-for-individual-stages) for more details.
|
|
27
|
+
*/
|
|
28
|
+
class CompositeRecommendation extends rqs.Request {
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Construct the request
|
|
32
|
+
* @param {string} scenario - Scenario defines a particular application of recommendations. It can be, for example, "homepage", "cart", or "emailing".
|
|
33
|
+
* You can set various settings to the [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs.
|
|
34
|
+
* The AI that optimizes models to get the best results may optimize different scenarios separately or even use different models in each of the scenarios.
|
|
35
|
+
* @param {number} count - Number of items to be recommended (N for the top-N recommendation).
|
|
36
|
+
* @param {Object} optional - Optional parameters given as an object with structure name of the parameter: value
|
|
37
|
+
* - Allowed parameters:
|
|
38
|
+
* - *itemId*
|
|
39
|
+
* - Type: string
|
|
40
|
+
* - Description: ID of the item for which the recommendations are to be generated.
|
|
41
|
+
* - *userId*
|
|
42
|
+
* - Type: string
|
|
43
|
+
* - Description: ID of the user for which the recommendations are to be generated.
|
|
44
|
+
* - *logic*
|
|
45
|
+
* - Type: string | object
|
|
46
|
+
* - Description: Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case.
|
|
47
|
+
* See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.
|
|
48
|
+
* The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
|
|
49
|
+
* Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
|
|
50
|
+
* - *segmentId*
|
|
51
|
+
* - Type: string
|
|
52
|
+
* - Description: ID of the segment from `contextSegmentationId` for which the recommendations are to be generated.
|
|
53
|
+
* - *cascadeCreate*
|
|
54
|
+
* - Type: boolean
|
|
55
|
+
* - Description: If the entity for the source recommendation does not exist in the database, returns a list of non-personalized recommendations and creates the user in the database. This allows, for example, rotations in the following recommendations for that entity, as the entity will be already known to the system.
|
|
56
|
+
* - *sourceSettings*
|
|
57
|
+
* - Type: object
|
|
58
|
+
* - Description: Parameters applied for recommending the *Source* stage. The accepted parameters correspond with the recommendation sub-endpoint used to recommend the *Source*.
|
|
59
|
+
* - *resultSettings*
|
|
60
|
+
* - Type: object
|
|
61
|
+
* - Description: Parameters applied for recommending the *Result* stage. The accepted parameters correspond with the recommendation sub-endpoint used to recommend the *Result*.
|
|
62
|
+
* - *expertSettings*
|
|
63
|
+
* - Type: object
|
|
64
|
+
* - Description: Dictionary of custom options.
|
|
65
|
+
*/
|
|
66
|
+
constructor(scenario, count, optional) {
|
|
67
|
+
super('POST', '/recomms/composite/', 3000, false);
|
|
68
|
+
this.scenario = scenario;
|
|
69
|
+
this.count = count;
|
|
70
|
+
optional = optional || {};
|
|
71
|
+
this.itemId = optional.itemId;
|
|
72
|
+
this.userId = optional.userId;
|
|
73
|
+
this.logic = optional.logic;
|
|
74
|
+
this.segmentId = optional.segmentId;
|
|
75
|
+
this.cascadeCreate = optional.cascadeCreate;
|
|
76
|
+
this.sourceSettings = optional.sourceSettings;
|
|
77
|
+
this.resultSettings = optional.resultSettings;
|
|
78
|
+
this.expertSettings = optional.expertSettings;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Get body parameters
|
|
83
|
+
* @return {Object} The values of body parameters (name of parameter: value of the parameter)
|
|
84
|
+
*/
|
|
85
|
+
bodyParameters() {
|
|
86
|
+
let params = {};
|
|
87
|
+
params.scenario = this.scenario;
|
|
88
|
+
params.count = this.count;
|
|
89
|
+
|
|
90
|
+
if(this.itemId !== undefined)
|
|
91
|
+
params.itemId = this.itemId;
|
|
92
|
+
|
|
93
|
+
if(this.userId !== undefined)
|
|
94
|
+
params.userId = this.userId;
|
|
95
|
+
|
|
96
|
+
if(this.logic !== undefined)
|
|
97
|
+
params.logic = this.logic;
|
|
98
|
+
|
|
99
|
+
if(this.segmentId !== undefined)
|
|
100
|
+
params.segmentId = this.segmentId;
|
|
101
|
+
|
|
102
|
+
if(this.cascadeCreate !== undefined)
|
|
103
|
+
params.cascadeCreate = this.cascadeCreate;
|
|
104
|
+
|
|
105
|
+
if(this.sourceSettings !== undefined)
|
|
106
|
+
params.sourceSettings = this.sourceSettings;
|
|
107
|
+
|
|
108
|
+
if(this.resultSettings !== undefined)
|
|
109
|
+
params.resultSettings = this.resultSettings;
|
|
110
|
+
|
|
111
|
+
if(this.expertSettings !== undefined)
|
|
112
|
+
params.expertSettings = this.expertSettings;
|
|
113
|
+
|
|
114
|
+
return params;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Get query parameters
|
|
119
|
+
* @return {Object} The values of query parameters (name of parameter: value of the parameter)
|
|
120
|
+
*/
|
|
121
|
+
queryParameters() {
|
|
122
|
+
let params = {};
|
|
123
|
+
return params;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
exports.CompositeRecommendation = CompositeRecommendation
|
package/lib/requests/index.js
CHANGED
|
@@ -63,6 +63,7 @@ exports.RecommendUsersToItem = require("./recommend-users-to-item").RecommendUse
|
|
|
63
63
|
exports.RecommendItemSegmentsToUser = require("./recommend-item-segments-to-user").RecommendItemSegmentsToUser;
|
|
64
64
|
exports.RecommendItemSegmentsToItem = require("./recommend-item-segments-to-item").RecommendItemSegmentsToItem;
|
|
65
65
|
exports.RecommendItemSegmentsToItemSegment = require("./recommend-item-segments-to-item-segment").RecommendItemSegmentsToItemSegment;
|
|
66
|
+
exports.CompositeRecommendation = require("./composite-recommendation").CompositeRecommendation;
|
|
66
67
|
exports.SearchItems = require("./search-items").SearchItems;
|
|
67
68
|
exports.SearchItemSegments = require("./search-item-segments").SearchItemSegments;
|
|
68
69
|
exports.AddSearchSynonym = require("./add-search-synonym").AddSearchSynonym;
|
|
@@ -62,6 +62,41 @@ class RecommendItemSegmentsToItemSegment extends rqs.Request {
|
|
|
62
62
|
* - *returnAbGroup*
|
|
63
63
|
* - Type: boolean
|
|
64
64
|
* - Description: If there is a custom AB-testing running, return the name of the group to which the request belongs.
|
|
65
|
+
* - *reqlExpressions*
|
|
66
|
+
* - Type: object
|
|
67
|
+
* - Description: A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
|
|
68
|
+
* This can be used to compute additional properties of the recommended Item Segments.
|
|
69
|
+
* The keys are the names of the expressions, and the values are the actual ReQL expressions.
|
|
70
|
+
* Example request:
|
|
71
|
+
* ```json
|
|
72
|
+
* {
|
|
73
|
+
* "reqlExpressions": {
|
|
74
|
+
* "countItems": "size(segment_items(\"categories\", 'segmentId'))"
|
|
75
|
+
* }
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
* Example response:
|
|
79
|
+
* ```json
|
|
80
|
+
* {
|
|
81
|
+
* "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
|
|
82
|
+
* "recomms":
|
|
83
|
+
* [
|
|
84
|
+
* {
|
|
85
|
+
* "id": "category-fantasy-books",
|
|
86
|
+
* "reqlEvaluations": {
|
|
87
|
+
* "countItems": 486
|
|
88
|
+
* }
|
|
89
|
+
* },
|
|
90
|
+
* {
|
|
91
|
+
* "id": "category-sci-fi-costumes",
|
|
92
|
+
* "reqlEvaluations": {
|
|
93
|
+
* "countItems": 19
|
|
94
|
+
* }
|
|
95
|
+
* }
|
|
96
|
+
* ],
|
|
97
|
+
* "numberNextRecommsCalls": 0
|
|
98
|
+
* }
|
|
99
|
+
* ```
|
|
65
100
|
*/
|
|
66
101
|
constructor(contextSegmentId, targetUserId, count, optional) {
|
|
67
102
|
super('POST', '/recomms/item-segments/item-segments/', 3000, false);
|
|
@@ -76,6 +111,7 @@ class RecommendItemSegmentsToItemSegment extends rqs.Request {
|
|
|
76
111
|
this.logic = optional.logic;
|
|
77
112
|
this.expertSettings = optional.expertSettings;
|
|
78
113
|
this.returnAbGroup = optional.returnAbGroup;
|
|
114
|
+
this.reqlExpressions = optional.reqlExpressions;
|
|
79
115
|
}
|
|
80
116
|
|
|
81
117
|
/**
|
|
@@ -109,6 +145,9 @@ class RecommendItemSegmentsToItemSegment extends rqs.Request {
|
|
|
109
145
|
if(this.returnAbGroup !== undefined)
|
|
110
146
|
params.returnAbGroup = this.returnAbGroup;
|
|
111
147
|
|
|
148
|
+
if(this.reqlExpressions !== undefined)
|
|
149
|
+
params.reqlExpressions = this.reqlExpressions;
|
|
150
|
+
|
|
112
151
|
return params;
|
|
113
152
|
}
|
|
114
153
|
|
|
@@ -63,6 +63,41 @@ class RecommendItemSegmentsToItem extends rqs.Request {
|
|
|
63
63
|
* - *returnAbGroup*
|
|
64
64
|
* - Type: boolean
|
|
65
65
|
* - Description: If there is a custom AB-testing running, return the name of the group to which the request belongs.
|
|
66
|
+
* - *reqlExpressions*
|
|
67
|
+
* - Type: object
|
|
68
|
+
* - Description: A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
|
|
69
|
+
* This can be used to compute additional properties of the recommended Item Segments.
|
|
70
|
+
* The keys are the names of the expressions, and the values are the actual ReQL expressions.
|
|
71
|
+
* Example request:
|
|
72
|
+
* ```json
|
|
73
|
+
* {
|
|
74
|
+
* "reqlExpressions": {
|
|
75
|
+
* "countItems": "size(segment_items(\"categories\", 'segmentId'))"
|
|
76
|
+
* }
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
* Example response:
|
|
80
|
+
* ```json
|
|
81
|
+
* {
|
|
82
|
+
* "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
|
|
83
|
+
* "recomms":
|
|
84
|
+
* [
|
|
85
|
+
* {
|
|
86
|
+
* "id": "category-fantasy-books",
|
|
87
|
+
* "reqlEvaluations": {
|
|
88
|
+
* "countItems": 486
|
|
89
|
+
* }
|
|
90
|
+
* },
|
|
91
|
+
* {
|
|
92
|
+
* "id": "category-sci-fi-costumes",
|
|
93
|
+
* "reqlEvaluations": {
|
|
94
|
+
* "countItems": 19
|
|
95
|
+
* }
|
|
96
|
+
* }
|
|
97
|
+
* ],
|
|
98
|
+
* "numberNextRecommsCalls": 0
|
|
99
|
+
* }
|
|
100
|
+
* ```
|
|
66
101
|
*/
|
|
67
102
|
constructor(itemId, targetUserId, count, optional) {
|
|
68
103
|
super('POST', `/recomms/items/${itemId}/item-segments/`, 3000, false);
|
|
@@ -77,6 +112,7 @@ class RecommendItemSegmentsToItem extends rqs.Request {
|
|
|
77
112
|
this.logic = optional.logic;
|
|
78
113
|
this.expertSettings = optional.expertSettings;
|
|
79
114
|
this.returnAbGroup = optional.returnAbGroup;
|
|
115
|
+
this.reqlExpressions = optional.reqlExpressions;
|
|
80
116
|
}
|
|
81
117
|
|
|
82
118
|
/**
|
|
@@ -109,6 +145,9 @@ class RecommendItemSegmentsToItem extends rqs.Request {
|
|
|
109
145
|
if(this.returnAbGroup !== undefined)
|
|
110
146
|
params.returnAbGroup = this.returnAbGroup;
|
|
111
147
|
|
|
148
|
+
if(this.reqlExpressions !== undefined)
|
|
149
|
+
params.reqlExpressions = this.reqlExpressions;
|
|
150
|
+
|
|
112
151
|
return params;
|
|
113
152
|
}
|
|
114
153
|
|
|
@@ -50,6 +50,41 @@ class RecommendItemSegmentsToUser extends rqs.Request {
|
|
|
50
50
|
* - *returnAbGroup*
|
|
51
51
|
* - Type: boolean
|
|
52
52
|
* - Description: If there is a custom AB-testing running, return the name of the group to which the request belongs.
|
|
53
|
+
* - *reqlExpressions*
|
|
54
|
+
* - Type: object
|
|
55
|
+
* - Description: A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
|
|
56
|
+
* This can be used to compute additional properties of the recommended Item Segments.
|
|
57
|
+
* The keys are the names of the expressions, and the values are the actual ReQL expressions.
|
|
58
|
+
* Example request:
|
|
59
|
+
* ```json
|
|
60
|
+
* {
|
|
61
|
+
* "reqlExpressions": {
|
|
62
|
+
* "countItems": "size(segment_items(\"categories\", 'segmentId'))"
|
|
63
|
+
* }
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
* Example response:
|
|
67
|
+
* ```json
|
|
68
|
+
* {
|
|
69
|
+
* "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
|
|
70
|
+
* "recomms":
|
|
71
|
+
* [
|
|
72
|
+
* {
|
|
73
|
+
* "id": "category-fantasy-books",
|
|
74
|
+
* "reqlEvaluations": {
|
|
75
|
+
* "countItems": 486
|
|
76
|
+
* }
|
|
77
|
+
* },
|
|
78
|
+
* {
|
|
79
|
+
* "id": "category-sci-fi-costumes",
|
|
80
|
+
* "reqlEvaluations": {
|
|
81
|
+
* "countItems": 19
|
|
82
|
+
* }
|
|
83
|
+
* }
|
|
84
|
+
* ],
|
|
85
|
+
* "numberNextRecommsCalls": 0
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
53
88
|
*/
|
|
54
89
|
constructor(userId, count, optional) {
|
|
55
90
|
super('POST', `/recomms/users/${userId}/item-segments/`, 3000, false);
|
|
@@ -63,6 +98,7 @@ class RecommendItemSegmentsToUser extends rqs.Request {
|
|
|
63
98
|
this.logic = optional.logic;
|
|
64
99
|
this.expertSettings = optional.expertSettings;
|
|
65
100
|
this.returnAbGroup = optional.returnAbGroup;
|
|
101
|
+
this.reqlExpressions = optional.reqlExpressions;
|
|
66
102
|
}
|
|
67
103
|
|
|
68
104
|
/**
|
|
@@ -94,6 +130,9 @@ class RecommendItemSegmentsToUser extends rqs.Request {
|
|
|
94
130
|
if(this.returnAbGroup !== undefined)
|
|
95
131
|
params.returnAbGroup = this.returnAbGroup;
|
|
96
132
|
|
|
133
|
+
if(this.reqlExpressions !== undefined)
|
|
134
|
+
params.reqlExpressions = this.reqlExpressions;
|
|
135
|
+
|
|
97
136
|
return params;
|
|
98
137
|
}
|
|
99
138
|
|
|
@@ -116,6 +116,44 @@ class RecommendItemsToItemSegment extends rqs.Request {
|
|
|
116
116
|
* See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.
|
|
117
117
|
* The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
|
|
118
118
|
* Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
|
|
119
|
+
* - *reqlExpressions*
|
|
120
|
+
* - Type: object
|
|
121
|
+
* - Description: A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended item.
|
|
122
|
+
* This can be used to compute additional properties of the recommended items that are not stored in the database.
|
|
123
|
+
* The keys are the names of the expressions, and the values are the actual ReQL expressions.
|
|
124
|
+
* Example request:
|
|
125
|
+
* ```json
|
|
126
|
+
* {
|
|
127
|
+
* "reqlExpressions": {
|
|
128
|
+
* "isInUsersCity": "context_user[\"city\"] in 'cities'",
|
|
129
|
+
* "distanceToUser": "earth_distance('location', context_user[\"location\"])"
|
|
130
|
+
* }
|
|
131
|
+
* }
|
|
132
|
+
* ```
|
|
133
|
+
* Example response:
|
|
134
|
+
* ```json
|
|
135
|
+
* {
|
|
136
|
+
* "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
|
|
137
|
+
* "recomms":
|
|
138
|
+
* [
|
|
139
|
+
* {
|
|
140
|
+
* "id": "restaurant-178",
|
|
141
|
+
* "reqlEvaluations": {
|
|
142
|
+
* "isInUsersCity": true,
|
|
143
|
+
* "distanceToUser": 5200.2
|
|
144
|
+
* }
|
|
145
|
+
* },
|
|
146
|
+
* {
|
|
147
|
+
* "id": "bar-42",
|
|
148
|
+
* "reqlEvaluations": {
|
|
149
|
+
* "isInUsersCity": false,
|
|
150
|
+
* "distanceToUser": 2516.0
|
|
151
|
+
* }
|
|
152
|
+
* }
|
|
153
|
+
* ],
|
|
154
|
+
* "numberNextRecommsCalls": 0
|
|
155
|
+
* }
|
|
156
|
+
* ```
|
|
119
157
|
* - *minRelevance*
|
|
120
158
|
* - Type: string
|
|
121
159
|
* - Description: **Expert option:** If the *targetUserId* is provided: Specifies the threshold of how relevant must the recommended items be to the user. Possible values one of: "low", "medium", "high". The default value is "low", meaning that the system attempts to recommend a number of items equal to *count* at any cost. If there is not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations being appended to reach the full *count*. This behavior may be suppressed by using "medium" or "high" values. In such case, the system only recommends items of at least the requested relevance and may return less than *count* items when there is not enough data to fulfill it.
|
|
@@ -145,6 +183,7 @@ class RecommendItemsToItemSegment extends rqs.Request {
|
|
|
145
183
|
this.filter = optional.filter;
|
|
146
184
|
this.booster = optional.booster;
|
|
147
185
|
this.logic = optional.logic;
|
|
186
|
+
this.reqlExpressions = optional.reqlExpressions;
|
|
148
187
|
this.minRelevance = optional.minRelevance;
|
|
149
188
|
this.rotationRate = optional.rotationRate;
|
|
150
189
|
this.rotationTime = optional.rotationTime;
|
|
@@ -183,6 +222,9 @@ class RecommendItemsToItemSegment extends rqs.Request {
|
|
|
183
222
|
if(this.logic !== undefined)
|
|
184
223
|
params.logic = this.logic;
|
|
185
224
|
|
|
225
|
+
if(this.reqlExpressions !== undefined)
|
|
226
|
+
params.reqlExpressions = this.reqlExpressions;
|
|
227
|
+
|
|
186
228
|
if(this.minRelevance !== undefined)
|
|
187
229
|
params.minRelevance = this.minRelevance;
|
|
188
230
|
|
|
@@ -114,6 +114,47 @@ class RecommendItemsToItem extends rqs.Request {
|
|
|
114
114
|
* See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.
|
|
115
115
|
* The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
|
|
116
116
|
* Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
|
|
117
|
+
* - *reqlExpressions*
|
|
118
|
+
* - Type: object
|
|
119
|
+
* - Description: A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended item.
|
|
120
|
+
* This can be used to compute additional properties of the recommended items that are not stored in the database.
|
|
121
|
+
* The keys are the names of the expressions, and the values are the actual ReQL expressions.
|
|
122
|
+
* Example request:
|
|
123
|
+
* ```json
|
|
124
|
+
* {
|
|
125
|
+
* "reqlExpressions": {
|
|
126
|
+
* "isInUsersCity": "context_user[\"city\"] in 'cities'",
|
|
127
|
+
* "distanceToUser": "earth_distance('location', context_user[\"location\"])",
|
|
128
|
+
* "isFromSameCompany": "'company' == context_item[\"company\"]"
|
|
129
|
+
* }
|
|
130
|
+
* }
|
|
131
|
+
* ```
|
|
132
|
+
* Example response:
|
|
133
|
+
* ```json
|
|
134
|
+
* {
|
|
135
|
+
* "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
|
|
136
|
+
* "recomms":
|
|
137
|
+
* [
|
|
138
|
+
* {
|
|
139
|
+
* "id": "restaurant-178",
|
|
140
|
+
* "reqlEvaluations": {
|
|
141
|
+
* "isInUsersCity": true,
|
|
142
|
+
* "distanceToUser": 5200.2,
|
|
143
|
+
* "isFromSameCompany": false
|
|
144
|
+
* }
|
|
145
|
+
* },
|
|
146
|
+
* {
|
|
147
|
+
* "id": "bar-42",
|
|
148
|
+
* "reqlEvaluations": {
|
|
149
|
+
* "isInUsersCity": false,
|
|
150
|
+
* "distanceToUser": 2516.0,
|
|
151
|
+
* "isFromSameCompany": true
|
|
152
|
+
* }
|
|
153
|
+
* }
|
|
154
|
+
* ],
|
|
155
|
+
* "numberNextRecommsCalls": 0
|
|
156
|
+
* }
|
|
157
|
+
* ```
|
|
117
158
|
* - *userImpact*
|
|
118
159
|
* - Type: number
|
|
119
160
|
* - Description: **Expert option:** If *targetUserId* parameter is present, the recommendations are biased towards the given user. Using *userImpact*, you may control this bias. For an extreme case of `userImpact=0.0`, the interactions made by the user are not taken into account at all (with the exception of history-based blacklisting), for `userImpact=1.0`, you'll get a user-based recommendation. The default value is `0`.
|
|
@@ -149,6 +190,7 @@ class RecommendItemsToItem extends rqs.Request {
|
|
|
149
190
|
this.filter = optional.filter;
|
|
150
191
|
this.booster = optional.booster;
|
|
151
192
|
this.logic = optional.logic;
|
|
193
|
+
this.reqlExpressions = optional.reqlExpressions;
|
|
152
194
|
this.userImpact = optional.userImpact;
|
|
153
195
|
this.diversity = optional.diversity;
|
|
154
196
|
this.minRelevance = optional.minRelevance;
|
|
@@ -188,6 +230,9 @@ class RecommendItemsToItem extends rqs.Request {
|
|
|
188
230
|
if(this.logic !== undefined)
|
|
189
231
|
params.logic = this.logic;
|
|
190
232
|
|
|
233
|
+
if(this.reqlExpressions !== undefined)
|
|
234
|
+
params.reqlExpressions = this.reqlExpressions;
|
|
235
|
+
|
|
191
236
|
if(this.userImpact !== undefined)
|
|
192
237
|
params.userImpact = this.userImpact;
|
|
193
238
|
|
|
@@ -102,6 +102,44 @@ class RecommendItemsToUser extends rqs.Request {
|
|
|
102
102
|
* See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.
|
|
103
103
|
* The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
|
|
104
104
|
* Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
|
|
105
|
+
* - *reqlExpressions*
|
|
106
|
+
* - Type: object
|
|
107
|
+
* - Description: A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended item.
|
|
108
|
+
* This can be used to compute additional properties of the recommended items that are not stored in the database.
|
|
109
|
+
* The keys are the names of the expressions, and the values are the actual ReQL expressions.
|
|
110
|
+
* Example request:
|
|
111
|
+
* ```json
|
|
112
|
+
* {
|
|
113
|
+
* "reqlExpressions": {
|
|
114
|
+
* "isInUsersCity": "context_user[\"city\"] in 'cities'",
|
|
115
|
+
* "distanceToUser": "earth_distance('location', context_user[\"location\"])"
|
|
116
|
+
* }
|
|
117
|
+
* }
|
|
118
|
+
* ```
|
|
119
|
+
* Example response:
|
|
120
|
+
* ```json
|
|
121
|
+
* {
|
|
122
|
+
* "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
|
|
123
|
+
* "recomms":
|
|
124
|
+
* [
|
|
125
|
+
* {
|
|
126
|
+
* "id": "restaurant-178",
|
|
127
|
+
* "reqlEvaluations": {
|
|
128
|
+
* "isInUsersCity": true,
|
|
129
|
+
* "distanceToUser": 5200.2
|
|
130
|
+
* }
|
|
131
|
+
* },
|
|
132
|
+
* {
|
|
133
|
+
* "id": "bar-42",
|
|
134
|
+
* "reqlEvaluations": {
|
|
135
|
+
* "isInUsersCity": false,
|
|
136
|
+
* "distanceToUser": 2516.0
|
|
137
|
+
* }
|
|
138
|
+
* }
|
|
139
|
+
* ],
|
|
140
|
+
* "numberNextRecommsCalls": 0
|
|
141
|
+
* }
|
|
142
|
+
* ```
|
|
105
143
|
* - *diversity*
|
|
106
144
|
* - Type: number
|
|
107
145
|
* - Description: **Expert option:** Real number from [0.0, 1.0], which determines how mutually dissimilar the recommended items should be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification.
|
|
@@ -133,6 +171,7 @@ class RecommendItemsToUser extends rqs.Request {
|
|
|
133
171
|
this.filter = optional.filter;
|
|
134
172
|
this.booster = optional.booster;
|
|
135
173
|
this.logic = optional.logic;
|
|
174
|
+
this.reqlExpressions = optional.reqlExpressions;
|
|
136
175
|
this.diversity = optional.diversity;
|
|
137
176
|
this.minRelevance = optional.minRelevance;
|
|
138
177
|
this.rotationRate = optional.rotationRate;
|
|
@@ -170,6 +209,9 @@ class RecommendItemsToUser extends rqs.Request {
|
|
|
170
209
|
if(this.logic !== undefined)
|
|
171
210
|
params.logic = this.logic;
|
|
172
211
|
|
|
212
|
+
if(this.reqlExpressions !== undefined)
|
|
213
|
+
params.reqlExpressions = this.reqlExpressions;
|
|
214
|
+
|
|
173
215
|
if(this.diversity !== undefined)
|
|
174
216
|
params.diversity = this.diversity;
|
|
175
217
|
|
|
@@ -92,6 +92,47 @@ class RecommendUsersToItem extends rqs.Request {
|
|
|
92
92
|
* See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.
|
|
93
93
|
* The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
|
|
94
94
|
* Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
|
|
95
|
+
* - *reqlExpressions*
|
|
96
|
+
* - Type: object
|
|
97
|
+
* - Description: A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended user.
|
|
98
|
+
* This can be used to compute additional properties of the recommended users that are not stored in the database.
|
|
99
|
+
* The keys are the names of the expressions, and the values are the actual ReQL expressions.
|
|
100
|
+
* Example request:
|
|
101
|
+
* ```json
|
|
102
|
+
* {
|
|
103
|
+
* "reqlExpressions": {
|
|
104
|
+
* "isInUsersCity": "context_user[\"city\"] in 'cities'",
|
|
105
|
+
* "distanceToUser": "earth_distance('location', context_user[\"location\"])",
|
|
106
|
+
* "isFromSameCompany": "'company' == context_item[\"company\"]"
|
|
107
|
+
* }
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
110
|
+
* Example response:
|
|
111
|
+
* ```json
|
|
112
|
+
* {
|
|
113
|
+
* "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
|
|
114
|
+
* "recomms":
|
|
115
|
+
* [
|
|
116
|
+
* {
|
|
117
|
+
* "id": "restaurant-178",
|
|
118
|
+
* "reqlEvaluations": {
|
|
119
|
+
* "isInUsersCity": true,
|
|
120
|
+
* "distanceToUser": 5200.2,
|
|
121
|
+
* "isFromSameCompany": false
|
|
122
|
+
* }
|
|
123
|
+
* },
|
|
124
|
+
* {
|
|
125
|
+
* "id": "bar-42",
|
|
126
|
+
* "reqlEvaluations": {
|
|
127
|
+
* "isInUsersCity": false,
|
|
128
|
+
* "distanceToUser": 2516.0,
|
|
129
|
+
* "isFromSameCompany": true
|
|
130
|
+
* }
|
|
131
|
+
* }
|
|
132
|
+
* ],
|
|
133
|
+
* "numberNextRecommsCalls": 0
|
|
134
|
+
* }
|
|
135
|
+
* ```
|
|
95
136
|
* - *diversity*
|
|
96
137
|
* - Type: number
|
|
97
138
|
* - Description: **Expert option:** Real number from [0.0, 1.0], which determines how mutually dissimilar the recommended users should be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification.
|
|
@@ -114,6 +155,7 @@ class RecommendUsersToItem extends rqs.Request {
|
|
|
114
155
|
this.filter = optional.filter;
|
|
115
156
|
this.booster = optional.booster;
|
|
116
157
|
this.logic = optional.logic;
|
|
158
|
+
this.reqlExpressions = optional.reqlExpressions;
|
|
117
159
|
this.diversity = optional.diversity;
|
|
118
160
|
this.expertSettings = optional.expertSettings;
|
|
119
161
|
this.returnAbGroup = optional.returnAbGroup;
|
|
@@ -148,6 +190,9 @@ class RecommendUsersToItem extends rqs.Request {
|
|
|
148
190
|
if(this.logic !== undefined)
|
|
149
191
|
params.logic = this.logic;
|
|
150
192
|
|
|
193
|
+
if(this.reqlExpressions !== undefined)
|
|
194
|
+
params.reqlExpressions = this.reqlExpressions;
|
|
195
|
+
|
|
151
196
|
if(this.diversity !== undefined)
|
|
152
197
|
params.diversity = this.diversity;
|
|
153
198
|
|
|
@@ -92,6 +92,44 @@ class RecommendUsersToUser extends rqs.Request {
|
|
|
92
92
|
* See [this section](https://docs.recombee.com/recommendation_logics) for a list of available logics and other details.
|
|
93
93
|
* The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
|
|
94
94
|
* Logic can also be set to a [scenario](https://docs.recombee.com/scenarios) in the [Admin UI](https://admin.recombee.com).
|
|
95
|
+
* - *reqlExpressions*
|
|
96
|
+
* - Type: object
|
|
97
|
+
* - Description: A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended user.
|
|
98
|
+
* This can be used to compute additional properties of the recommended users that are not stored in the database.
|
|
99
|
+
* The keys are the names of the expressions, and the values are the actual ReQL expressions.
|
|
100
|
+
* Example request:
|
|
101
|
+
* ```json
|
|
102
|
+
* {
|
|
103
|
+
* "reqlExpressions": {
|
|
104
|
+
* "isInUsersCity": "context_user[\"city\"] in 'cities'",
|
|
105
|
+
* "distanceToUser": "earth_distance('location', context_user[\"location\"])"
|
|
106
|
+
* }
|
|
107
|
+
* }
|
|
108
|
+
* ```
|
|
109
|
+
* Example response:
|
|
110
|
+
* ```json
|
|
111
|
+
* {
|
|
112
|
+
* "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
|
|
113
|
+
* "recomms":
|
|
114
|
+
* [
|
|
115
|
+
* {
|
|
116
|
+
* "id": "restaurant-178",
|
|
117
|
+
* "reqlEvaluations": {
|
|
118
|
+
* "isInUsersCity": true,
|
|
119
|
+
* "distanceToUser": 5200.2
|
|
120
|
+
* }
|
|
121
|
+
* },
|
|
122
|
+
* {
|
|
123
|
+
* "id": "bar-42",
|
|
124
|
+
* "reqlEvaluations": {
|
|
125
|
+
* "isInUsersCity": false,
|
|
126
|
+
* "distanceToUser": 2516.0
|
|
127
|
+
* }
|
|
128
|
+
* }
|
|
129
|
+
* ],
|
|
130
|
+
* "numberNextRecommsCalls": 0
|
|
131
|
+
* }
|
|
132
|
+
* ```
|
|
95
133
|
* - *diversity*
|
|
96
134
|
* - Type: number
|
|
97
135
|
* - Description: **Expert option:** Real number from [0.0, 1.0], which determines how mutually dissimilar the recommended users should be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification.
|
|
@@ -123,6 +161,7 @@ class RecommendUsersToUser extends rqs.Request {
|
|
|
123
161
|
this.filter = optional.filter;
|
|
124
162
|
this.booster = optional.booster;
|
|
125
163
|
this.logic = optional.logic;
|
|
164
|
+
this.reqlExpressions = optional.reqlExpressions;
|
|
126
165
|
this.diversity = optional.diversity;
|
|
127
166
|
this.minRelevance = optional.minRelevance;
|
|
128
167
|
this.rotationRate = optional.rotationRate;
|
|
@@ -160,6 +199,9 @@ class RecommendUsersToUser extends rqs.Request {
|
|
|
160
199
|
if(this.logic !== undefined)
|
|
161
200
|
params.logic = this.logic;
|
|
162
201
|
|
|
202
|
+
if(this.reqlExpressions !== undefined)
|
|
203
|
+
params.reqlExpressions = this.reqlExpressions;
|
|
204
|
+
|
|
163
205
|
if(this.diversity !== undefined)
|
|
164
206
|
params.diversity = this.diversity;
|
|
165
207
|
|