Skip to content

Commit

Permalink
after make format
Browse files Browse the repository at this point in the history
  • Loading branch information
MahlerTom committed Dec 19, 2024
1 parent 0adac0e commit c246124
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions libs/genai/langchain_google_genai/_function_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c246124

Please sign in to comment.