@devries-cameron20 / composio-1 / commits / c70a09e64
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Fix union types

haxzie committed Sep 29, 2025 at 16:47 UTC c70a09e64be1c8ff0e147ffd31509d0068b3af66
1 file changed +2 -11
python/composio/utils/shared.py
+2 -11
@@ -58,17 +58,8 @@ def json_schema_to_pydantic_type(
58 ]
59 if len(pydantic_types) == 1:
60 return pydantic_types[0]
61 - if len(pydantic_types) == 2:
62 - return t.Union[
63 - t.cast(t.Type, pydantic_types[0]), t.cast(t.Type, pydantic_types[1])
64 - ]
65 - if len(pydantic_types) == 3:
66 - return t.Union[
67 - t.cast(t.Type, pydantic_types[0]),
68 - t.cast(t.Type, pydantic_types[1]),
69 - t.cast(t.Type, pydantic_types[2]),
70 - ]
71 - raise ValueError("Invalid 'oneOf' schema")
61 + # Create Union with any number of types
62 + return t.Union[tuple(t.cast(t.Type, ptype) for ptype in pydantic_types)]
63
64 # Add fallback type - string
65 if "type" not in json_schema: