@@ -113,6 +113,12 @@ public class GoogleGenAiChatOptions implements ToolCallingChatOptions {
113113 */
114114 private @ JsonProperty ("thinkingBudget" ) Integer thinkingBudget ;
115115
116+ /**
117+ * Optional. Response Modalities.
118+ * @see com.google.genai.types.Modality.Known
119+ */
120+ private @ JsonProperty ("responseModalities" ) List <String > responseModalities = new ArrayList <>();
121+
116122 /**
117123 * Collection of {@link ToolCallback}s to be used for tool calling in the chat
118124 * completion requests.
@@ -174,6 +180,7 @@ public static GoogleGenAiChatOptions fromOptions(GoogleGenAiChatOptions fromOpti
174180 options .setToolContext (fromOptions .getToolContext ());
175181 options .setThinkingBudget (fromOptions .getThinkingBudget ());
176182 options .setLabels (fromOptions .getLabels ());
183+ options .setResponseModalities (fromOptions .getResponseModalities ());
177184 return options ;
178185 }
179186
@@ -355,6 +362,15 @@ public void setToolContext(Map<String, Object> toolContext) {
355362 this .toolContext = toolContext ;
356363 }
357364
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+
358374 @ Override
359375 public boolean equals (Object o ) {
360376 if (this == o ) {
@@ -376,15 +392,17 @@ public boolean equals(Object o) {
376392 && Objects .equals (this .toolNames , that .toolNames )
377393 && Objects .equals (this .safetySettings , that .safetySettings )
378394 && 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 );
380397 }
381398
382399 @ Override
383400 public int hashCode () {
384401 return Objects .hash (this .stopSequences , this .temperature , this .topP , this .topK , this .candidateCount ,
385402 this .frequencyPenalty , this .presencePenalty , this .thinkingBudget , this .maxOutputTokens , this .model ,
386403 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 );
388406 }
389407
390408 @ Override
@@ -396,7 +414,7 @@ public String toString() {
396414 + this .model + '\'' + ", responseMimeType='" + this .responseMimeType + '\'' + ", toolCallbacks="
397415 + this .toolCallbacks + ", toolNames=" + this .toolNames + ", googleSearchRetrieval="
398416 + this .googleSearchRetrieval + ", safetySettings=" + this .safetySettings + ", labels=" + this .labels
399- + '}' ;
417+ + ", responseModalities=" + this . responseModalities + '}' ;
400418 }
401419
402420 @ Override
@@ -530,6 +548,18 @@ public Builder labels(Map<String, String> labels) {
530548 return this ;
531549 }
532550
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+
533563 public GoogleGenAiChatOptions build () {
534564 return this .options ;
535565 }
0 commit comments