@@ -113,6 +113,12 @@ public class GoogleGenAiChatOptions implements ToolCallingChatOptions {
113
113
*/
114
114
private @ JsonProperty ("thinkingBudget" ) Integer thinkingBudget ;
115
115
116
+ /**
117
+ * Optional. Response Modalities.
118
+ * @see com.google.genai.types.Modality.Known
119
+ */
120
+ private @ JsonProperty ("responseModalities" ) List <String > responseModalities = new ArrayList <>();
121
+
116
122
/**
117
123
* Collection of {@link ToolCallback}s to be used for tool calling in the chat
118
124
* completion requests.
@@ -174,6 +180,7 @@ public static GoogleGenAiChatOptions fromOptions(GoogleGenAiChatOptions fromOpti
174
180
options .setToolContext (fromOptions .getToolContext ());
175
181
options .setThinkingBudget (fromOptions .getThinkingBudget ());
176
182
options .setLabels (fromOptions .getLabels ());
183
+ options .setResponseModalities (fromOptions .getResponseModalities ());
177
184
return options ;
178
185
}
179
186
@@ -355,6 +362,15 @@ public void setToolContext(Map<String, Object> toolContext) {
355
362
this .toolContext = toolContext ;
356
363
}
357
364
365
+ public List <String > getResponseModalities () {
366
+ return responseModalities ;
367
+ }
368
+
369
+ public void setResponseModalities (List <String > responseModalities ) {
370
+ Assert .notNull (responseModalities , "responseModalities cannot be null" );
371
+ this .responseModalities = responseModalities ;
372
+ }
373
+
358
374
@ Override
359
375
public boolean equals (Object o ) {
360
376
if (this == o ) {
@@ -376,15 +392,17 @@ public boolean equals(Object o) {
376
392
&& Objects .equals (this .toolNames , that .toolNames )
377
393
&& Objects .equals (this .safetySettings , that .safetySettings )
378
394
&& Objects .equals (this .internalToolExecutionEnabled , that .internalToolExecutionEnabled )
379
- && Objects .equals (this .toolContext , that .toolContext ) && Objects .equals (this .labels , that .labels );
395
+ && Objects .equals (this .toolContext , that .toolContext ) && Objects .equals (this .labels , that .labels )
396
+ && Objects .equals (this .responseModalities , that .responseModalities );
380
397
}
381
398
382
399
@ Override
383
400
public int hashCode () {
384
401
return Objects .hash (this .stopSequences , this .temperature , this .topP , this .topK , this .candidateCount ,
385
402
this .frequencyPenalty , this .presencePenalty , this .thinkingBudget , this .maxOutputTokens , this .model ,
386
403
this .responseMimeType , this .toolCallbacks , this .toolNames , this .googleSearchRetrieval ,
387
- this .safetySettings , this .internalToolExecutionEnabled , this .toolContext , this .labels );
404
+ this .safetySettings , this .internalToolExecutionEnabled , this .toolContext , this .labels ,
405
+ this .responseModalities );
388
406
}
389
407
390
408
@ Override
@@ -396,7 +414,7 @@ public String toString() {
396
414
+ this .model + '\'' + ", responseMimeType='" + this .responseMimeType + '\'' + ", toolCallbacks="
397
415
+ this .toolCallbacks + ", toolNames=" + this .toolNames + ", googleSearchRetrieval="
398
416
+ this .googleSearchRetrieval + ", safetySettings=" + this .safetySettings + ", labels=" + this .labels
399
- + '}' ;
417
+ + ", responseModalities=" + this . responseModalities + '}' ;
400
418
}
401
419
402
420
@ Override
@@ -530,6 +548,18 @@ public Builder labels(Map<String, String> labels) {
530
548
return this ;
531
549
}
532
550
551
+ public Builder responseModalities (List <String > responseModalities ) {
552
+ Assert .notNull (responseModalities , "responseModalities must not be null" );
553
+ this .options .responseModalities = responseModalities ;
554
+ return this ;
555
+ }
556
+
557
+ public Builder responseModalitie (String responseModalitie ) {
558
+ Assert .hasText (responseModalitie , "responseModalitie must not be empty" );
559
+ this .options .responseModalities .add (responseModalitie );
560
+ return this ;
561
+ }
562
+
533
563
public GoogleGenAiChatOptions build () {
534
564
return this .options ;
535
565
}
0 commit comments