diff --git a/langchain/composio_langchain/__init__.py b/langchain/composio_langchain/__init__.py index 11ffc369f93..c4d1a3fc600 100644 --- a/langchain/composio_langchain/__init__.py +++ b/langchain/composio_langchain/__init__.py @@ -1,2 +1,2 @@ -from .composio_tool_spec import ComposioToolset +from .composio_tool_spec import ComposioToolset, client from composio import Action, App \ No newline at end of file diff --git a/langchain/composio_langchain/composio_tool_spec.py b/langchain/composio_langchain/composio_tool_spec.py index 653c40f18db..46727197cd5 100644 --- a/langchain/composio_langchain/composio_tool_spec.py +++ b/langchain/composio_langchain/composio_tool_spec.py @@ -56,8 +56,8 @@ def get_signature_format_from_schema_params( ): parameters = [] required_params = schema_params.get('required', []) - - for param_name, param_schema in schema_params['properties'].items(): + schema_parms_object = schema_params.get('items', {}) + for param_name, param_schema in schema_parms_object.items(): param_type = param_schema['type'] param_title = param_schema['title'].replace(" ", "") @@ -105,9 +105,10 @@ def ComposioTool(client : ComposioCore, action_schema: dict[str, any]) -> Struc func = action_func ) +client = ComposioCore() + def ComposioToolset(apps: List[App] = [], actions: List[Action] = []) -> List[StructuredTool]: if len(apps) >0 and len(actions) > 0: raise ValueError("You must provide either a list of tools or a list of actions, not both") - client = ComposioCore() actions_list = client.sdk.get_list_of_actions(apps, actions) return [ComposioTool(client, action) for action in actions_list]