Skip to content

Commit f2e199d

Browse files
jaycee-licopybara-github
authored andcommitted
feat: Add enableEnhancedCivicAnswers feature in GenerateContentConfig
PiperOrigin-RevId: 841973502
1 parent 49aad61 commit f2e199d

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

Google.GenAI/Batches.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,13 @@ internal JsonNode GenerateContentConfigToMldev(ApiClient apiClient, JsonNode fro
10531053
toObject));
10541054
}
10551055

1056+
if (Common.GetValueByPath(fromObject, new string[] { "enableEnhancedCivicAnswers" }) !=
1057+
null) {
1058+
Common.SetValueByPath(
1059+
toObject, new string[] { "enableEnhancedCivicAnswers" },
1060+
Common.GetValueByPath(fromObject, new string[] { "enableEnhancedCivicAnswers" }));
1061+
}
1062+
10561063
return toObject;
10571064
}
10581065

Google.GenAI/Models.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,13 @@ internal JsonNode GenerateContentConfigToMldev(ApiClient apiClient, JsonNode fro
10951095
toObject));
10961096
}
10971097

1098+
if (Common.GetValueByPath(fromObject, new string[] { "enableEnhancedCivicAnswers" }) !=
1099+
null) {
1100+
Common.SetValueByPath(
1101+
toObject, new string[] { "enableEnhancedCivicAnswers" },
1102+
Common.GetValueByPath(fromObject, new string[] { "enableEnhancedCivicAnswers" }));
1103+
}
1104+
10981105
return toObject;
10991106
}
11001107

@@ -1270,6 +1277,12 @@ internal JsonNode GenerateContentConfigToVertex(ApiClient apiClient, JsonNode fr
12701277
toObject));
12711278
}
12721279

1280+
if (!Common.IsZero(
1281+
Common.GetValueByPath(fromObject, new string[] { "enableEnhancedCivicAnswers" }))) {
1282+
throw new NotSupportedException(
1283+
"enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");
1284+
}
1285+
12731286
return toObject;
12741287
}
12751288

Google.GenAI/types/GenerateContentConfig.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,17 @@ public ImageConfig
350350
get; set;
351351
}
352352

353+
/// <summary>
354+
/// Enables enhanced civic answers. It may not be available for all models. This field is not
355+
/// supported in Vertex AI.
356+
/// </summary>
357+
[JsonPropertyName("enableEnhancedCivicAnswers")]
358+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
359+
public bool
360+
? EnableEnhancedCivicAnswers {
361+
get; set;
362+
}
363+
353364
/// <summary>
354365
/// Deserializes a JSON string to a GenerateContentConfig object.
355366
/// </summary>

0 commit comments

Comments
 (0)