Skip to content

Commit a9c6028

Browse files
yoshi-automationsofisl
authored andcommitted
feat(translate): update the API
#### translate:v3 The following keys were added: - schemas.AdaptiveMtTranslateRequest.properties.glossaryConfig.$ref - schemas.AdaptiveMtTranslateRequest.properties.glossaryConfig.description - schemas.AdaptiveMtTranslateRequest.properties.referenceSentenceConfig.$ref - schemas.AdaptiveMtTranslateRequest.properties.referenceSentenceConfig.description - schemas.AdaptiveMtTranslateResponse.properties.glossaryTranslations.description - schemas.AdaptiveMtTranslateResponse.properties.glossaryTranslations.items.$ref - schemas.AdaptiveMtTranslateResponse.properties.glossaryTranslations.type - schemas.ReferenceSentenceConfig.description - schemas.ReferenceSentenceConfig.id - schemas.ReferenceSentenceConfig.properties.referenceSentencePairLists.description - schemas.ReferenceSentenceConfig.properties.referenceSentencePairLists.items.$ref - schemas.ReferenceSentenceConfig.properties.referenceSentencePairLists.type - schemas.ReferenceSentenceConfig.properties.sourceLanguageCode.description - schemas.ReferenceSentenceConfig.properties.sourceLanguageCode.type - schemas.ReferenceSentenceConfig.properties.targetLanguageCode.description - schemas.ReferenceSentenceConfig.properties.targetLanguageCode.type - schemas.ReferenceSentenceConfig.type - schemas.ReferenceSentencePair.description - schemas.ReferenceSentencePair.id - schemas.ReferenceSentencePair.properties.sourceSentence.description - schemas.ReferenceSentencePair.properties.sourceSentence.type - schemas.ReferenceSentencePair.properties.targetSentence.description - schemas.ReferenceSentencePair.properties.targetSentence.type - schemas.ReferenceSentencePair.type - schemas.ReferenceSentencePairList.description - schemas.ReferenceSentencePairList.id - schemas.ReferenceSentencePairList.properties.referenceSentencePairs.description - schemas.ReferenceSentencePairList.properties.referenceSentencePairs.items.$ref - schemas.ReferenceSentencePairList.properties.referenceSentencePairs.type - schemas.ReferenceSentencePairList.type The following keys were changed: - resources.projects.resources.locations.resources.glossaries.methods.patch.scopes - resources.projects.resources.locations.resources.glossaries.resources.glossaryEntries.methods.patch.parameters.name.description - schemas.AdaptiveMtTranslateRequest.properties.content.description - schemas.GlossaryEntry.properties.name.description - schemas.TranslateTextRequest.properties.model.description
1 parent c1833ab commit a9c6028

File tree

2 files changed

+128
-10
lines changed

2 files changed

+128
-10
lines changed

discovery/translate-v3.json

