catalog.proto 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.recommendationengine.v1beta1;
  16. import "google/api/field_behavior.proto";
  17. import "google/cloud/recommendationengine/v1beta1/common.proto";
  18. option csharp_namespace = "Google.Cloud.RecommendationEngine.V1Beta1";
  19. option go_package = "google.golang.org/genproto/googleapis/cloud/recommendationengine/v1beta1;recommendationengine";
  20. option java_multiple_files = true;
  21. option java_package = "com.google.cloud.recommendationengine.v1beta1";
  22. option objc_class_prefix = "RECAI";
  23. option php_namespace = "Google\\Cloud\\RecommendationEngine\\V1beta1";
  24. option ruby_package = "Google::Cloud::RecommendationEngine::V1beta1";
  25. // CatalogItem captures all metadata information of items to be recommended.
  26. message CatalogItem {
  27. // Category represents catalog item category hierarchy.
  28. message CategoryHierarchy {
  29. // Required. Catalog item categories. Each category should be a UTF-8
  30. // encoded string with a length limit of 2 KiB.
  31. //
  32. // Note that the order in the list denotes the specificity (from least to
  33. // most specific).
  34. repeated string categories = 1 [(google.api.field_behavior) = REQUIRED];
  35. }
  36. // Required. Catalog item identifier. UTF-8 encoded string with a length limit
  37. // of 128 bytes.
  38. //
  39. // This id must be unique among all catalog items within the same catalog. It
  40. // should also be used when logging user events in order for the user events
  41. // to be joined with the Catalog.
  42. string id = 1 [(google.api.field_behavior) = REQUIRED];
  43. // Required. Catalog item categories. This field is repeated for supporting
  44. // one catalog item belonging to several parallel category hierarchies.
  45. //
  46. // For example, if a shoes product belongs to both
  47. // ["Shoes & Accessories" -> "Shoes"] and
  48. // ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
  49. // represented as:
  50. //
  51. // "categoryHierarchies": [
  52. // { "categories": ["Shoes & Accessories", "Shoes"]},
  53. // { "categories": ["Sports & Fitness", "Athletic Clothing", "Shoes"] }
  54. // ]
  55. repeated CategoryHierarchy category_hierarchies = 2 [(google.api.field_behavior) = REQUIRED];
  56. // Required. Catalog item title. UTF-8 encoded string with a length limit of 1
  57. // KiB.
  58. string title = 3 [(google.api.field_behavior) = REQUIRED];
  59. // Optional. Catalog item description. UTF-8 encoded string with a length
  60. // limit of 5 KiB.
  61. string description = 4 [(google.api.field_behavior) = OPTIONAL];
  62. // Optional. Highly encouraged. Extra catalog item attributes to be
  63. // included in the recommendation model. For example, for retail products,
  64. // this could include the store name, vendor, style, color, etc. These are
  65. // very strong signals for recommendation model, thus we highly recommend
  66. // providing the item attributes here.
  67. FeatureMap item_attributes = 5 [(google.api.field_behavior) = OPTIONAL];
  68. // Optional. Language of the title/description/item_attributes. Use language
  69. // tags defined by BCP 47. https://www.rfc-editor.org/rfc/bcp/bcp47.txt. Our
  70. // supported language codes include 'en', 'es', 'fr', 'de', 'ar', 'fa', 'zh',
  71. // 'ja', 'ko', 'sv', 'ro', 'nl'. For other languages, contact
  72. // your Google account manager.
  73. string language_code = 6 [(google.api.field_behavior) = OPTIONAL];
  74. // Optional. Filtering tags associated with the catalog item. Each tag should
  75. // be a UTF-8 encoded string with a length limit of 1 KiB.
  76. //
  77. // This tag can be used for filtering recommendation results by passing the
  78. // tag as part of the predict request filter.
  79. repeated string tags = 8 [(google.api.field_behavior) = OPTIONAL];
  80. // Optional. Variant group identifier for prediction results. UTF-8 encoded
  81. // string with a length limit of 128 bytes.
  82. //
  83. // This field must be enabled before it can be used. [Learn
  84. // more](/recommendations-ai/docs/catalog#item-group-id).
  85. string item_group_id = 9 [(google.api.field_behavior) = OPTIONAL];
  86. // Extra catalog item metadata for different recommendation types.
  87. oneof recommendation_type {
  88. // Optional. Metadata specific to retail products.
  89. ProductCatalogItem product_metadata = 10 [(google.api.field_behavior) = OPTIONAL];
  90. }
  91. }
  92. // ProductCatalogItem captures item metadata specific to retail products.
  93. message ProductCatalogItem {
  94. // Exact product price.
  95. message ExactPrice {
  96. // Optional. Display price of the product.
  97. float display_price = 1 [(google.api.field_behavior) = OPTIONAL];
  98. // Optional. Price of the product without any discount. If zero, by default
  99. // set to be the 'displayPrice'.
  100. float original_price = 2 [(google.api.field_behavior) = OPTIONAL];
  101. }
  102. // Product price range when there are a range of prices for different
  103. // variations of the same product.
  104. message PriceRange {
  105. // Required. The minimum product price.
  106. float min = 1 [(google.api.field_behavior) = REQUIRED];
  107. // Required. The maximum product price.
  108. float max = 2 [(google.api.field_behavior) = REQUIRED];
  109. }
  110. // Item stock state. If this field is unspecified, the item is
  111. // assumed to be in stock.
  112. enum StockState {
  113. option allow_alias = true;
  114. // Default item stock status. Should never be used.
  115. STOCK_STATE_UNSPECIFIED = 0;
  116. // Item in stock.
  117. IN_STOCK = 0;
  118. // Item out of stock.
  119. OUT_OF_STOCK = 1;
  120. // Item that is in pre-order state.
  121. PREORDER = 2;
  122. // Item that is back-ordered (i.e. temporarily out of stock).
  123. BACKORDER = 3;
  124. }
  125. // Product price. Only one of 'exactPrice'/'priceRange' can be provided.
  126. oneof price {
  127. // Optional. The exact product price.
  128. ExactPrice exact_price = 1 [(google.api.field_behavior) = OPTIONAL];
  129. // Optional. The product price range.
  130. PriceRange price_range = 2 [(google.api.field_behavior) = OPTIONAL];
  131. }
  132. // Optional. A map to pass the costs associated with the product.
  133. //
  134. // For example:
  135. // {"manufacturing": 45.5} The profit of selling this item is computed like
  136. // so:
  137. //
  138. // * If 'exactPrice' is provided, profit = displayPrice - sum(costs)
  139. // * If 'priceRange' is provided, profit = minPrice - sum(costs)
  140. map<string, float> costs = 3 [(google.api.field_behavior) = OPTIONAL];
  141. // Optional. Only required if the price is set. Currency code for price/costs. Use
  142. // three-character ISO-4217 code.
  143. string currency_code = 4 [(google.api.field_behavior) = OPTIONAL];
  144. // Optional. Online stock state of the catalog item. Default is `IN_STOCK`.
  145. StockState stock_state = 5 [(google.api.field_behavior) = OPTIONAL];
  146. // Optional. The available quantity of the item.
  147. int64 available_quantity = 6 [(google.api.field_behavior) = OPTIONAL];
  148. // Optional. Canonical URL directly linking to the item detail page with a
  149. // length limit of 5 KiB..
  150. string canonical_product_uri = 7 [(google.api.field_behavior) = OPTIONAL];
  151. // Optional. Product images for the catalog item.
  152. repeated Image images = 8 [(google.api.field_behavior) = OPTIONAL];
  153. }
  154. // Catalog item thumbnail/detail image.
  155. message Image {
  156. // Required. URL of the image with a length limit of 5 KiB.
  157. string uri = 1 [(google.api.field_behavior) = REQUIRED];
  158. // Optional. Height of the image in number of pixels.
  159. int32 height = 2 [(google.api.field_behavior) = OPTIONAL];
  160. // Optional. Width of the image in number of pixels.
  161. int32 width = 3 [(google.api.field_behavior) = OPTIONAL];
  162. }