Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

fix: add missing annotation for batch document translation #715

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 22 additions & 21 deletions protos/google/cloud/translate/v3beta1/translation_service.proto
Expand Up @@ -239,14 +239,13 @@ message TranslateTextRequest {
//
// - General (built-in) models:
// `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
// `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
//
//
// For global (non-regionalized) requests, use `location-id` `global`.
// For example,
// `projects/{project-number-or-id}/locations/global/models/general/nmt`.
//
// If missing, the system decides which google base model to use.
// If not provided, the default Google model (NMT) will be used
string model = 6 [(google.api.field_behavior) = OPTIONAL];

// Optional. Glossary to be applied. The glossary must be
Expand Down Expand Up @@ -283,6 +282,8 @@ message TranslateTextResponse {
// A single translation response.
message Translation {
// Text translated into the target language.
// If an error occurs during translation, this field might be excluded from
// the response.
string translated_text = 1;

// Only present when `model` is present in the request.
Expand Down Expand Up @@ -316,7 +317,7 @@ message DetectLanguageRequest {
// For global calls, use `projects/{project-number-or-id}/locations/global` or
// `projects/{project-number-or-id}`.
//
// Only models within the same region, which have the same location-id, can be used.
// Only models within the same region (has same location-id) can be used.
// Otherwise an INVALID_ARGUMENT (400) error is returned.
string parent = 5 [
(google.api.field_behavior) = REQUIRED,
Expand Down Expand Up @@ -410,11 +411,10 @@ message GetSupportedLanguagesRequest {
//
// - General (built-in) models:
// `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
// `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
//
//
// Returns languages supported by the specified model.
// If missing, we get supported languages of Google general base (PBMT) model.
// If missing, we get supported languages of Google general NMT model.
string model = 2 [(google.api.field_behavior) = OPTIONAL];
}

Expand Down Expand Up @@ -523,13 +523,13 @@ message OutputConfig {
// content to output.
//
// Once a row is present in index.csv, the input/output matching never
// changes. Callers should also expect the contents in the input_file are
// changes. Callers should also expect all the content in input_file are
// processed and ready to be consumed (that is, no partial output file is
// written).
//
// Since index.csv will be updated during the process, please make
// Since index.csv will be keeping updated during the process, please make
// sure there is no custom retention policy applied on the output bucket
// that may prevent file updating.
// that may avoid file updating.
// (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy)
//
// The format of translations_file (for target language code 'trg') is:
Expand Down Expand Up @@ -674,8 +674,7 @@ message TranslateDocumentRequest {
//
// Format: `projects/{project-number-or-id}/locations/{location-id}`.
//
// For global calls, use `projects/{project-number-or-id}/locations/global` or
// `projects/{project-number-or-id}`.
// For global calls, use `projects/{project-number-or-id}/locations/global`.
//
// Non-global location is required for requests using AutoML models or custom
// glossaries.
Expand Down Expand Up @@ -717,7 +716,6 @@ message TranslateDocumentRequest {
//
// - General (built-in) models:
// `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
// `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
//
//
// If not provided, the default Google model (NMT) will be used for
Expand Down Expand Up @@ -810,7 +808,7 @@ message BatchTranslateTextRequest {
[(google.api.field_behavior) = REQUIRED];

// Optional. The models to use for translation. Map's key is target language
// code. Map's value is the model name. Value can be a built-in general model,
// code. Map's value is model name. Value can be a built-in general model,
// or an AutoML Translation model.
//
// The value format depends on model type:
Expand All @@ -820,7 +818,6 @@ message BatchTranslateTextRequest {
//
// - General (built-in) models:
// `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
// `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
//
//
// If the map is empty or a specific model is
Expand Down Expand Up @@ -1194,7 +1191,12 @@ message BatchTranslateDocumentRequest {
// Only AutoML Translation models or glossaries within the same region (have
// the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
// error is returned.
string parent = 1 [(google.api.field_behavior) = REQUIRED];
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "locations.googleapis.com/Location"
}
];

// Required. The BCP-47 language code of the input document if known, for
// example, "en-US" or "sr-Latn". Supported language codes are listed in
Expand Down Expand Up @@ -1230,7 +1232,6 @@ message BatchTranslateDocumentRequest {
//
// - General (built-in) models:
// `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
// `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
//
//
// If the map is empty or a specific model is not requested for a language
Expand Down Expand Up @@ -1261,10 +1262,10 @@ message BatchDocumentInputConfig {
// - `xlsx`,
// application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
//
// The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
// The max file size supported for `.pdf` is 1GB and the max page limit is
// The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
// The max file size to support for `.pdf` is 1GB and the max page limit is
// 1000 pages.
// The max file size supported for all input documents is 1GB.
// The max file size to support for all input documents is 1GB.
GcsSource gcs_source = 1;
}
}
Expand Down Expand Up @@ -1328,16 +1329,16 @@ message BatchDocumentOutputConfig {
// field returned by BatchTranslateDocument if at least one document is
// translated successfully.
message BatchTranslateDocumentResponse {
// Total number of pages to translate in all documents. Documents without a
// Total number of pages to translate in all documents. Documents without
// clear page definition (such as XLSX) are not counted.
int64 total_pages = 1;

// Number of successfully translated pages in all documents. Documents without
// a clear page definition (such as XLSX) are not counted.
// clear page definition (such as XLSX) are not counted.
int64 translated_pages = 2;

// Number of pages that failed to process in all documents. Documents without
// a clear page definition (such as XLSX) are not counted.
// clear page definition (such as XLSX) are not counted.
int64 failed_pages = 3;

// Number of billable pages in documents with clear page definition (such as
Expand Down
3 changes: 2 additions & 1 deletion protos/protos.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 5 additions & 11 deletions src/v3beta1/translation_service_client.ts
Expand Up @@ -476,14 +476,13 @@ export class TranslationServiceClient {
*
* - General (built-in) models:
* `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
* `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
*
*
* For global (non-regionalized) requests, use `location-id` `global`.
* For example,
* `projects/{project-number-or-id}/locations/global/models/general/nmt`.
*
* If missing, the system decides which google base model to use.
* If not provided, the default Google model (NMT) will be used
* @param {google.cloud.translation.v3beta1.TranslateTextGlossaryConfig} [request.glossaryConfig]
* Optional. Glossary to be applied. The glossary must be
* within the same region (have the same location-id) as the model, otherwise
Expand Down Expand Up @@ -599,7 +598,7 @@ export class TranslationServiceClient {
* For global calls, use `projects/{project-number-or-id}/locations/global` or
* `projects/{project-number-or-id}`.
*
* Only models within the same region, which have the same location-id, can be used.
* Only models within the same region (has same location-id) can be used.
* Otherwise an INVALID_ARGUMENT (400) error is returned.
* @param {string} [request.model]
* Optional. The language detection model to be used.
Expand Down Expand Up @@ -748,11 +747,10 @@ export class TranslationServiceClient {
*
* - General (built-in) models:
* `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
* `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
*
*
* Returns languages supported by the specified model.
* If missing, we get supported languages of Google general base (PBMT) model.
* If missing, we get supported languages of Google general NMT model.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
Expand Down Expand Up @@ -853,8 +851,7 @@ export class TranslationServiceClient {
*
* Format: `projects/{project-number-or-id}/locations/{location-id}`.
*
* For global calls, use `projects/{project-number-or-id}/locations/global` or
* `projects/{project-number-or-id}`.
* For global calls, use `projects/{project-number-or-id}/locations/global`.
*
* Non-global location is required for requests using AutoML models or custom
* glossaries.
Expand Down Expand Up @@ -889,7 +886,6 @@ export class TranslationServiceClient {
*
* - General (built-in) models:
* `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
* `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
*
*
* If not provided, the default Google model (NMT) will be used for
Expand Down Expand Up @@ -1120,7 +1116,7 @@ export class TranslationServiceClient {
* Required. Specify up to 10 language codes here.
* @param {number[]} [request.models]
* Optional. The models to use for translation. Map's key is target language
* code. Map's value is the model name. Value can be a built-in general model,
* code. Map's value is model name. Value can be a built-in general model,
* or an AutoML Translation model.
*
* The value format depends on model type:
Expand All @@ -1130,7 +1126,6 @@ export class TranslationServiceClient {
*
* - General (built-in) models:
* `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
* `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
*
*
* If the map is empty or a specific model is
Expand Down Expand Up @@ -1339,7 +1334,6 @@ export class TranslationServiceClient {
*
* - General (built-in) models:
* `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
* `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
*
*
* If the map is empty or a specific model is not requested for a language
Expand Down