Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ dependencies = [
"yfinance==0.2.50",
"wolframalpha==5.1.3",
"astra-assistants[tools]>=2.2.13,<3.0.0",
"composio==0.8.5",
"composio-langchain==0.8.5",
"composio==0.9.2",
"composio-langchain==0.9.2",
"spider-client==0.1.24",
"nltk==3.9.1",
"lark==1.2.2",
Expand Down
59 changes: 53 additions & 6 deletions src/lfx/src/lfx/base/composio/composio_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,17 @@ def _populate_actions_data(self):
if parameters_schema is None:
logger.warning(f"Parameters schema is None for action key: {action_key}")
# Still add the action but with empty fields
# Extract version information from the tool
version = tool_dict.get("version")
available_versions = tool_dict.get("available_versions", [])

self._action_schemas[action_key] = tool_dict
self._actions_data[action_key] = {
"display_name": display_name,
"action_fields": [],
"file_upload_fields": set(),
"version": version,
"available_versions": available_versions,
}
continue

Expand All @@ -488,11 +494,17 @@ def _populate_actions_data(self):
parameters_schema = parameters_schema.__dict__
else:
logger.warning(f"Cannot process parameters schema for {action_key}, skipping")
# Extract version information from the tool
version = tool_dict.get("version")
available_versions = tool_dict.get("available_versions", [])

self._action_schemas[action_key] = tool_dict
self._actions_data[action_key] = {
"display_name": display_name,
"action_fields": [],
"file_upload_fields": set(),
"version": version,
"available_versions": available_versions,
}
continue

Expand Down Expand Up @@ -531,22 +543,34 @@ def _populate_actions_data(self):
elif field_name in original_descriptions:
field_schema["description"] = original_descriptions[field_name]
except (KeyError, TypeError, ValueError):
# Extract version information from the tool
version = tool_dict.get("version")
available_versions = tool_dict.get("available_versions", [])

self._action_schemas[action_key] = tool_dict
self._actions_data[action_key] = {
"display_name": display_name,
"action_fields": [],
"file_upload_fields": set(),
"version": version,
"available_versions": available_versions,
}
continue

if flat_schema is None:
logger.warning(f"Flat schema is None for action key: {action_key}")
# Still add the action but with empty fields so the UI doesn't break
# Extract version information from the tool
version = tool_dict.get("version")
available_versions = tool_dict.get("available_versions", [])

self._action_schemas[action_key] = tool_dict
self._actions_data[action_key] = {
"display_name": display_name,
"action_fields": [],
"file_upload_fields": set(),
"version": version,
"available_versions": available_versions,
}
continue

Expand Down Expand Up @@ -619,20 +643,32 @@ def _populate_actions_data(self):
clean_field_name = p_name.replace("[0]", "")
self._bool_variables.add(clean_field_name)

# Extract version information from the tool
version = tool_dict.get("version")
available_versions = tool_dict.get("available_versions", [])

self._action_schemas[action_key] = tool_dict
self._actions_data[action_key] = {
"display_name": display_name,
"action_fields": action_fields,
"file_upload_fields": file_upload_fields,
"version": version,
"available_versions": available_versions,
}

except (KeyError, TypeError, ValueError) as flatten_error:
logger.error(f"flatten_schema failed for {action_key}: {flatten_error}")
# Extract version information from the tool
version = tool_dict.get("version")
available_versions = tool_dict.get("available_versions", [])

self._action_schemas[action_key] = tool_dict
self._actions_data[action_key] = {
"display_name": display_name,
"action_fields": [],
"file_upload_fields": set(),
"version": version,
"available_versions": available_versions,
}
continue

Expand Down Expand Up @@ -2507,12 +2543,23 @@ def execute_action(self):

arguments[final_field_name] = value

# Execute using new SDK
result = composio.tools.execute(
slug=action_key,
arguments=arguments,
user_id=self.entity_id,
)
# Get the version from the action data
version = self._actions_data.get(action_key, {}).get("version")
if version:
logger.info(f"Executing {action_key} with version: {version}")

# Execute using new SDK with version parameter
execute_params = {
"slug": action_key,
"arguments": arguments,
"user_id": self.entity_id,
}

# Only add version if it's available
if version:
execute_params["version"] = version

result = composio.tools.execute(**execute_params)

if isinstance(result, dict) and "successful" in result:
if result["successful"]:
Expand Down
22 changes: 11 additions & 11 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading