From 5b26495ebafc43d649cca2f321f8cd0683de2884 Mon Sep 17 00:00:00 2001 From: Shifat Rahman Date: Wed, 30 Apr 2025 01:54:35 +1000 Subject: [PATCH] fix(transformers): handle None schema type in process_schema function --- google/genai/_transformers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/google/genai/_transformers.py b/google/genai/_transformers.py index 3678912a..e69df71a 100644 --- a/google/genai/_transformers.py +++ b/google/genai/_transformers.py @@ -722,9 +722,10 @@ def _recurse(sub_schema: dict[str, Any]) -> dict[str, Any]: return schema_type = schema.get('type') - if isinstance(schema_type, Enum): - schema_type = schema_type.value - schema_type = schema_type.upper() + if schema_type is not None: + if isinstance(schema_type, Enum): + schema_type = schema_type.value + schema_type = schema_type.upper() # model_json_schema() returns a schema with a 'const' field when a Literal with one value is provided as a pydantic field # For example `genre: Literal['action']` becomes: {'const': 'action', 'title': 'Genre', 'type': 'string'}