model_service.proto 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/cloud/retail/v2beta/model.proto";
  21. import "google/longrunning/operations.proto";
  22. import "google/protobuf/empty.proto";
  23. import "google/protobuf/field_mask.proto";
  24. option csharp_namespace = "Google.Cloud.Retail.V2Beta";
  25. option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail";
  26. option java_multiple_files = true;
  27. option java_outer_classname = "ModelServiceProto";
  28. option java_package = "com.google.cloud.retail.v2beta";
  29. option objc_class_prefix = "RETAIL";
  30. option php_namespace = "Google\\Cloud\\Retail\\V2beta";
  31. option ruby_package = "Google::Cloud::Retail::V2beta";
  32. // Service for performing CRUD operations on models.
  33. // Recommendation models contain all the metadata necessary to generate a set of
  34. // models for the `Predict()` API. A model is queried
  35. // indirectly via a ServingConfig, which associates a model with a
  36. // given Placement (e.g. Frequently Bought Together on Home Page).
  37. //
  38. // This service allows you to do the following:
  39. //
  40. // * Initiate training of a model.
  41. // * Pause training of an existing model.
  42. // * List all the available models along with their metadata.
  43. // * Control their tuning schedule.
  44. service ModelService {
  45. option (google.api.default_host) = "retail.googleapis.com";
  46. option (google.api.oauth_scopes) =
  47. "https://www.googleapis.com/auth/cloud-platform";
  48. // Creates a new model.
  49. rpc CreateModel(CreateModelRequest) returns (google.longrunning.Operation) {
  50. option (google.api.http) = {
  51. post: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/models"
  52. body: "model"
  53. };
  54. option (google.api.method_signature) = "parent,model";
  55. option (google.longrunning.operation_info) = {
  56. response_type: "google.cloud.retail.v2beta.Model"
  57. metadata_type: "google.cloud.retail.v2beta.CreateModelMetadata"
  58. };
  59. }
  60. // Pauses the training of an existing model.
  61. rpc PauseModel(PauseModelRequest) returns (Model) {
  62. option (google.api.http) = {
  63. post: "/v2beta/{name=projects/*/locations/*/catalogs/*/models/*}:pause"
  64. body: "*"
  65. };
  66. option (google.api.method_signature) = "name";
  67. }
  68. // Resumes the training of an existing model.
  69. rpc ResumeModel(ResumeModelRequest) returns (Model) {
  70. option (google.api.http) = {
  71. post: "/v2beta/{name=projects/*/locations/*/catalogs/*/models/*}:resume"
  72. body: "*"
  73. };
  74. option (google.api.method_signature) = "name";
  75. }
  76. // Deletes an existing model.
  77. rpc DeleteModel(DeleteModelRequest) returns (google.protobuf.Empty) {
  78. option (google.api.http) = {
  79. delete: "/v2beta/{name=projects/*/locations/*/catalogs/*/models/*}"
  80. };
  81. option (google.api.method_signature) = "name";
  82. }
  83. // Lists all the models linked to this event store.
  84. rpc ListModels(ListModelsRequest) returns (ListModelsResponse) {
  85. option (google.api.http) = {
  86. get: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/models"
  87. };
  88. option (google.api.method_signature) = "parent";
  89. }
  90. // Update of model metadata. Only fields that
  91. // currently can be updated are: `filtering_option` and
  92. // `periodic_tuning_state`.
  93. // If other values are provided, this API method ignores them.
  94. rpc UpdateModel(UpdateModelRequest) returns (Model) {
  95. option (google.api.http) = {
  96. patch: "/v2beta/{model.name=projects/*/locations/*/catalogs/*/models/*}"
  97. body: "model"
  98. };
  99. option (google.api.method_signature) = "model,update_mask";
  100. }
  101. // Tunes an existing model.
  102. rpc TuneModel(TuneModelRequest) returns (google.longrunning.Operation) {
  103. option (google.api.http) = {
  104. post: "/v2beta/{name=projects/*/locations/*/catalogs/*/models/*}:tune"
  105. body: "*"
  106. };
  107. option (google.api.method_signature) = "name";
  108. option (google.longrunning.operation_info) = {
  109. response_type: "google.cloud.retail.v2beta.TuneModelResponse"
  110. metadata_type: "google.cloud.retail.v2beta.TuneModelMetadata"
  111. };
  112. }
  113. }
  114. // Request for creating a model.
  115. message CreateModelRequest {
  116. // Required. The parent resource under which to create the model. Format:
  117. // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
  118. string parent = 1 [
  119. (google.api.field_behavior) = REQUIRED,
  120. (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" }
  121. ];
  122. // Required. The payload of the [Model][google.cloud.retail.v2beta.Model] to
  123. // create.
  124. Model model = 2 [(google.api.field_behavior) = REQUIRED];
  125. // Optional. Whether to run a dry run to validate the request (without
  126. // actually creating the model).
  127. bool dry_run = 3 [(google.api.field_behavior) = OPTIONAL];
  128. }
  129. // Request for updating an existing model.
  130. message UpdateModelRequest {
  131. // Required. The body of the updated
  132. // [Model][google.cloud.retail.v2beta.Model].
  133. Model model = 1 [(google.api.field_behavior) = REQUIRED];
  134. // Optional. Indicates which fields in the provided 'model' to
  135. // update. If not set, by default updates all fields.
  136. google.protobuf.FieldMask update_mask = 2
  137. [(google.api.field_behavior) = OPTIONAL];
  138. }
  139. // Request for pausing training of a model.
  140. message PauseModelRequest {
  141. // Required. The name of the model to pause.
  142. // Format:
  143. // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
  144. string name = 1 [
  145. (google.api.field_behavior) = REQUIRED,
  146. (google.api.resource_reference) = { type: "retail.googleapis.com/Model" }
  147. ];
  148. }
  149. // Request for resuming training of a model.
  150. message ResumeModelRequest {
  151. // Required. The name of the model to resume.
  152. // Format:
  153. // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
  154. string name = 1 [(google.api.field_behavior) = REQUIRED];
  155. }
  156. // Request for listing models associated with a resource.
  157. message ListModelsRequest {
  158. // Required. The parent for which to list models.
  159. // Format:
  160. // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
  161. string parent = 1 [
  162. (google.api.field_behavior) = REQUIRED,
  163. (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" }
  164. ];
  165. // Optional. Maximum number of results to return. If unspecified, defaults
  166. // to 50. Max allowed value is 1000.
  167. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
  168. // Optional. A page token, received from a previous `ListModels`
  169. // call. Provide this to retrieve the subsequent page.
  170. string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
  171. }
  172. // Request for deleting a model.
  173. message DeleteModelRequest {
  174. // Required. The resource name of the
  175. // [Model][google.cloud.retail.v2beta.Model] to delete. Format:
  176. // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
  177. string name = 1 [
  178. (google.api.field_behavior) = REQUIRED,
  179. (google.api.resource_reference) = { type: "retail.googleapis.com/Model" }
  180. ];
  181. }
  182. // Response to a ListModelRequest.
  183. message ListModelsResponse {
  184. // List of Models.
  185. repeated Model models = 1;
  186. // Pagination token, if not returned indicates the last page.
  187. string next_page_token = 2;
  188. }
  189. // Request to manually start a tuning process now (instead of waiting for
  190. // the periodically scheduled tuning to happen).
  191. message TuneModelRequest {
  192. // Required. The resource name of the model to tune.
  193. // Format:
  194. // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
  195. string name = 1 [
  196. (google.api.field_behavior) = REQUIRED,
  197. (google.api.resource_reference) = { type: "retail.googleapis.com/Model" }
  198. ];
  199. }
  200. // Metadata associated with a create operation.
  201. message CreateModelMetadata {
  202. // The resource name of the model that this create applies to.
  203. // Format:
  204. // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
  205. string model = 1;
  206. }
  207. // Metadata associated with a tune operation.
  208. message TuneModelMetadata {
  209. // The resource name of the model that this tune applies to.
  210. // Format:
  211. // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
  212. string model = 1;
  213. }
  214. // Response associated with a tune operation.
  215. message TuneModelResponse {}