Skip to content

Commit d79a95d

Browse files
yinghsienwucopybara-github
authored andcommitted
feat: support speech to speech translation in Gemini Live
PiperOrigin-RevId: 914523879
1 parent 9087494 commit d79a95d

11 files changed

Lines changed: 69 additions & 12 deletions

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "2.2.0"
2+
".": "2.1.0"
33
}

CHANGELOG.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22

33

44

5-
## [2.2.0](https://github.com/googleapis/js-genai/compare/v2.1.0...v2.2.0) (2026-05-12)
6-
7-
8-
### Features
9-
10-
* Added missing FunctionCallResultDelta type and `arguments` field to the ArgumentDelta type ([f76138b](https://github.com/googleapis/js-genai/commit/f76138b5368fa3f6418e84214493fb874e748fea))
11-
125
## [2.1.0](https://github.com/googleapis/js-genai/compare/v2.0.1...v2.1.0) (2026-05-12)
136

147

api-report/genai-node.api.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2487,6 +2487,7 @@ export interface LiveConnectConfig {
24872487
seed?: number;
24882488
sessionResumption?: SessionResumptionConfig;
24892489
speechConfig?: SpeechConfig;
2490+
streamTranslationConfig?: StreamTranslationConfig;
24902491
systemInstruction?: ContentUnion;
24912492
temperature?: number;
24922493
thinkingConfig?: ThinkingConfig;
@@ -3541,6 +3542,12 @@ export interface StreamableHttpTransport {
35413542
url?: string;
35423543
}
35433544

3545+
// @public
3546+
export interface StreamTranslationConfig {
3547+
echoTargetLanguage?: boolean;
3548+
targetLanguageCode?: string;
3549+
}
3550+
35443551
// @public
35453552
export interface StringList {
35463553
values?: string[];

api-report/genai-web.api.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2487,6 +2487,7 @@ export interface LiveConnectConfig {
24872487
seed?: number;
24882488
sessionResumption?: SessionResumptionConfig;
24892489
speechConfig?: SpeechConfig;
2490+
streamTranslationConfig?: StreamTranslationConfig;
24902491
systemInstruction?: ContentUnion;
24912492
temperature?: number;
24922493
thinkingConfig?: ThinkingConfig;
@@ -3541,6 +3542,12 @@ export interface StreamableHttpTransport {
35413542
url?: string;
35423543
}
35433544

3545+
// @public
3546+
export interface StreamTranslationConfig {
3547+
echoTargetLanguage?: boolean;
3548+
targetLanguageCode?: string;
3549+
}
3550+
35443551
// @public
35453552
export interface StringList {
35463553
values?: string[];

api-report/genai.api.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2487,6 +2487,7 @@ export interface LiveConnectConfig {
24872487
seed?: number;
24882488
sessionResumption?: SessionResumptionConfig;
24892489
speechConfig?: SpeechConfig;
2490+
streamTranslationConfig?: StreamTranslationConfig;
24902491
systemInstruction?: ContentUnion;
24912492
temperature?: number;
24922493
thinkingConfig?: ThinkingConfig;
@@ -3541,6 +3542,12 @@ export interface StreamableHttpTransport {
35413542
url?: string;
35423543
}
35433544

3545+
// @public
3546+
export interface StreamTranslationConfig {
3547+
echoTargetLanguage?: boolean;
3548+
targetLanguageCode?: string;
3549+
}
3550+
35443551
// @public
35453552
export interface StringList {
35463553
values?: string[];

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@google/genai",
3-
"version": "2.2.0",
3+
"version": "2.1.0",
44
"description": "",
55
"type": "module",
66
"main": "dist/node/index.mjs",

src/_api_client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
1818
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
1919
const USER_AGENT_HEADER = 'User-Agent';
2020
export const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
21-
export const SDK_VERSION = '2.2.0'; // x-release-please-version
21+
export const SDK_VERSION = '2.1.0'; // x-release-please-version
2222
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
2323
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
2424
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';

src/converters/_live_converters.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,6 +1170,17 @@ export function liveConnectConfigToMldev(
11701170
);
11711171
}
11721172

1173+
const fromStreamTranslationConfig = common.getValueByPath(fromObject, [
1174+
'streamTranslationConfig',
1175+
]);
1176+
if (parentObject !== undefined && fromStreamTranslationConfig != null) {
1177+
common.setValueByPath(
1178+
parentObject,
1179+
['setup', 'generationConfig', 'streamTranslationConfig'],
1180+
fromStreamTranslationConfig,
1181+
);
1182+
}
1183+
11731184
return toObject;
11741185
}
11751186

@@ -1413,6 +1424,14 @@ export function liveConnectConfigToVertex(
14131424
);
14141425
}
14151426

1427+
if (
1428+
common.getValueByPath(fromObject, ['streamTranslationConfig']) !== undefined
1429+
) {
1430+
throw new Error(
1431+
'streamTranslationConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.',
1432+
);
1433+
}
1434+
14161435
return toObject;
14171436
}
14181437

src/converters/_tokens_converters.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,17 @@ export function liveConnectConfigToMldev(
558558
);
559559
}
560560

561+
const fromStreamTranslationConfig = common.getValueByPath(fromObject, [
562+
'streamTranslationConfig',
563+
]);
564+
if (parentObject !== undefined && fromStreamTranslationConfig != null) {
565+
common.setValueByPath(
566+
parentObject,
567+
['setup', 'generationConfig', 'streamTranslationConfig'],
568+
fromStreamTranslationConfig,
569+
);
570+
}
571+
561572
return toObject;
562573
}
563574

0 commit comments

Comments
 (0)