Skip to content

Commit 2e1562f

Browse files
jaycee-licopybara-github
authored andcommitted
feat: Add enableEnhancedCivicAnswers feature in GenerateContentConfig
PiperOrigin-RevId: 836720742
1 parent d0b9a74 commit 2e1562f

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,13 @@ ObjectNode generateContentConfigToMldev(
12501250
toObject));
12511251
}
12521252

1253+
if (Common.getValueByPath(fromObject, new String[] {"enableEnhancedCivicAnswers"}) != null) {
1254+
Common.setValueByPath(
1255+
toObject,
1256+
new String[] {"enableEnhancedCivicAnswers"},
1257+
Common.getValueByPath(fromObject, new String[] {"enableEnhancedCivicAnswers"}));
1258+
}
1259+
12531260
return toObject;
12541261
}
12551262

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,6 +1372,13 @@ ObjectNode generateContentConfigToMldev(
13721372
toObject));
13731373
}
13741374

1375+
if (Common.getValueByPath(fromObject, new String[] {"enableEnhancedCivicAnswers"}) != null) {
1376+
Common.setValueByPath(
1377+
toObject,
1378+
new String[] {"enableEnhancedCivicAnswers"},
1379+
Common.getValueByPath(fromObject, new String[] {"enableEnhancedCivicAnswers"}));
1380+
}
1381+
13751382
return toObject;
13761383
}
13771384

@@ -1591,6 +1598,12 @@ ObjectNode generateContentConfigToVertex(
15911598
toObject));
15921599
}
15931600

1601+
if (!Common.isZero(
1602+
Common.getValueByPath(fromObject, new String[] {"enableEnhancedCivicAnswers"}))) {
1603+
throw new IllegalArgumentException(
1604+
"enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");
1605+
}
1606+
15941607
return toObject;
15951608
}
15961609

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,13 @@ public abstract class GenerateContentConfig extends JsonSerializable {
223223
@JsonProperty("imageConfig")
224224
public abstract Optional<ImageConfig> imageConfig();
225225

226+
/**
227+
* Enables enhanced civic answers. It may not be available for all models. This field is not
228+
* supported in Vertex AI.
229+
*/
230+
@JsonProperty("enableEnhancedCivicAnswers")
231+
public abstract Optional<Boolean> enableEnhancedCivicAnswers();
232+
226233
/** Instantiates a builder for GenerateContentConfig. */
227234
@ExcludeFromGeneratedCoverageReport
228235
public static Builder builder() {
@@ -1032,6 +1039,25 @@ public Builder clearImageConfig() {
10321039
return imageConfig(Optional.empty());
10331040
}
10341041

1042+
/**
1043+
* Setter for enableEnhancedCivicAnswers.
1044+
*
1045+
* <p>enableEnhancedCivicAnswers: Enables enhanced civic answers. It may not be available for
1046+
* all models. This field is not supported in Vertex AI.
1047+
*/
1048+
@JsonProperty("enableEnhancedCivicAnswers")
1049+
public abstract Builder enableEnhancedCivicAnswers(boolean enableEnhancedCivicAnswers);
1050+
1051+
@ExcludeFromGeneratedCoverageReport
1052+
abstract Builder enableEnhancedCivicAnswers(Optional<Boolean> enableEnhancedCivicAnswers);
1053+
1054+
/** Clears the value of enableEnhancedCivicAnswers field. */
1055+
@ExcludeFromGeneratedCoverageReport
1056+
@CanIgnoreReturnValue
1057+
public Builder clearEnableEnhancedCivicAnswers() {
1058+
return enableEnhancedCivicAnswers(Optional.empty());
1059+
}
1060+
10351061
public abstract GenerateContentConfig build();
10361062
}
10371063

0 commit comments

Comments
 (0)