Skip to content

Commit 307896a

Browse files
GWealecopybara-github
authored andcommitted
fix: Exclude additionalProperties from Gemini schemas
PiperOrigin-RevId: 820542466
1 parent 6dcbb5a commit 307896a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/google/adk/tools/_gemini_schema_util.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ def _sanitize_schema_formats_for_gemini(
142142
) -> dict[str, Any]:
143143
"""Filters the schema to only include fields that are supported by JSONSchema."""
144144
supported_fields: set[str] = set(_ExtendedJSONSchema.model_fields.keys())
145-
schema_field_names: set[str] = {"items"} # 'additional_properties' to come
145+
# Gemini rejects schemas that include `additionalProperties`, so drop it.
146+
supported_fields.discard("additional_properties")
147+
schema_field_names: set[str] = {"items"}
146148
list_schema_field_names: set[str] = {
147149
"any_of", # 'one_of', 'all_of', 'not' to come
148150
}

0 commit comments

Comments
 (0)