Lines changed: 73 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,8 @@
12601260
"$ref": "Operation"
12611261
},
12621262
"scopes": [
1263-
"https://www.googleapis.com/auth/cloud-platform"
1263+
"https://www.googleapis.com/auth/cloud-platform",
1264+
"https://www.googleapis.com/auth/cloud-translation"
12641265
]
12651266
}
12661267
},
@@ -1395,7 +1396,7 @@
13951396
],
13961397
"parameters": {
13971398
"name": {
1398-
"description": "Required. The resource name of the entry. Format: \"projects/*/locations/*/glossaries/*/glossaryEntries/*\"",
1399+
"description": "Identifier. The resource name of the entry. Format: \"projects/*/locations/*/glossaries/*/glossaryEntries/*\"",
13991400
"location": "path",
14001401
"pattern": "^projects/[^/]+/locations/[^/]+/glossaries/[^/]+/glossaryEntries/[^/]+$",
14011402
"required": true,
@@ -1706,7 +1707,7 @@
17061707
}
17071708
}
17081709
},
1709-
"revision": "20240126",
1710+
"revision": "20240718",
17101711
"rootUrl": "https://translation.googleapis.com/",
17111712
"schemas": {
17121713
"AdaptiveMtDataset": {
@@ -1817,7 +1818,7 @@
18171818
"id": "AdaptiveMtTranslateRequest",
18181819
"properties": {
18191820
"content": {
1820-
"description": "Required. The content of the input in string format. For now only one sentence per request is supported.",
1821+
"description": "Required. The content of the input in string format.",
18211822
"items": {
18221823
"type": "string"
18231824
},
@@ -1826,6 +1827,14 @@
18261827
"dataset": {
18271828
"description": "Required. The resource name for the dataset to use for adaptive MT. `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`",
18281829
"type": "string"
1830+
},
1831+
"glossaryConfig": {
1832+
"$ref": "TranslateTextGlossaryConfig",
1833+
"description": "Optional. Glossary to be applied. The glossary must be within the same region (have the same location-id) as the model, otherwise an INVALID_ARGUMENT (400) error is returned."
1834+
},
1835+
"referenceSentenceConfig": {
1836+
"$ref": "ReferenceSentenceConfig",
1837+
"description": "Configuration for caller provided reference sentences."
18291838
}
18301839
},
18311840
"type": "object"
@@ -1834,6 +1843,13 @@
18341843
"description": "An AdaptiveMtTranslate response.",
18351844
"id": "AdaptiveMtTranslateResponse",
18361845
"properties": {
1846+
"glossaryTranslations": {
1847+
"description": "Text translation response if a glossary is provided in the request. This could be the same as 'translation' above if no terms apply.",
1848+
"items": {
1849+
"$ref": "AdaptiveMtTranslation"
1850+
},
1851+
"type": "array"
1852+
},
18371853
"languageCode": {
18381854
"description": "Output only. The translation's language code.",
18391855
"readOnly": true,
@@ -2360,7 +2376,7 @@
23602376
"type": "string"
23612377
},
23622378
"name": {
2363-
"description": "Required. The resource name of the entry. Format: \"projects/*/locations/*/glossaries/*/glossaryEntries/*\"",
2379+
"description": "Identifier. The resource name of the entry. Format: \"projects/*/locations/*/glossaries/*/glossaryEntries/*\"",
23642380
"type": "string"
23652381
},
23662382
"termsPair": {
@@ -2848,6 +2864,57 @@
28482864
},
28492865
"type": "object"
28502866
},
2867+
"ReferenceSentenceConfig": {
2868+
"description": "Message of caller-provided reference configuration.",
2869+
"id": "ReferenceSentenceConfig",
2870+
"properties": {
2871+
"referenceSentencePairLists": {
2872+
"description": "Reference sentences pair lists. Each list will be used as the references to translate the sentence under \"content\" field at the corresponding index. Length of the list is required to be equal to the length of \"content\" field.",
2873+
"items": {
2874+
"$ref": "ReferenceSentencePairList"
2875+
},
2876+
"type": "array"
2877+
},
2878+
"sourceLanguageCode": {
2879+
"description": "Source language code.",
2880+
"type": "string"
2881+
},
2882+
"targetLanguageCode": {
2883+
"description": "Target language code.",
2884+
"type": "string"
2885+
}
2886+
},
2887+
"type": "object"
2888+
},
2889+
"ReferenceSentencePair": {
2890+
"description": "A pair of sentences used as reference in source and target languages.",
2891+
"id": "ReferenceSentencePair",
2892+
"properties": {
2893+
"sourceSentence": {
2894+
"description": "Source sentence in the sentence pair.",
2895+
"type": "string"
2896+
},
2897+
"targetSentence": {
2898+
"description": "Target sentence in the sentence pair.",
2899+
"type": "string"
2900+
}
2901+
},
2902+
"type": "object"
2903+
},
2904+
"ReferenceSentencePairList": {
2905+
"description": "A list of reference sentence pairs.",
2906+
"id": "ReferenceSentencePairList",
2907+
"properties": {
2908+
"referenceSentencePairs": {
2909+
"description": "Reference sentence pairs.",
2910+
"items": {
2911+
"$ref": "ReferenceSentencePair"
2912+
},
2913+
"type": "array"
2914+
}
2915+
},
2916+
"type": "object"
2917+
},
28512918
"Romanization": {
28522919
"description": "A single romanization response.",
28532920
"id": "Romanization",
@@ -3078,7 +3145,7 @@
30783145
"type": "string"
30793146
},
30803147
"model": {
3081-
"description": "Optional. The `model` type requested for this translation. The format depends on model type: - AutoML Translation models: `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - General (built-in) models: `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, For global (non-regionalized) requests, use `location-id` `global`. For example, `projects/{project-number-or-id}/locations/global/models/general/nmt`. If not provided, the default Google model (NMT) will be used",
3148+
"description": "Optional. The `model` type requested for this translation. The format depends on model type: - AutoML Translation models: `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - General (built-in) models: `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, - Translation LLM models: `projects/{project-number-or-id}/locations/{location-id}/models/general/translation-llm`, For global (non-regionalized) requests, use `location-id` `global`. For example, `projects/{project-number-or-id}/locations/global/models/general/nmt`. If not provided, the default Google model (NMT) will be used",
30823149
"type": "string"
30833150
},
30843151
"sourceLanguageCode": {

src/apis/translate/v3.ts

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,18 +212,30 @@ export namespace translate_v3 {
212212
*/
213213
export interface Schema$AdaptiveMtTranslateRequest {
214214
/**
215-
* Required. The content of the input in string format. For now only one sentence per request is supported.
215+
* Required. The content of the input in string format.
216216
*/
217217
content?: string[] | null;
218218
/**
219219
* Required. The resource name for the dataset to use for adaptive MT. `projects/{project\}/locations/{location-id\}/adaptiveMtDatasets/{dataset\}`
220220
*/
221221
dataset?: string | null;
222+
/**
223+
* Optional. Glossary to be applied. The glossary must be within the same region (have the same location-id) as the model, otherwise an INVALID_ARGUMENT (400) error is returned.
224+
*/
225+
glossaryConfig?: Schema$TranslateTextGlossaryConfig;
226+
/**
227+
* Configuration for caller provided reference sentences.
228+
*/
229+
referenceSentenceConfig?: Schema$ReferenceSentenceConfig;
222230
}
223231
/**
224232
* An AdaptiveMtTranslate response.
225233
*/
226234
export interface Schema$AdaptiveMtTranslateResponse {
235+
/**
236+
* Text translation response if a glossary is provided in the request. This could be the same as 'translation' above if no terms apply.
237+
*/
238+
glossaryTranslations?: Schema$AdaptiveMtTranslation[];
227239
/**
228240
* Output only. The translation's language code.
229241
*/
@@ -628,7 +640,7 @@ export namespace translate_v3 {
628640
*/
629641
description?: string | null;
630642
/**
631-
* Required. The resource name of the entry. Format: "projects/x/locations/x/glossaries/x/glossaryEntries/x"
643+
* Identifier. The resource name of the entry. Format: "projects/x/locations/x/glossaries/x/glossaryEntries/x"
632644
*/
633645
name?: string | null;
634646
/**
@@ -997,6 +1009,45 @@ export namespace translate_v3 {
9971009
*/
9981010
gcsDestination?: Schema$GcsDestination;
9991011
}
1012+
/**
1013+
* Message of caller-provided reference configuration.
1014+
*/
1015+
export interface Schema$ReferenceSentenceConfig {
1016+
/**
1017+
* Reference sentences pair lists. Each list will be used as the references to translate the sentence under "content" field at the corresponding index. Length of the list is required to be equal to the length of "content" field.
1018+
*/
1019+
referenceSentencePairLists?: Schema$ReferenceSentencePairList[];
1020+
/**
1021+
* Source language code.
1022+
*/
1023+
sourceLanguageCode?: string | null;
1024+
/**
1025+
* Target language code.
1026+
*/
1027+
targetLanguageCode?: string | null;
1028+
}
1029+
/**
1030+
* A pair of sentences used as reference in source and target languages.
1031+
*/
1032+
export interface Schema$ReferenceSentencePair {
1033+
/**
1034+
* Source sentence in the sentence pair.
1035+
*/
1036+
sourceSentence?: string | null;
1037+
/**
1038+
* Target sentence in the sentence pair.
1039+
*/
1040+
targetSentence?: string | null;
1041+
}
1042+
/**
1043+
* A list of reference sentence pairs.
1044+
*/
1045+
export interface Schema$ReferenceSentencePairList {
1046+
/**
1047+
* Reference sentence pairs.
1048+
*/
1049+
referenceSentencePairs?: Schema$ReferenceSentencePair[];
1050+
}
10001051
/**
10011052
* A single romanization response.
10021053
*/
@@ -1183,7 +1234,7 @@ export namespace translate_v3 {
11831234
*/
11841235
mimeType?: string | null;
11851236
/**
1186-
* Optional. The `model` type requested for this translation. The format depends on model type: - AutoML Translation models: `projects/{project-number-or-id\}/locations/{location-id\}/models/{model-id\}` - General (built-in) models: `projects/{project-number-or-id\}/locations/{location-id\}/models/general/nmt`, For global (non-regionalized) requests, use `location-id` `global`. For example, `projects/{project-number-or-id\}/locations/global/models/general/nmt`. If not provided, the default Google model (NMT) will be used
1237+
* Optional. The `model` type requested for this translation. The format depends on model type: - AutoML Translation models: `projects/{project-number-or-id\}/locations/{location-id\}/models/{model-id\}` - General (built-in) models: `projects/{project-number-or-id\}/locations/{location-id\}/models/general/nmt`, - Translation LLM models: `projects/{project-number-or-id\}/locations/{location-id\}/models/general/translation-llm`, For global (non-regionalized) requests, use `location-id` `global`. For example, `projects/{project-number-or-id\}/locations/global/models/general/nmt`. If not provided, the default Google model (NMT) will be used
11871238
*/
11881239
model?: string | null;
11891240
/**
@@ -5580,7 +5631,7 @@ export namespace translate_v3 {
55805631
export interface Params$Resource$Projects$Locations$Glossaries$Glossaryentries$Patch
55815632
extends StandardParameters {
55825633
/**
5583-
* Required. The resource name of the entry. Format: "projects/x/locations/x/glossaries/x/glossaryEntries/x"
5634+
* Identifier. The resource name of the entry. Format: "projects/x/locations/x/glossaries/x/glossaryEntries/x"
55845635
*/
55855636
name?: string;
55865637

0 commit comments

Comments
 (0)