Skip to content

Commit 5904fb4

Browse files
yinghsienwucopybara-github
authored andcommitted
feat: Support RealtimeInputConfig, and language_code in SpeechConfig in python
Fix system instruction in LiveConnectConfig PiperOrigin-RevId: 743637605
1 parent 4665524 commit 5904fb4

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

examples/src/main/java/com/google/genai/examples/LiveAudioConversationAsync.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ public static void main(String[] args) throws LineUnavailableException {
154154
.prebuiltVoiceConfig(
155155
PrebuiltVoiceConfig.builder().voiceName(voiceName).build())
156156
.build())
157+
.languageCode("en-US")
157158
.build())
158159
.build();
159160

src/main/java/com/google/genai/Models.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,13 @@ ObjectNode SpeechConfigToMldev(
534534
toObject));
535535
}
536536

537+
if (Common.getValueByPath(fromObject, new String[] {"languageCode"}) != null) {
538+
Common.setValueByPath(
539+
toObject,
540+
new String[] {"languageCode"},
541+
Common.getValueByPath(fromObject, new String[] {"languageCode"}));
542+
}
543+
537544
return toObject;
538545
}
539546

@@ -1666,6 +1673,13 @@ ObjectNode SpeechConfigToVertex(
16661673
toObject));
16671674
}
16681675

1676+
if (Common.getValueByPath(fromObject, new String[] {"languageCode"}) != null) {
1677+
Common.setValueByPath(
1678+
toObject,
1679+
new String[] {"languageCode"},
1680+
Common.getValueByPath(fromObject, new String[] {"languageCode"}));
1681+
}
1682+
16691683
return toObject;
16701684
}
16711685

src/main/java/com/google/genai/types/SpeechConfig.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ public abstract class SpeechConfig extends JsonSerializable {
3333
@JsonProperty("voiceConfig")
3434
public abstract Optional<VoiceConfig> voiceConfig();
3535

36+
/**
37+
* Language code (ISO 639. e.g. en-US) for the speech synthesization. Only available for Live API.
38+
*/
39+
@JsonProperty("languageCode")
40+
public abstract Optional<String> languageCode();
41+
3642
/** Instantiates a builder for SpeechConfig. */
3743
public static Builder builder() {
3844
return new AutoValue_SpeechConfig.Builder();
@@ -53,6 +59,9 @@ private static Builder create() {
5359
@JsonProperty("voiceConfig")
5460
public abstract Builder voiceConfig(VoiceConfig voiceConfig);
5561

62+
@JsonProperty("languageCode")
63+
public abstract Builder languageCode(String languageCode);
64+
5665
public abstract SpeechConfig build();
5766
}
5867

0 commit comments

Comments
 (0)