Skip to content

Commit

Permalink
fix: issue with undefined 'properties' in langchain tools
Browse files Browse the repository at this point in the history
  • Loading branch information
utkarsh-dixit committed Mar 24, 2024
1 parent 47a78a2 commit 8136434
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion langchain/composio_langchain/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .composio_tool_spec import ComposioToolset
from .composio_tool_spec import ComposioToolset, client
from composio import Action, App
7 changes: 4 additions & 3 deletions langchain/composio_langchain/composio_tool_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(" ", "")

Expand Down Expand Up @@ -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]

0 comments on commit 8136434

Please sign in to comment.