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.

Fix checks

haxziea192ba648956
diff --git a/python/composio/sdk.py b/python/composio/sdk.py
index c84dcf857..dd8ac9072 100644
--- a/python/composio/sdk.py
+++ b/python/composio/sdk.py
@@ -55,7 +55,7 @@ class Composio(t.Generic[TProvider], WithLogger):
"""
tools: Tools[TProvider]
- experimental: ExperimentalNamespace[TProvider]
+ experimental: ExperimentalNamespace
def __init__(
self,
diff --git a/python/composio/utils/shared.py b/python/composio/utils/shared.py
index 3c457d7d9..e7e9b4591 100644
--- a/python/composio/utils/shared.py
+++ b/python/composio/utils/shared.py
@@ -54,16 +54,20 @@ def json_schema_to_pydantic_type(
# Handle oneOf schemas first
if "oneOf" in json_schema:
one_of_options = json_schema["oneOf"]
- pydantic_types: t.List[t.Type] = [ # type: ignore
+ pydantic_types = [
json_schema_to_pydantic_type(option) for option in one_of_options
]
- if len(pydantic_types) == 1:
- return pydantic_types[0]
+ # Filter out None values and ensure we have valid types
+ valid_types = [ptype for ptype in pydantic_types if ptype is not None]
+ if len(valid_types) == 1:
+ return valid_types[0]
+ if len(valid_types) == 0:
+ return str # fallback to string type
# Create Union with any number of types
# Cast all types and use functools.reduce to create proper Union
- cast_types = [t.cast(t.Type, ptype) for ptype in pydantic_types]
+ cast_types = [t.cast(t.Type, ptype) for ptype in valid_types]
# Use reduce to create Union[Type1, Type2, ...] properly
- return reduce(lambda a, b: t.Union[a, b], cast_types)
+ return reduce(lambda a, b: t.Union[a, b], cast_types) # type: ignore
# Add fallback type - string
if "type" not in json_schema:
diff --git a/python/config/mypy.ini b/python/config/mypy.ini
index 3cb55f6ab..c1cc41a61 100644
--- a/python/config/mypy.ini
+++ b/python/config/mypy.ini
@@ -1,8 +1,9 @@
[mypy]
-exclude=apps/composio|utils|\.nox|.*/setup\.py|.*/build/.*
+exclude = ^(apps/composio/|utils/|\.nox/|.*/setup\.py|.*/build/|examples/)
strict_optional=True
disable_error_code=var-annotated
+
; Only add packages which does not have type-stub package
[mypy-pysher.*]
ignore_missing_imports=true