personalizeruntime.d.ts 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. import {Request} from '../lib/request';
  2. import {Response} from '../lib/response';
  3. import {AWSError} from '../lib/error';
  4. import {Service} from '../lib/service';
  5. import {ServiceConfigurationOptions} from '../lib/service';
  6. import {ConfigBase as Config} from '../lib/config-base';
  7. interface Blob {}
  8. declare class PersonalizeRuntime extends Service {
  9. /**
  10. * Constructs a service object. This object has one method for each API operation.
  11. */
  12. constructor(options?: PersonalizeRuntime.Types.ClientConfiguration)
  13. config: Config & PersonalizeRuntime.Types.ClientConfiguration;
  14. /**
  15. * Returns a list of recommended actions in sorted in descending order by prediction score. Use the GetActionRecommendations API if you have a custom campaign that deploys a solution version trained with a PERSONALIZED_ACTIONS recipe. For more information about PERSONALIZED_ACTIONS recipes, see PERSONALIZED_ACTIONS recipes. For more information about getting action recommendations, see Getting action recommendations.
  16. */
  17. getActionRecommendations(params: PersonalizeRuntime.Types.GetActionRecommendationsRequest, callback?: (err: AWSError, data: PersonalizeRuntime.Types.GetActionRecommendationsResponse) => void): Request<PersonalizeRuntime.Types.GetActionRecommendationsResponse, AWSError>;
  18. /**
  19. * Returns a list of recommended actions in sorted in descending order by prediction score. Use the GetActionRecommendations API if you have a custom campaign that deploys a solution version trained with a PERSONALIZED_ACTIONS recipe. For more information about PERSONALIZED_ACTIONS recipes, see PERSONALIZED_ACTIONS recipes. For more information about getting action recommendations, see Getting action recommendations.
  20. */
  21. getActionRecommendations(callback?: (err: AWSError, data: PersonalizeRuntime.Types.GetActionRecommendationsResponse) => void): Request<PersonalizeRuntime.Types.GetActionRecommendationsResponse, AWSError>;
  22. /**
  23. * Re-ranks a list of recommended items for the given user. The first item in the list is deemed the most likely item to be of interest to the user. The solution backing the campaign must have been created using a recipe of type PERSONALIZED_RANKING.
  24. */
  25. getPersonalizedRanking(params: PersonalizeRuntime.Types.GetPersonalizedRankingRequest, callback?: (err: AWSError, data: PersonalizeRuntime.Types.GetPersonalizedRankingResponse) => void): Request<PersonalizeRuntime.Types.GetPersonalizedRankingResponse, AWSError>;
  26. /**
  27. * Re-ranks a list of recommended items for the given user. The first item in the list is deemed the most likely item to be of interest to the user. The solution backing the campaign must have been created using a recipe of type PERSONALIZED_RANKING.
  28. */
  29. getPersonalizedRanking(callback?: (err: AWSError, data: PersonalizeRuntime.Types.GetPersonalizedRankingResponse) => void): Request<PersonalizeRuntime.Types.GetPersonalizedRankingResponse, AWSError>;
  30. /**
  31. * Returns a list of recommended items. For campaigns, the campaign's Amazon Resource Name (ARN) is required and the required user and item input depends on the recipe type used to create the solution backing the campaign as follows: USER_PERSONALIZATION - userId required, itemId not used RELATED_ITEMS - itemId required, userId not used Campaigns that are backed by a solution created using a recipe of type PERSONALIZED_RANKING use the API. For recommenders, the recommender's ARN is required and the required item and user input depends on the use case (domain-based recipe) backing the recommender. For information on use case requirements see Choosing recommender use cases.
  32. */
  33. getRecommendations(params: PersonalizeRuntime.Types.GetRecommendationsRequest, callback?: (err: AWSError, data: PersonalizeRuntime.Types.GetRecommendationsResponse) => void): Request<PersonalizeRuntime.Types.GetRecommendationsResponse, AWSError>;
  34. /**
  35. * Returns a list of recommended items. For campaigns, the campaign's Amazon Resource Name (ARN) is required and the required user and item input depends on the recipe type used to create the solution backing the campaign as follows: USER_PERSONALIZATION - userId required, itemId not used RELATED_ITEMS - itemId required, userId not used Campaigns that are backed by a solution created using a recipe of type PERSONALIZED_RANKING use the API. For recommenders, the recommender's ARN is required and the required item and user input depends on the use case (domain-based recipe) backing the recommender. For information on use case requirements see Choosing recommender use cases.
  36. */
  37. getRecommendations(callback?: (err: AWSError, data: PersonalizeRuntime.Types.GetRecommendationsResponse) => void): Request<PersonalizeRuntime.Types.GetRecommendationsResponse, AWSError>;
  38. }
  39. declare namespace PersonalizeRuntime {
  40. export type ActionID = string;
  41. export type ActionList = PredictedAction[];
  42. export type Arn = string;
  43. export type AttributeName = string;
  44. export type AttributeValue = string;
  45. export type ColumnName = string;
  46. export type ColumnNamesList = ColumnName[];
  47. export type ColumnValue = string;
  48. export type Context = {[key: string]: AttributeValue};
  49. export type DatasetType = string;
  50. export type FilterAttributeName = string;
  51. export type FilterAttributeValue = string;
  52. export type FilterValues = {[key: string]: FilterAttributeValue};
  53. export interface GetActionRecommendationsRequest {
  54. /**
  55. * The Amazon Resource Name (ARN) of the campaign to use for getting action recommendations. This campaign must deploy a solution version trained with a PERSONALIZED_ACTIONS recipe.
  56. */
  57. campaignArn?: Arn;
  58. /**
  59. * The user ID of the user to provide action recommendations for.
  60. */
  61. userId?: UserID;
  62. /**
  63. * The number of results to return. The default is 5. The maximum is 100.
  64. */
  65. numResults?: NumResults;
  66. /**
  67. * The ARN of the filter to apply to the returned recommendations. For more information, see Filtering Recommendations. When using this parameter, be sure the filter resource is ACTIVE.
  68. */
  69. filterArn?: Arn;
  70. /**
  71. * The values to use when filtering recommendations. For each placeholder parameter in your filter expression, provide the parameter name (in matching case) as a key and the filter value(s) as the corresponding value. Separate multiple values for one parameter with a comma. For filter expressions that use an INCLUDE element to include actions, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an EXCLUDE element to exclude actions, you can omit the filter-values. In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations. For more information, see Filtering recommendations and user segments.
  72. */
  73. filterValues?: FilterValues;
  74. }
  75. export interface GetActionRecommendationsResponse {
  76. /**
  77. * A list of action recommendations sorted in descending order by prediction score. There can be a maximum of 100 actions in the list. For information about action scores, see How action recommendation scoring works.
  78. */
  79. actionList?: ActionList;
  80. /**
  81. * The ID of the recommendation.
  82. */
  83. recommendationId?: RecommendationID;
  84. }
  85. export interface GetPersonalizedRankingRequest {
  86. /**
  87. * The Amazon Resource Name (ARN) of the campaign to use for generating the personalized ranking.
  88. */
  89. campaignArn: Arn;
  90. /**
  91. * A list of items (by itemId) to rank. If an item was not included in the training dataset, the item is appended to the end of the reranked list. If you are including metadata in recommendations, the maximum is 50. Otherwise, the maximum is 500.
  92. */
  93. inputList: InputList;
  94. /**
  95. * The user for which you want the campaign to provide a personalized ranking.
  96. */
  97. userId: UserID;
  98. /**
  99. * The contextual metadata to use when getting recommendations. Contextual metadata includes any interaction information that might be relevant when getting a user's recommendations, such as the user's current location or device type.
  100. */
  101. context?: Context;
  102. /**
  103. * The Amazon Resource Name (ARN) of a filter you created to include items or exclude items from recommendations for a given user. For more information, see Filtering Recommendations.
  104. */
  105. filterArn?: Arn;
  106. /**
  107. * The values to use when filtering recommendations. For each placeholder parameter in your filter expression, provide the parameter name (in matching case) as a key and the filter value(s) as the corresponding value. Separate multiple values for one parameter with a comma. For filter expressions that use an INCLUDE element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an EXCLUDE element to exclude items, you can omit the filter-values.In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations. For more information, see Filtering Recommendations.
  108. */
  109. filterValues?: FilterValues;
  110. /**
  111. * If you enabled metadata in recommendations when you created or updated the campaign, specify metadata columns from your Items dataset to include in the personalized ranking. The map key is ITEMS and the value is a list of column names from your Items dataset. The maximum number of columns you can provide is 10. For information about enabling metadata for a campaign, see Enabling metadata in recommendations for a campaign.
  112. */
  113. metadataColumns?: MetadataColumns;
  114. }
  115. export interface GetPersonalizedRankingResponse {
  116. /**
  117. * A list of items in order of most likely interest to the user. The maximum is 500.
  118. */
  119. personalizedRanking?: ItemList;
  120. /**
  121. * The ID of the recommendation.
  122. */
  123. recommendationId?: RecommendationID;
  124. }
  125. export interface GetRecommendationsRequest {
  126. /**
  127. * The Amazon Resource Name (ARN) of the campaign to use for getting recommendations.
  128. */
  129. campaignArn?: Arn;
  130. /**
  131. * The item ID to provide recommendations for. Required for RELATED_ITEMS recipe type.
  132. */
  133. itemId?: ItemID;
  134. /**
  135. * The user ID to provide recommendations for. Required for USER_PERSONALIZATION recipe type.
  136. */
  137. userId?: UserID;
  138. /**
  139. * The number of results to return. The default is 25. If you are including metadata in recommendations, the maximum is 50. Otherwise, the maximum is 500.
  140. */
  141. numResults?: NumResults;
  142. /**
  143. * The contextual metadata to use when getting recommendations. Contextual metadata includes any interaction information that might be relevant when getting a user's recommendations, such as the user's current location or device type.
  144. */
  145. context?: Context;
  146. /**
  147. * The ARN of the filter to apply to the returned recommendations. For more information, see Filtering Recommendations. When using this parameter, be sure the filter resource is ACTIVE.
  148. */
  149. filterArn?: Arn;
  150. /**
  151. * The values to use when filtering recommendations. For each placeholder parameter in your filter expression, provide the parameter name (in matching case) as a key and the filter value(s) as the corresponding value. Separate multiple values for one parameter with a comma. For filter expressions that use an INCLUDE element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an EXCLUDE element to exclude items, you can omit the filter-values.In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations. For more information, see Filtering recommendations and user segments.
  152. */
  153. filterValues?: FilterValues;
  154. /**
  155. * The Amazon Resource Name (ARN) of the recommender to use to get recommendations. Provide a recommender ARN if you created a Domain dataset group with a recommender for a domain use case.
  156. */
  157. recommenderArn?: Arn;
  158. /**
  159. * The promotions to apply to the recommendation request. A promotion defines additional business rules that apply to a configurable subset of recommended items.
  160. */
  161. promotions?: PromotionList;
  162. /**
  163. * If you enabled metadata in recommendations when you created or updated the campaign or recommender, specify the metadata columns from your Items dataset to include in item recommendations. The map key is ITEMS and the value is a list of column names from your Items dataset. The maximum number of columns you can provide is 10. For information about enabling metadata for a campaign, see Enabling metadata in recommendations for a campaign. For information about enabling metadata for a recommender, see Enabling metadata in recommendations for a recommender.
  164. */
  165. metadataColumns?: MetadataColumns;
  166. }
  167. export interface GetRecommendationsResponse {
  168. /**
  169. * A list of recommendations sorted in descending order by prediction score. There can be a maximum of 500 items in the list.
  170. */
  171. itemList?: ItemList;
  172. /**
  173. * The ID of the recommendation.
  174. */
  175. recommendationId?: RecommendationID;
  176. }
  177. export type InputList = ItemID[];
  178. export type ItemID = string;
  179. export type ItemList = PredictedItem[];
  180. export type Metadata = {[key: string]: ColumnValue};
  181. export type MetadataColumns = {[key: string]: ColumnNamesList};
  182. export type Name = string;
  183. export type NumResults = number;
  184. export type PercentPromotedItems = number;
  185. export interface PredictedAction {
  186. /**
  187. * The ID of the recommended action.
  188. */
  189. actionId?: ActionID;
  190. /**
  191. * The score of the recommended action. For information about action scores, see How action recommendation scoring works.
  192. */
  193. score?: Score;
  194. }
  195. export interface PredictedItem {
  196. /**
  197. * The recommended item ID.
  198. */
  199. itemId?: ItemID;
  200. /**
  201. * A numeric representation of the model's certainty that the item will be the next user selection. For more information on scoring logic, see how-scores-work.
  202. */
  203. score?: Score;
  204. /**
  205. * The name of the promotion that included the predicted item.
  206. */
  207. promotionName?: Name;
  208. /**
  209. * Metadata about the item from your Items dataset.
  210. */
  211. metadata?: Metadata;
  212. /**
  213. * If you use User-Personalization-v2, a list of reasons for why the item was included in recommendations. Possible reasons include the following: Promoted item - Indicates the item was included as part of a promotion that you applied in your recommendation request. Exploration - Indicates the item was included with exploration. With exploration, recommendations include items with less interactions data or relevance for the user. For more information about exploration, see Exploration. Popular item - Indicates the item was included as a placeholder popular item. If you use a filter, depending on how many recommendations the filter removes, Amazon Personalize might add placeholder items to meet the numResults for your recommendation request. These items are popular items, based on interactions data, that satisfy your filter criteria. They don't have a relevance score for the user.
  214. */
  215. reason?: ReasonList;
  216. }
  217. export interface Promotion {
  218. /**
  219. * The name of the promotion.
  220. */
  221. name?: Name;
  222. /**
  223. * The percentage of recommended items to apply the promotion to.
  224. */
  225. percentPromotedItems?: PercentPromotedItems;
  226. /**
  227. * The Amazon Resource Name (ARN) of the filter used by the promotion. This filter defines the criteria for promoted items. For more information, see Promotion filters.
  228. */
  229. filterArn?: Arn;
  230. /**
  231. * The values to use when promoting items. For each placeholder parameter in your promotion's filter expression, provide the parameter name (in matching case) as a key and the filter value(s) as the corresponding value. Separate multiple values for one parameter with a comma. For filter expressions that use an INCLUDE element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an EXCLUDE element to exclude items, you can omit the filter-values. In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations. For more information on creating filters, see Filtering recommendations and user segments.
  232. */
  233. filterValues?: FilterValues;
  234. }
  235. export type PromotionList = Promotion[];
  236. export type Reason = string;
  237. export type ReasonList = Reason[];
  238. export type RecommendationID = string;
  239. export type Score = number;
  240. export type UserID = string;
  241. /**
  242. * A string in YYYY-MM-DD format that represents the latest possible API version that can be used in this service. Specify 'latest' to use the latest possible version.
  243. */
  244. export type apiVersion = "2018-05-22"|"latest"|string;
  245. export interface ClientApiVersions {
  246. /**
  247. * A string in YYYY-MM-DD format that represents the latest possible API version that can be used in this service. Specify 'latest' to use the latest possible version.
  248. */
  249. apiVersion?: apiVersion;
  250. }
  251. export type ClientConfiguration = ServiceConfigurationOptions & ClientApiVersions;
  252. /**
  253. * Contains interfaces for use with the PersonalizeRuntime client.
  254. */
  255. export import Types = PersonalizeRuntime;
  256. }
  257. export = PersonalizeRuntime;