@@ -96,6 +96,7 @@ public Builder() {}
9696 private Object responseFormat ;
9797 private String responseMimeType ;
9898 private String previousInteractionId ;
99+ private List <Config .SpeechConfig > speechConfigs ;
99100 private Config .ImageConfig imageConfig ;
100101
101102 /**
@@ -268,16 +269,32 @@ public Builder responseFormat(Schema schema) {
268269 */
269270 public Builder imageConfig (Config .ImageConfig imageConfig ) { this .imageConfig = imageConfig ; return this ; }
270271
272+ /**
273+ * Sets the speech config.
274+ *
275+ * @param speechConfig The speech configuration.
276+ * @return This builder.
277+ */
278+ public Builder speechConfig (Config .SpeechConfig speechConfig ) { this .speechConfigs = List .of (speechConfig ); return this ; }
279+
280+ /**
281+ * Sets the speech configs.
282+ *
283+ * @param speechConfigs The speech configurations.
284+ * @return This builder.
285+ */
286+ public Builder speechConfigs (List <Config .SpeechConfig > speechConfigs ) { this .speechConfigs = speechConfigs ; return this ; }
287+
271288 /**
272289 * Builds the CreateModelInteractionParams.
273290 *
274291 * @return The CreateModelInteractionParams parameters.
275292 */
276293 public ModelInteractionParams build () {
277294 Config .GenerationConfig finalConfig = generationConfig ;
278- if (imageConfig != null ) {
295+ if (imageConfig != null || speechConfigs != null ) {
279296 if (finalConfig == null ) {
280- finalConfig = new Config .GenerationConfig (null , null , null , null , null , null , null , null , null , imageConfig );
297+ finalConfig = new Config .GenerationConfig (null , null , null , null , null , null , null , null , speechConfigs , imageConfig );
281298 } else {
282299 finalConfig = new Config .GenerationConfig (
283300 finalConfig .temperature (),
@@ -288,8 +305,8 @@ public ModelInteractionParams build() {
288305 finalConfig .thinkingLevel (),
289306 finalConfig .thinkingSummaries (),
290307 finalConfig .maxOutputTokens (),
291- finalConfig .speechConfig (),
292- imageConfig
308+ speechConfigs != null ? speechConfigs : finalConfig .speechConfig (),
309+ imageConfig != null ? imageConfig : finalConfig . imageConfig ()
293310 );
294311 }
295312 }
@@ -354,6 +371,7 @@ public Builder() {}
354371 private Object responseFormat ;
355372 private String responseMimeType ;
356373 private String previousInteractionId ;
374+ private List <Config .SpeechConfig > speechConfigs ;
357375 private Config .ImageConfig imageConfig ;
358376
359377 /**
@@ -540,16 +558,32 @@ public Builder responseFormat(String responseFormat) {
540558 */
541559 public Builder imageConfig (Config .ImageConfig imageConfig ) { this .imageConfig = imageConfig ; return this ; }
542560
561+ /**
562+ * Sets the speech config.
563+ *
564+ * @param speechConfig The speech configuration.
565+ * @return This builder.
566+ */
567+ public Builder speechConfig (Config .SpeechConfig speechConfig ) { this .speechConfigs = List .of (speechConfig ); return this ; }
568+
569+ /**
570+ * Sets the speech configs.
571+ *
572+ * @param speechConfigs The speech configurations.
573+ * @return This builder.
574+ */
575+ public Builder speechConfigs (List <Config .SpeechConfig > speechConfigs ) { this .speechConfigs = speechConfigs ; return this ; }
576+
543577 /**
544578 * Builds the CreateAgentInteractionParams.
545579 *
546580 * @return The CreateAgentInteractionParams parameters.
547581 */
548582 public AgentInteractionParams build () {
549583 Config .GenerationConfig finalConfig = generationConfig ;
550- if (imageConfig != null ) {
584+ if (imageConfig != null || speechConfigs != null ) {
551585 if (finalConfig == null ) {
552- finalConfig = new Config .GenerationConfig (null , null , null , null , null , null , null , null , null , imageConfig );
586+ finalConfig = new Config .GenerationConfig (null , null , null , null , null , null , null , null , speechConfigs , imageConfig );
553587 } else {
554588 finalConfig = new Config .GenerationConfig (
555589 finalConfig .temperature (),
@@ -560,8 +594,8 @@ public AgentInteractionParams build() {
560594 finalConfig .thinkingLevel (),
561595 finalConfig .thinkingSummaries (),
562596 finalConfig .maxOutputTokens (),
563- finalConfig .speechConfig (),
564- imageConfig
597+ speechConfigs != null ? speechConfigs : finalConfig .speechConfig (),
598+ imageConfig != null ? imageConfig : finalConfig . imageConfig ()
565599 );
566600 }
567601 }
0 commit comments