Skip to content

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

Merge branch 'fix/cross-sdk-json-schema-object-conversion' into fix/python-provider-argument-serialization

Alberto Schiabel82e25a603e86
diff --cc python/composio/utils/shared.py
index 2b3debb0a,87d75e782..7faa3e8be
--- a/python/composio/utils/shared.py
+++ b/python/composio/utils/shared.py
@@@ -487,21 -463,14 +494,22 @@@ def json_schema_to_model
prop,
json_schema.get("required", []),
skip_default=skip_default,
+ root_schema=json_schema,
)
field_definitions[updated_name] = (pydantic_type, pydantic_field)
+ if not skip_default and "default" in prop:
+ explicit_default_fields.add(updated_name)
# The dynamic-key policy is shared with `json_schema_to_pydantic_type` so the
# two entry points cannot disagree about which arguments survive conversion.
+ base_model = create_model(model_name, **field_definitions) # type: ignore
+ setattr(
+ base_model,
+ _EXPLICIT_DEFAULT_FIELDS_ATTRIBUTE,
+ frozenset(explicit_default_fields),
+ )
return apply_object_policy(
json_schema,
- create_model(model_name, **field_definitions), # type: ignore
+ base_model,
model_name=model_name,
)