Skip to content

Commit 60dfb42

Browse files
committed
Support image and imageList item property types
1 parent 896aada commit 60dfb42

12 files changed

+17
-22
lines changed

README.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,17 @@ Using property values
8383
client.send(ResetDatabase())
8484
8585
# We will use computers as items in this example
86-
# Computers have three properties
86+
# Computers have four properties
8787
# - price (floating point number)
8888
# - number of processor cores (integer number)
8989
# - description (string)
90+
# - image (url of computer's photo)
9091
9192
# Add properties of items
9293
client.send(AddItemProperty('price', 'double'))
9394
client.send(AddItemProperty('num-cores', 'int'))
9495
client.send(AddItemProperty('description', 'string'))
96+
client.send(AddItemProperty('image', 'image'))
9597
9698
# Prepare requests for setting a catalog of computers
9799
requests = [SetItemValues(
@@ -101,6 +103,7 @@ Using property values
101103
'price': random.uniform(500, 2000),
102104
'num-cores': random.randrange(1,9),
103105
'description': 'Great computer',
106+
'image': 'http://examplesite.com/products/computer-%s.jpg' % i
104107
},
105108
cascade_create=True # Use cascadeCreate for creating item
106109
# with given itemId if it doesn't exist

recombee_api_client/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def send(self, request):
6363

6464
@staticmethod
6565
def __get_http_headers(additional_headers=None):
66-
headers = {'User-Agent': 'recombee-python-api-client/2.0.0'}
66+
headers = {'User-Agent': 'recombee-python-api-client/2.1.0'}
6767
if additional_headers:
6868
headers.update(additional_headers)
6969
return headers

recombee_api_client/api_requests/add_item_property.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def __init__(self, property_name, type):
1515
@param property_name: Name of the item property to be created. Currently, the following names are reserved:`id`, `itemid`, case insensitively. Also, the length of the property name must not exceed 63 characters.
1616
1717
18-
@param type: Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`
18+
@param type: Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`, `image` or `imageList`.
1919
2020
2121
"""

recombee_api_client/api_requests/delete_view_portion.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
class DeleteViewPortion(Request):
77
"""
8-
The view portions feature is currently experimental.
9-
108
Deletes an existing view portion specified by (`userId`, `itemId`, `sessionId`) from the database.
119
1210
"""

recombee_api_client/api_requests/item_based_recommendation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ def __init__(self, item_id, count, target_user_id=DEFAULT, user_impact=DEFAULT,
129129
@param min_relevance: **Expert option** If the *targetUserId* is provided: Specifies the threshold of how much 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 number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be 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 qualit, and may return less than *count* items when there is not enough data to fulfill it.
130130
131131
132-
@param rotation_rate: **Expert option** If the *targetUserId* is provided: If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items.
132+
@param rotation_rate: **Expert option** If the *targetUserId* is provided: If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0.01`.
133133
134134
135-
@param rotation_time: **Expert option** If the *targetUserId* is provided: Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized.
135+
@param rotation_time: **Expert option** If the *targetUserId* is provided: Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`.
136136
137137
138138
@param expert_settings: Dictionary of custom options.

recombee_api_client/api_requests/list_item_view_portions.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
class ListItemViewPortions(Request):
77
"""
8-
The view portions feature is currently experimental.
9-
108
List all the view portions of an item ever submitted by different users.
119
1210
"""

recombee_api_client/api_requests/list_user_view_portions.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
class ListUserViewPortions(Request):
77
"""
8-
The view portions feature is currently experimental.
9-
108
List all the view portions ever submitted by a given user.
119
1210
"""

recombee_api_client/api_requests/merge_users.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ class MergeUsers(Request):
1515
def __init__(self, target_user_id, source_user_id, cascade_create=DEFAULT):
1616
"""
1717
Required parameters:
18-
@param target_user_id: ID of the source user.
18+
@param target_user_id: ID of the targer user.
1919
20-
@param source_user_id: ID of the target user.
20+
@param source_user_id: ID of the source user.
2121
2222
2323
Optional parameters:

recombee_api_client/api_requests/recommend_items_to_user.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ def __init__(self, user_id, count, filter=DEFAULT, booster=DEFAULT, cascade_crea
132132
@param min_relevance: **Expert option** Specifies the threshold of how much 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 number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be 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 relevancy, and may return less than *count* items when there is not enough data to fulfill it.
133133
134134
135-
@param rotation_rate: **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items.
135+
@param rotation_rate: **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0.1`.
136136
137137
138-
@param rotation_time: **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized.
138+
@param rotation_time: **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`.
139139
140140
141141
@param expert_settings: Dictionary of custom options.

recombee_api_client/api_requests/set_view_portion.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
class SetViewPortion(Request):
77
"""
8-
The view portions feature is currently experimental.
9-
108
Sets viewed portion of an item (for example a video or article) by a user (at a session).
119
If you send new request with the same (`userId`, `itemId`, `sessionId`), the portion gets updated.
1210
@@ -19,11 +17,11 @@ def __init__(self, user_id, item_id, portion, session_id=DEFAULT, timestamp=DEFA
1917
2018
@param item_id: Viewed item
2119
22-
@param portion: Viewed portion of the item (number between 0.0 (viewed nothing) and 1.0 (viewed full item) ).
20+
@param portion: Viewed portion of the item (number between 0.0 (viewed nothing) and 1.0 (viewed full item) ). It should be the really viewed part of the item, no matter seeking, so for example if the user seeked immediately to half of the item and then viewed 10% of the item, the `portion` should still be `0.1`.
2321
2422
2523
Optional parameters:
26-
@param session_id: Id of session in which the user viewed the item
24+
@param session_id: ID of session in which the user viewed the item. Default is `null` (`None`, `nil`, `NULL` etc. depending on language).
2725
2826
@param timestamp: UTC timestamp of the rating as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
2927

0 commit comments

Comments
 (0)