catalog.proto 7.9 KB

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