-
Notifications
You must be signed in to change notification settings - Fork 5k
/
Personalizer.json
391 lines (391 loc) · 11.7 KB
/
Personalizer.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
{
"swagger": "2.0",
"info": {
"version": "v1.0",
"title": "Personalizer Client",
"description": "Personalizer Service is an Azure Cognitive Service that makes it easy to target content and experiences without complex pre-analysis or cleanup of past data. Given a context and featurized content, the Personalizer Service returns your content in a ranked list. As rewards are sent in response to the ranked list, the reinforcement learning algorithm will improve the model and improve performance of future rank calls."
},
"basePath": "/personalizer/v1.0",
"paths": {
"/events/{eventId}/reward": {
"post": {
"tags": [
"Events"
],
"summary": "Report reward to allocate to the top ranked action for the specified event.",
"operationId": "Events_Reward",
"consumes": [
"application/json"
],
"produces": [],
"parameters": [
{
"name": "eventId",
"in": "path",
"description": "The event id this reward applies to.",
"required": true,
"type": "string",
"maxLength": 256
},
{
"name": "reward",
"in": "body",
"description": "The reward should be a floating point number.",
"required": true,
"schema": {
"$ref": "#/definitions/RewardRequest"
}
}
],
"responses": {
"204": {
"description": "Success"
},
"default": {
"description": "Invalid reward request.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
},
"x-ms-examples": {
"Successful Events_Reward request": {
"$ref": "./examples/Events_Reward.json"
}
}
}
},
"/events/{eventId}/activate": {
"post": {
"tags": [
"Events"
],
"summary": "Report that the specified event was actually displayed to the user and a reward should be expected for it.",
"operationId": "Events_Activate",
"consumes": [],
"produces": [],
"parameters": [
{
"name": "eventId",
"in": "path",
"description": "The event ID this activation applies to.",
"required": true,
"type": "string",
"maxLength": 256
}
],
"responses": {
"204": {
"description": "Success"
},
"default": {
"description": "Invalid reward request.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
},
"x-ms-examples": {
"Successful Events_Activate request": {
"$ref": "./examples/Events_Activate.json"
}
}
}
},
"/rank": {
"post": {
"tags": [
"Rank"
],
"summary": "A Personalizer rank request.",
"operationId": "Rank",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "rankRequest",
"in": "body",
"description": "A Personalizer request.",
"required": true,
"schema": {
"$ref": "#/definitions/RankRequest"
}
}
],
"responses": {
"201": {
"description": "Success",
"schema": {
"$ref": "#/definitions/RankResponse"
}
},
"default": {
"description": "Invalid rank request.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
},
"x-ms-examples": {
"Successful Rank request": {
"$ref": "./examples/Rank.json"
}
}
}
}
},
"definitions": {
"ErrorResponse": {
"description": "Used to return an error to the client",
"required": [
"error"
],
"type": "object",
"properties": {
"error": {
"$ref": "#/definitions/PersonalizerError",
"description": "The error object."
}
}
},
"PersonalizerError": {
"description": "The error object.",
"required": [
"code",
"message"
],
"type": "object",
"properties": {
"code": {
"description": "High level error code.",
"enum": [
"BadRequest",
"ResourceNotFound",
"InternalServerError"
],
"type": "string",
"x-ms-enum": {
"name": "ErrorCode",
"modelAsString": true,
"values": [
{
"value": "BadRequest",
"description": "Request could not be understood by the server."
},
{
"value": "ResourceNotFound",
"description": "Requested resource does not exist on the server."
},
{
"value": "InternalServerError",
"description": "A generic error has occurred on the server."
}
]
}
},
"message": {
"description": "A message explaining the error reported by the service.",
"type": "string"
},
"target": {
"description": "Error source element.",
"type": "string"
},
"details": {
"description": "An array of details about specific errors that led to this reported error.",
"type": "array",
"items": {
"$ref": "#/definitions/PersonalizerError"
}
},
"innerError": {
"$ref": "#/definitions/InternalError",
"description": "Finer error details."
}
}
},
"InternalError": {
"description": "An object containing more specific information than the parent object about the error.",
"type": "object",
"properties": {
"code": {
"description": "Detailed error code.",
"type": "string"
},
"innererror": {
"$ref": "#/definitions/InternalError",
"description": "The error object."
}
}
},
"RewardRequest": {
"description": "Reward given to a rank response.",
"required": [
"value"
],
"type": "object",
"properties": {
"value": {
"format": "float",
"description": "Reward to be assigned to an action. Value should be between -1 and 1 inclusive.",
"type": "number"
}
}
},
"RankRequest": {
"description": "Request a set of actions to be ranked by the Personalizer service.",
"required": [
"actions"
],
"type": "object",
"properties": {
"contextFeatures": {
"description": "Features of the context used for Personalizer as a\r\ndictionary of dictionaries. This depends on the application, and\r\ntypically includes features about the current user, their\r\ndevice, profile information, data about time and date, etc.",
"type": "array",
"items": {
"type": "object"
}
},
"actions": {
"description": "The set of actions the Personalizer service can pick from.\r\nThe set should not contain more than 50 actions.\r\nThe order of the actions does not affect the rank result but the order\r\nshould match the sequence your application would have used to display them.",
"type": "array",
"items": {
"$ref": "#/definitions/RankableAction"
}
},
"excludedActions": {
"description": "The set of action ids to exclude from ranking.",
"type": "array",
"items": {
"type": "string"
}
},
"eventId": {
"description": "Optionally pass an eventId that uniquely identifies this Rank event. \r\nIf null, the service generates a unique eventId. The eventId will be used for\r\nassociating this request with its reward, as well as seeding the pseudo-random\r\ngenerator when making a Personalizer call.",
"maxLength": 256,
"type": "string"
},
"deferActivation": {
"description": "Send false if the user will see the rank results, therefore\r\nPersonalizer will expect a Reward call, otherwise it will assign the default\r\nReward to the event. Send true if it is possible the user will not see the\r\nrank results, because the page is rendering later, or the Rank results may be\r\noverridden by code further downstream.",
"default": false,
"type": "boolean"
}
}
},
"RankableAction": {
"description": "An action with it's associated features used for ranking.",
"required": [
"id",
"features"
],
"type": "object",
"properties": {
"id": {
"description": "Id of the action.",
"maxLength": 256,
"type": "string"
},
"features": {
"description": "List of dictionaries containing features.",
"type": "array",
"items": {
"type": "object"
}
}
}
},
"RankResponse": {
"description": "A resulting ordered list of actions that result from a rank request.",
"type": "object",
"properties": {
"ranking": {
"description": "The calculated ranking for the current request.",
"type": "array",
"items": {
"$ref": "#/definitions/RankedAction"
},
"readOnly": true
},
"eventId": {
"description": "The eventId for the round trip from request to response.",
"maxLength": 256,
"type": "string",
"readOnly": true
},
"rewardActionId": {
"description": "The action chosen by the Personalizer service. This is the action for which to report the reward. This might not be the \r\nfirst found in 'ranking' if an action in the request in first position was part of the excluded ids.",
"maxLength": 256,
"type": "string",
"readOnly": true
}
}
},
"RankedAction": {
"description": "A ranked action with its resulting probability.",
"type": "object",
"properties": {
"id": {
"description": "Id of the action",
"maxLength": 256,
"type": "string",
"readOnly": true
},
"probability": {
"format": "float",
"description": "Probability of the action",
"maximum": 1,
"minimum": 0,
"type": "number",
"readOnly": true
}
}
}
},
"parameters": {
"Endpoint": {
"name": "Endpoint",
"in": "path",
"description": "Supported Cognitive Services endpoint.",
"required": true,
"type": "string",
"x-ms-parameter-location": "client",
"x-ms-skip-url-encoding": true,
"maxLength": 1024
}
},
"securityDefinitions": {
"apim_key": {
"name": "Ocp-Apim-Subscription-Key",
"in": "header",
"type": "apiKey"
}
},
"security": [
{
"apim_key": []
}
],
"tags": [
{
"name": "Events",
"description": "Manages event operations."
},
{
"name": "Rank",
"description": "Manages ranking operations."
}
],
"x-ms-parameterized-host": {
"hostTemplate": "{Endpoint}",
"useSchemePrefix": false,
"parameters": [
{
"$ref": "#/parameters/Endpoint"
}
]
}
}