model_service.proto 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. // Copyright 2021 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.v2alpha;
  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/v2alpha/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.V2Alpha";
  25. option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail";
  26. option java_multiple_files = true;
  27. option java_outer_classname = "ModelServiceProto";
  28. option java_package = "com.google.cloud.retail.v2alpha";
  29. option objc_class_prefix = "RETAIL";
  30. option php_namespace = "Google\\Cloud\\Retail\\V2alpha";
  31. option ruby_package = "Google::Cloud::Retail::V2alpha";
  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 customers to e.g.:
  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: "/v2alpha/{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: "Model"
  57. metadata_type: "CreateModelMetadata"
  58. };
  59. }
  60. // Pauses the training of an existing model.
  61. rpc PauseModel(PauseModelRequest) returns (Model) {
  62. option (google.api.http) = {
  63. post: "/v2alpha/{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: "/v2alpha/{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: "/v2alpha/{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: "/v2alpha/{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, periodic_tuning_state.
  92. // If other values are provided, this API method will ignore them.
  93. rpc UpdateModel(UpdateModelRequest) returns (Model) {
  94. option (google.api.http) = {
  95. patch: "/v2alpha/{model.name=projects/*/locations/*/catalogs/*/models/*}"
  96. body: "model"
  97. };
  98. option (google.api.method_signature) = "model,update_mask";
  99. }
  100. // Tunes an existing model.
  101. rpc TuneModel(TuneModelRequest) returns (google.longrunning.Operation) {
  102. option (google.api.http) = {
  103. post: "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}:tune"
  104. body: "*"
  105. };
  106. option (google.api.method_signature) = "name";
  107. option (google.longrunning.operation_info) = {
  108. response_type: "TuneModelResponse"
  109. metadata_type: "TuneModelMetadata"
  110. };
  111. }
  112. }
  113. // Request for creating a model.
  114. message CreateModelRequest {
  115. // Required. The parent resource under which to create the model. Format:
  116. // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}
  117. string parent = 1 [
  118. (google.api.field_behavior) = REQUIRED,
  119. (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" }
  120. ];
  121. // Required. The payload of the [Model] to create.
  122. Model model = 2 [(google.api.field_behavior) = REQUIRED];
  123. // Optional. Whether to run a dry_run to validate the request (without
  124. // actually creating the model).
  125. bool dry_run = 3 [(google.api.field_behavior) = OPTIONAL];
  126. }
  127. // Request for updating an existing model.
  128. message UpdateModelRequest {
  129. // Required. The body of the updated [Model].
  130. Model model = 1 [(google.api.field_behavior) = REQUIRED];
  131. // Optional. Indicates which fields in the provided 'model' to
  132. // update. If not set, will by default update all fields.
  133. google.protobuf.FieldMask update_mask = 2
  134. [(google.api.field_behavior) = OPTIONAL];
  135. }
  136. // Request for pausing training of a model.
  137. message PauseModelRequest {
  138. // Required. The name of the model to pause.
  139. // Format:
  140. // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}
  141. string name = 1 [
  142. (google.api.field_behavior) = REQUIRED,
  143. (google.api.resource_reference) = { type: "retail.googleapis.com/Model" }
  144. ];
  145. }
  146. // Request for resuming training of a model.
  147. message ResumeModelRequest {
  148. // Required. The name of the model to resume.
  149. // Format:
  150. // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}
  151. string name = 1 [(google.api.field_behavior) = REQUIRED];
  152. }
  153. // Request for listing models associated with a resource.
  154. message ListModelsRequest {
  155. // Required. The parent for which to list models.
  156. // Format:
  157. // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}
  158. string parent = 1 [
  159. (google.api.field_behavior) = REQUIRED,
  160. (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" }
  161. ];
  162. // Optional. Maximum number of results to return. If unspecified, defaults
  163. // to 50. Max allowed value is 1000.
  164. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
  165. // Optional. A page token, received from a previous `ListModels`
  166. // call. Provide this to retrieve the subsequent page.
  167. string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
  168. }
  169. // Request for deleting a model.
  170. message DeleteModelRequest {
  171. // Required. The resource name of the [Model] to delete.
  172. // Format:
  173. // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}
  174. string name = 1 [
  175. (google.api.field_behavior) = REQUIRED,
  176. (google.api.resource_reference) = { type: "retail.googleapis.com/Model" }
  177. ];
  178. }
  179. // Response to a ListModelRequest.
  180. message ListModelsResponse {
  181. // List of Models.
  182. repeated Model models = 1;
  183. // Pagination token, if not returned indicates the last page.
  184. string next_page_token = 2;
  185. }
  186. // Request to manually start a tuning process now (instead of waiting for
  187. // the periodically scheduled tuning to happen).
  188. message TuneModelRequest {
  189. // Required. The resource name of the model to tune.
  190. // Format:
  191. // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}
  192. string name = 1 [
  193. (google.api.field_behavior) = REQUIRED,
  194. (google.api.resource_reference) = { type: "retail.googleapis.com/Model" }
  195. ];
  196. }
  197. // Metadata associated with a create operation.
  198. message CreateModelMetadata {
  199. // The resource name of the model that this create applies to.
  200. // Format:
  201. // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}
  202. string model = 1;
  203. }
  204. // Metadata associated with a tune operation.
  205. message TuneModelMetadata {
  206. // The resource name of the model that this tune applies to.
  207. // Format:
  208. // projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}
  209. string model = 1;
  210. }
  211. // Response associated with a tune operation.
  212. message TuneModelResponse {}