From c7b9d41deb7625eab3337a65f562e7e5b1b41517 Mon Sep 17 00:00:00 2001 From: Amy Wu Date: Fri, 29 May 2026 11:49:56 -0700 Subject: [PATCH] feat!: support speech to speech translation in Gemini Live PiperOrigin-RevId: 923527030 --- live_converters.go | 10 +++++----- types.go | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/live_converters.go b/live_converters.go index 070ece64..2c2afcff 100644 --- a/live_converters.go +++ b/live_converters.go @@ -547,9 +547,9 @@ func liveConnectConfigToMldev(fromObject map[string]any, parentObject map[string InternalSetValueByPath(parentObject, []string{"setup", "safetySettings"}, fromSafetySettings) } - fromStreamTranslationConfig := InternalGetValueByPath(fromObject, []string{"streamTranslationConfig"}) - if fromStreamTranslationConfig != nil { - InternalSetValueByPath(parentObject, []string{"setup", "generationConfig", "streamTranslationConfig"}, fromStreamTranslationConfig) + fromStreamingTranslationConfig := InternalGetValueByPath(fromObject, []string{"streamingTranslationConfig"}) + if fromStreamingTranslationConfig != nil { + InternalSetValueByPath(parentObject, []string{"setup", "generationConfig", "streamingTranslationConfig"}, fromStreamingTranslationConfig) } return toObject, nil @@ -693,8 +693,8 @@ func liveConnectConfigToVertex(fromObject map[string]any, parentObject map[strin InternalSetValueByPath(parentObject, []string{"setup", "safetySettings"}, fromSafetySettings) } - if InternalGetValueByPath(fromObject, []string{"streamTranslationConfig"}) != nil { - return nil, fmt.Errorf("streamTranslationConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.") + if InternalGetValueByPath(fromObject, []string{"streamingTranslationConfig"}) != nil { + return nil, fmt.Errorf("streamingTranslationConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.") } return toObject, nil diff --git a/types.go b/types.go index d66b789b..90dc4d78 100644 --- a/types.go +++ b/types.go @@ -7631,7 +7631,7 @@ type LiveClientMessage struct { } // Config for stream translation. -type StreamTranslationConfig struct { +type StreamingTranslationConfig struct { // 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. @@ -7715,8 +7715,8 @@ type LiveConnectConfig struct { // Optional. Safety settings in the request to block unsafe content in the // response. SafetySettings []*SafetySetting `json:"safetySettings,omitempty"` - // Optional. Config for stream translation. - StreamTranslationConfig *StreamTranslationConfig `json:"streamTranslationConfig,omitempty"` + // Optional. Config for streaming translation. + StreamingTranslationConfig *StreamingTranslationConfig `json:"streamingTranslationConfig,omitempty"` } // Parameters for sending client content to the live API.