Skip to content

Commit 2a5c1d4

Browse files
google-genai-botcopybara-github
authored andcommitted
feat: Add translation_config SDK support for GEAP.
PiperOrigin-RevId: 971644297
1 parent 4467faf commit 2a5c1d4

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/converters/_live_converters.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,9 +1507,14 @@ export function liveConnectConfigToVertex(
15071507
);
15081508
}
15091509

1510-
if (common.getValueByPath(fromObject, ['translationConfig']) !== undefined) {
1511-
throw new Error(
1512-
'translationConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.',
1510+
const fromTranslationConfig = common.getValueByPath(fromObject, [
1511+
'translationConfig',
1512+
]);
1513+
if (parentObject !== undefined && fromTranslationConfig != null) {
1514+
common.setValueByPath(
1515+
parentObject,
1516+
['setup', 'generationConfig', 'translationConfig'],
1517+
fromTranslationConfig,
15131518
);
15141519
}
15151520

src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4766,9 +4766,9 @@ export class ResponseFormat {
47664766

47674767
/** Config for stream translation. */
47684768
export declare interface TranslationConfig {
4769-
/** Optional. If true, the model will generate audio when the target language is spoken, essentially it will parrot the input. If false, we will not produce audio for the target language. */
4769+
/** If true, the model will generate audio when the target language is spoken, essentially it will parrot the input. If false, we will not produce audio for the target language. */
47704770
echoTargetLanguage?: boolean;
4771-
/** Required. The target language for translation. Supported values are BCP-47 language codes (e.g. "en", "es", "fr"). */
4771+
/** The target language for translation. Supported values are BCP-47 language codes (e.g. "en", "es", "fr"). */
47724772
targetLanguageCode?: string;
47734773
}
47744774

0 commit comments

Comments
 (0)