xref: /aosp_15_r20/external/googleapis/google/cloud/translate/v3/adaptive_mt.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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
15syntax = "proto3";
16
17package google.cloud.translation.v3;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/cloud/translate/v3/common.proto";
22import "google/protobuf/timestamp.proto";
23
24option cc_enable_arenas = true;
25option csharp_namespace = "Google.Cloud.Translate.V3";
26option go_package = "cloud.google.com/go/translate/apiv3/translatepb;translatepb";
27option java_multiple_files = true;
28option java_outer_classname = "AdaptiveMtProto";
29option java_package = "com.google.cloud.translate.v3";
30option php_namespace = "Google\\Cloud\\Translate\\V3";
31option ruby_package = "Google::Cloud::Translate::V3";
32
33// An Adaptive MT Dataset.
34message AdaptiveMtDataset {
35  option (google.api.resource) = {
36    type: "translate.googleapis.com/AdaptiveMtDataset"
37    pattern: "projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}"
38  };
39
40  // Required. The resource name of the dataset, in form of
41  // `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset_id}`
42  string name = 1 [
43    (google.api.field_behavior) = REQUIRED,
44    (google.api.resource_reference) = {
45      type: "translate.googleapis.com/AdaptiveMtDataset"
46    }
47  ];
48
49  // The name of the dataset to show in the interface. The name can be
50  // up to 32 characters long and can consist only of ASCII Latin letters A-Z
51  // and a-z, underscores (_), and ASCII digits 0-9.
52  string display_name = 2;
53
54  // The BCP-47 language code of the source language.
55  string source_language_code = 3;
56
57  // The BCP-47 language code of the target language.
58  string target_language_code = 4;
59
60  // The number of examples in the dataset.
61  int32 example_count = 5;
62
63  // Output only. Timestamp when this dataset was created.
64  google.protobuf.Timestamp create_time = 9
65      [(google.api.field_behavior) = OUTPUT_ONLY];
66
67  // Output only. Timestamp when this dataset was last updated.
68  google.protobuf.Timestamp update_time = 10
69      [(google.api.field_behavior) = OUTPUT_ONLY];
70}
71
72//  Request message for creating an AdaptiveMtDataset.
73message CreateAdaptiveMtDatasetRequest {
74  // Required. Name of the parent project. In form of
75  // `projects/{project-number-or-id}/locations/{location-id}`
76  string parent = 1 [
77    (google.api.field_behavior) = REQUIRED,
78    (google.api.resource_reference) = {
79      type: "locations.googleapis.com/Location"
80    }
81  ];
82
83  // Required. The AdaptiveMtDataset to be created.
84  AdaptiveMtDataset adaptive_mt_dataset = 2
85      [(google.api.field_behavior) = REQUIRED];
86}
87
88// Request message for deleting an AdaptiveMtDataset.
89message DeleteAdaptiveMtDatasetRequest {
90  // Required. Name of the dataset. In the form of
91  // `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
92  string name = 1 [
93    (google.api.field_behavior) = REQUIRED,
94    (google.api.resource_reference) = {
95      type: "translate.googleapis.com/AdaptiveMtDataset"
96    }
97  ];
98}
99
100// Request message for getting an Adaptive MT dataset.
101message GetAdaptiveMtDatasetRequest {
102  // Required. Name of the dataset. In the form of
103  // `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
104  string name = 1 [
105    (google.api.field_behavior) = REQUIRED,
106    (google.api.resource_reference) = {
107      type: "translate.googleapis.com/AdaptiveMtDataset"
108    }
109  ];
110}
111
112// Request message for listing all Adaptive MT datasets that the requestor has
113// access to.
114message ListAdaptiveMtDatasetsRequest {
115  // Required. The resource name of the project from which to list the Adaptive
116  // MT datasets. `projects/{project-number-or-id}/locations/{location-id}`
117  string parent = 1 [
118    (google.api.field_behavior) = REQUIRED,
119    (google.api.resource_reference) = {
120      type: "locations.googleapis.com/Location"
121    }
122  ];
123
124  // Optional. Requested page size. The server may return fewer results than
125  // requested. If unspecified, the server picks an appropriate default.
126  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
127
128  // Optional. A token identifying a page of results the server should return.
129  // Typically, this is the value of
130  // ListAdaptiveMtDatasetsResponse.next_page_token returned from the
131  // previous call to `ListAdaptiveMtDatasets` method. The first page is
132  // returned if `page_token`is empty or missing.
133  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
134
135  // Optional. An expression for filtering the results of the request.
136  // Filter is not supported yet.
137  string filter = 4 [(google.api.field_behavior) = OPTIONAL];
138}
139
140// A list of AdaptiveMtDatasets.
141message ListAdaptiveMtDatasetsResponse {
142  // Output only. A list of Adaptive MT datasets.
143  repeated AdaptiveMtDataset adaptive_mt_datasets = 1
144      [(google.api.field_behavior) = OUTPUT_ONLY];
145
146  // Optional. A token to retrieve a page of results. Pass this value in the
147  // [ListAdaptiveMtDatasetsRequest.page_token] field in the subsequent call to
148  // `ListAdaptiveMtDatasets` method to retrieve the next page of results.
149  string next_page_token = 2 [(google.api.field_behavior) = OPTIONAL];
150}
151
152// The request for sending an AdaptiveMt translation query.
153message AdaptiveMtTranslateRequest {
154  // Required. Location to make a regional call.
155  //
156  // Format: `projects/{project-number-or-id}/locations/{location-id}`.
157  string parent = 1 [
158    (google.api.field_behavior) = REQUIRED,
159    (google.api.resource_reference) = {
160      type: "locations.googleapis.com/Location"
161    }
162  ];
163
164  // Required. The resource name for the dataset to use for adaptive MT.
165  // `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`
166  string dataset = 2 [
167    (google.api.field_behavior) = REQUIRED,
168    (google.api.resource_reference) = {
169      type: "translate.googleapis.com/AdaptiveMtDataset"
170    }
171  ];
172
173  // Required. The content of the input in string format.
174  // For now only one sentence per request is supported.
175  repeated string content = 3 [(google.api.field_behavior) = REQUIRED];
176}
177
178// An AdaptiveMt translation.
179message AdaptiveMtTranslation {
180  // Output only. The translated text.
181  string translated_text = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
182}
183
184// An AdaptiveMtTranslate response.
185message AdaptiveMtTranslateResponse {
186  // Output only. The translation.
187  repeated AdaptiveMtTranslation translations = 1
188      [(google.api.field_behavior) = OUTPUT_ONLY];
189
190  // Output only. The translation's language code.
191  string language_code = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
192}
193
194// An AdaptiveMtFile.
195message AdaptiveMtFile {
196  option (google.api.resource) = {
197    type: "translate.googleapis.com/AdaptiveMtFile"
198    pattern: "projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}"
199  };
200
201  // Required. The resource name of the file, in form of
202  // `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
203  string name = 1 [
204    (google.api.field_behavior) = REQUIRED,
205    (google.api.resource_reference) = {
206      type: "translate.googleapis.com/AdaptiveMtFile"
207    }
208  ];
209
210  // The file's display name.
211  string display_name = 2;
212
213  // The number of entries that the file contains.
214  int32 entry_count = 3;
215
216  // Output only. Timestamp when this file was created.
217  google.protobuf.Timestamp create_time = 4
218      [(google.api.field_behavior) = OUTPUT_ONLY];
219
220  // Output only. Timestamp when this file was last updated.
221  google.protobuf.Timestamp update_time = 5
222      [(google.api.field_behavior) = OUTPUT_ONLY];
223}
224
225// The request for getting an AdaptiveMtFile.
226message GetAdaptiveMtFileRequest {
227  // Required. The resource name of the file, in form of
228  // `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
229  string name = 1 [
230    (google.api.field_behavior) = REQUIRED,
231    (google.api.resource_reference) = {
232      type: "translate.googleapis.com/AdaptiveMtFile"
233    }
234  ];
235}
236
237// The request for deleting an AdaptiveMt file.
238message DeleteAdaptiveMtFileRequest {
239  // Required. The resource name of the file to delete, in form of
240  // `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
241  string name = 1 [
242    (google.api.field_behavior) = REQUIRED,
243    (google.api.resource_reference) = {
244      type: "translate.googleapis.com/AdaptiveMtFile"
245    }
246  ];
247}
248
249// The request for importing an AdaptiveMt file along with its sentences.
250message ImportAdaptiveMtFileRequest {
251  // Required. The resource name of the file, in form of
252  // `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
253  string parent = 1 [
254    (google.api.field_behavior) = REQUIRED,
255    (google.api.resource_reference) = {
256      type: "translate.googleapis.com/AdaptiveMtDataset"
257    }
258  ];
259
260  // The source for the document.
261  oneof source {
262    // Inline file source.
263    FileInputSource file_input_source = 2;
264
265    // Google Cloud Storage file source.
266    GcsInputSource gcs_input_source = 3;
267  }
268}
269
270// The response for importing an AdaptiveMtFile
271message ImportAdaptiveMtFileResponse {
272  // Output only. The Adaptive MT file that was imported.
273  AdaptiveMtFile adaptive_mt_file = 1
274      [(google.api.field_behavior) = OUTPUT_ONLY];
275}
276
277// The request to list all AdaptiveMt files under a given dataset.
278message ListAdaptiveMtFilesRequest {
279  // Required. The resource name of the project from which to list the Adaptive
280  // MT files.
281  // `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
282  string parent = 1 [
283    (google.api.field_behavior) = REQUIRED,
284    (google.api.resource_reference) = {
285      type: "translate.googleapis.com/AdaptiveMtDataset"
286    }
287  ];
288
289  // Optional.
290  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
291
292  // Optional. A token identifying a page of results the server should return.
293  // Typically, this is the value of
294  // ListAdaptiveMtFilesResponse.next_page_token returned from the
295  // previous call to `ListAdaptiveMtFiles` method. The first page is
296  // returned if `page_token`is empty or missing.
297  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
298}
299
300// The response for listing all AdaptiveMt files under a given dataset.
301message ListAdaptiveMtFilesResponse {
302  // Output only. The Adaptive MT files.
303  repeated AdaptiveMtFile adaptive_mt_files = 1
304      [(google.api.field_behavior) = OUTPUT_ONLY];
305
306  // Optional. A token to retrieve a page of results. Pass this value in the
307  // ListAdaptiveMtFilesRequest.page_token field in the subsequent call to
308  // `ListAdaptiveMtFiles` method to retrieve the next page of results.
309  string next_page_token = 3 [(google.api.field_behavior) = OPTIONAL];
310}
311
312// An AdaptiveMt sentence entry.
313message AdaptiveMtSentence {
314  option (google.api.resource) = {
315    type: "translate.googleapis.com/AdaptiveMtSentence"
316    pattern: "projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}"
317  };
318
319  // Required. The resource name of the file, in form of
320  // `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}`
321  string name = 1 [
322    (google.api.field_behavior) = REQUIRED,
323    (google.api.resource_reference) = {
324      type: "translate.googleapis.com/AdaptiveMtSentence"
325    }
326  ];
327
328  // Required. The source sentence.
329  string source_sentence = 2 [(google.api.field_behavior) = REQUIRED];
330
331  // Required. The target sentence.
332  string target_sentence = 3 [(google.api.field_behavior) = REQUIRED];
333
334  // Output only. Timestamp when this sentence was created.
335  google.protobuf.Timestamp create_time = 4
336      [(google.api.field_behavior) = OUTPUT_ONLY];
337
338  // Output only. Timestamp when this sentence was last updated.
339  google.protobuf.Timestamp update_time = 5
340      [(google.api.field_behavior) = OUTPUT_ONLY];
341}
342
343// The request for listing Adaptive MT sentences from a Dataset/File.
344message ListAdaptiveMtSentencesRequest {
345  // Required. The resource name of the project from which to list the Adaptive
346  // MT files. The following format lists all sentences under a file.
347  // `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
348  // The following format lists all sentences within a dataset.
349  // `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
350  string parent = 1 [
351    (google.api.field_behavior) = REQUIRED,
352    (google.api.resource_reference) = {
353      type: "translate.googleapis.com/AdaptiveMtFile"
354    }
355  ];
356
357  int32 page_size = 2;
358
359  // A token identifying a page of results the server should return.
360  // Typically, this is the value of
361  // ListAdaptiveMtSentencesRequest.next_page_token returned from the
362  // previous call to `ListTranslationMemories` method. The first page is
363  // returned if `page_token` is empty or missing.
364  string page_token = 3;
365}
366
367// List AdaptiveMt sentences response.
368message ListAdaptiveMtSentencesResponse {
369  // Output only. The list of AdaptiveMtSentences.
370  repeated AdaptiveMtSentence adaptive_mt_sentences = 1
371      [(google.api.field_behavior) = OUTPUT_ONLY];
372
373  // Optional.
374  string next_page_token = 2 [(google.api.field_behavior) = OPTIONAL];
375}
376