model.proto 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. // Copyright 2022 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.retail.v2beta;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/cloud/retail/v2beta/common.proto";
  19. import "google/protobuf/timestamp.proto";
  20. option csharp_namespace = "Google.Cloud.Retail.V2Beta";
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail";
  22. option java_multiple_files = true;
  23. option java_outer_classname = "ModelProto";
  24. option java_package = "com.google.cloud.retail.v2beta";
  25. option objc_class_prefix = "RETAIL";
  26. option php_namespace = "Google\\Cloud\\Retail\\V2beta";
  27. option ruby_package = "Google::Cloud::Retail::V2beta";
  28. // Metadata that describes the training and serving parameters of a
  29. // [Model][google.cloud.retail.v2beta.Model]. A
  30. // [Model][google.cloud.retail.v2beta.Model] can be associated with a
  31. // [ServingConfig][google.cloud.retail.v2beta.ServingConfig] and then queried
  32. // through the Predict API.
  33. message Model {
  34. option (google.api.resource) = {
  35. type: "retail.googleapis.com/Model"
  36. pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}"
  37. };
  38. // Represents an ordered combination of valid serving configs, which
  39. // can be used for `PAGE_OPTIMIZATION` recommendations.
  40. message ServingConfigList {
  41. // Optional. A set of valid serving configs that may be used for
  42. // `PAGE_OPTIMIZATION`.
  43. repeated string serving_config_ids = 1
  44. [(google.api.field_behavior) = OPTIONAL];
  45. }
  46. // The serving state of the model.
  47. enum ServingState {
  48. // Unspecified serving state.
  49. SERVING_STATE_UNSPECIFIED = 0;
  50. // The model is not serving.
  51. INACTIVE = 1;
  52. // The model is serving and can be queried.
  53. ACTIVE = 2;
  54. // The model is trained on tuned hyperparameters and can be
  55. // queried.
  56. TUNED = 3;
  57. }
  58. // The training state of the model.
  59. enum TrainingState {
  60. // Unspecified training state.
  61. TRAINING_STATE_UNSPECIFIED = 0;
  62. // The model training is paused.
  63. PAUSED = 1;
  64. // The model is training.
  65. TRAINING = 2;
  66. }
  67. // Describes whether periodic tuning is enabled for this model
  68. // or not. Periodic tuning is scheduled at most every three months. You can
  69. // start a tuning process manually by using the `TuneModel`
  70. // method, which starts a tuning process immediately and resets the quarterly
  71. // schedule. Enabling or disabling periodic tuning does not affect any
  72. // current tuning processes.
  73. enum PeriodicTuningState {
  74. // Unspecified default value, should never be explicitly set.
  75. PERIODIC_TUNING_STATE_UNSPECIFIED = 0;
  76. // The model has periodic tuning disabled. Tuning
  77. // can be reenabled by calling the `EnableModelPeriodicTuning`
  78. // method or by calling the `TuneModel` method.
  79. PERIODIC_TUNING_DISABLED = 1;
  80. // The model cannot be tuned with periodic tuning OR the
  81. // `TuneModel` method. Hide the options in customer UI and
  82. // reject any requests through the backend self serve API.
  83. ALL_TUNING_DISABLED = 3;
  84. // The model has periodic tuning enabled. Tuning
  85. // can be disabled by calling the `DisableModelPeriodicTuning`
  86. // method.
  87. PERIODIC_TUNING_ENABLED = 2;
  88. }
  89. // Describes whether this model have sufficient training data
  90. // to be continuously trained.
  91. enum DataState {
  92. // Unspecified default value, should never be explicitly set.
  93. DATA_STATE_UNSPECIFIED = 0;
  94. // The model has sufficient training data.
  95. DATA_OK = 1;
  96. // The model does not have sufficient training data. Error
  97. // messages can be queried via Stackdriver.
  98. DATA_ERROR = 2;
  99. }
  100. // Required. The fully qualified resource name of the model.
  101. //
  102. // Format:
  103. // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
  104. // catalog_id has char limit of 50.
  105. // recommendation_model_id has char limit of 40.
  106. string name = 1 [(google.api.field_behavior) = REQUIRED];
  107. // Required. The display name of the model.
  108. //
  109. // Should be human readable, used to display Recommendation Models in the
  110. // Retail Cloud Console Dashboard. UTF-8 encoded string with limit of 1024
  111. // characters.
  112. string display_name = 2 [(google.api.field_behavior) = REQUIRED];
  113. // Optional. The training state that the model is in (e.g.
  114. // `TRAINING` or `PAUSED`).
  115. //
  116. // Since part of the cost of running the service
  117. // is frequency of training - this can be used to determine when to train
  118. // model in order to control cost. If not specified: the default value for
  119. // `CreateModel` method is `TRAINING`. The default value for
  120. // `UpdateModel` method is to keep the state the same as before.
  121. TrainingState training_state = 3 [(google.api.field_behavior) = OPTIONAL];
  122. // Output only. The serving state of the model: `ACTIVE`, `NOT_ACTIVE`.
  123. ServingState serving_state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  124. // Output only. Timestamp the Recommendation Model was created at.
  125. google.protobuf.Timestamp create_time = 5
  126. [(google.api.field_behavior) = OUTPUT_ONLY];
  127. // Output only. Timestamp the Recommendation Model was last updated. E.g.
  128. // if a Recommendation Model was paused - this would be the time the pause was
  129. // initiated.
  130. google.protobuf.Timestamp update_time = 6
  131. [(google.api.field_behavior) = OUTPUT_ONLY];
  132. // Required. The type of model e.g. `home-page`.
  133. //
  134. // Currently supported values: `recommended-for-you`, `others-you-may-like`,
  135. // `frequently-bought-together`, `page-optimization`, `similar-items`,
  136. // `buy-it-again`, and `recently-viewed`(readonly value).
  137. //
  138. // This field together with
  139. // [optimization_objective][google.cloud.retail.v2beta.Model.optimization_objective]
  140. // describe model metadata to use to control model training and serving.
  141. // See https://cloud.google.com/retail/docs/models
  142. // for more details on what the model metadata control and which combination
  143. // of parameters are valid. For invalid combinations of parameters (e.g. type
  144. // = `frequently-bought-together` and optimization_objective = `ctr`), you
  145. // receive an error 400 if you try to create/update a recommendation with
  146. // this set of knobs.
  147. string type = 7 [(google.api.field_behavior) = REQUIRED];
  148. // Optional. The optimization objective e.g. `cvr`.
  149. //
  150. // Currently supported
  151. // values: `ctr`, `cvr`, `revenue-per-order`.
  152. //
  153. // If not specified, we choose default based on model type.
  154. // Default depends on type of recommendation:
  155. //
  156. // `recommended-for-you` => `ctr`
  157. //
  158. // `others-you-may-like` => `ctr`
  159. //
  160. // `frequently-bought-together` => `revenue_per_order`
  161. //
  162. // This field together with
  163. // [optimization_objective][google.cloud.retail.v2beta.Model.type]
  164. // describe model metadata to use to control model training and serving.
  165. // See https://cloud.google.com/retail/docs/models
  166. // for more details on what the model metadata control and which combination
  167. // of parameters are valid. For invalid combinations of parameters (e.g. type
  168. // = `frequently-bought-together` and optimization_objective = `ctr`), you
  169. // receive an error 400 if you try to create/update a recommendation with
  170. // this set of knobs.
  171. string optimization_objective = 8 [(google.api.field_behavior) = OPTIONAL];
  172. // Optional. The state of periodic tuning.
  173. //
  174. // The period we use is 3 months - to do a
  175. // one-off tune earlier use the `TuneModel` method. Default value
  176. // is `PERIODIC_TUNING_ENABLED`.
  177. PeriodicTuningState periodic_tuning_state = 11
  178. [(google.api.field_behavior) = OPTIONAL];
  179. // Output only. The timestamp when the latest successful tune finished.
  180. google.protobuf.Timestamp last_tune_time = 12
  181. [(google.api.field_behavior) = OUTPUT_ONLY];
  182. // Output only. The tune operation associated with the model.
  183. //
  184. // Can be used to determine if there is an ongoing tune for this
  185. // recommendation. Empty field implies no tune is goig on.
  186. string tuning_operation = 15 [(google.api.field_behavior) = OUTPUT_ONLY];
  187. // Output only. The state of data requirements for this model: `DATA_OK` and
  188. // `DATA_ERROR`.
  189. //
  190. // Recommendation model cannot be trained if the data is in
  191. // `DATA_ERROR` state. Recommendation model can have `DATA_ERROR` state even
  192. // if serving state is `ACTIVE`: models were trained successfully before, but
  193. // cannot be refreshed because model no longer has sufficient
  194. // data for training.
  195. DataState data_state = 16 [(google.api.field_behavior) = OUTPUT_ONLY];
  196. // Optional. If `RECOMMENDATIONS_FILTERING_ENABLED`, recommendation filtering
  197. // by attributes is enabled for the model.
  198. RecommendationsFilteringOption filtering_option = 18
  199. [(google.api.field_behavior) = OPTIONAL];
  200. // Output only. The list of valid serving configs associated with the
  201. // PageOptimizationConfig.
  202. repeated ServingConfigList serving_config_lists = 19
  203. [(google.api.field_behavior) = OUTPUT_ONLY];
  204. }