diff --git a/libs/genai/langchain_google_genai/_function_utils.py b/libs/genai/langchain_google_genai/_function_utils.py index f3bfa273..829f9549 100644 --- a/libs/genai/langchain_google_genai/_function_utils.py +++ b/libs/genai/langchain_google_genai/_function_utils.py @@ -316,11 +316,17 @@ def _get_properties_from_schema(schema: Dict) -> Dict[str, Any]: properties_item["items"] = _get_items_from_schema_any(v.get("items")) if properties_item.get("type_") == glm.Type.OBJECT: - if v.get('anyOf') and isinstance(v['anyOf'], list) and isinstance(v['anyOf'][0], dict): - v = v['anyOf'][0] + if ( + v.get("anyOf") + and isinstance(v["anyOf"], list) + and isinstance(v["anyOf"][0], dict) + ): + v = v["anyOf"][0] v_properties = v.get("properties") if v_properties: - properties_item["properties"] = _get_properties_from_schema_any(v_properties) + properties_item["properties"] = _get_properties_from_schema_any( + v_properties + ) if isinstance(v_properties, dict): properties_item["required"] = [ k for k, v in v_properties.items() if "default" not in v