Skip to content

Commit ac4e6a9

Browse files
Update src/google/adk/tools/_gemini_schema_util.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 4bf0e52 commit ac4e6a9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/google/adk/tools/_gemini_schema_util.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,16 @@ def _sanitize_schema_type(schema: dict[str, Any]) -> dict[str, Any]:
8989
non_null_type = t
9090
if not non_null_type:
9191
non_null_type = "object"
92-
if non_null_type == "array" and "items" not in schema:
93-
schema["items"] = {"type": "string"}
9492
if nullable:
9593
schema["type"] = [non_null_type, "null"]
9694
else:
9795
schema["type"] = non_null_type
9896
elif schema.get("type") == "null":
9997
schema["type"] = ["object", "null"]
100-
elif schema.get("type") == "array" and "items" not in schema:
98+
99+
type_val = schema.get("type")
100+
main_type = type_val[0] if isinstance(type_val, list) else type_val
101+
if main_type == "array" and "items" not in schema:
101102
schema["items"] = {"type": "string"}
102103

103104
return schema

0 commit comments

Comments
 (0)