Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: composio tools with array args (#2762)
cthomase8a5cc5ee387
diff --git a/letta/functions/schema_generator.py b/letta/functions/schema_generator.pyindex c846aa9dc..7242e3140 100644--- a/letta/functions/schema_generator.py+++ b/letta/functions/schema_generator.py@@ -547,8 +547,11 @@ def generate_tool_schema_for_composio(property_schema["enum"] = field_props["enum"]# Handle array item types- if field_props["type"] == "array" and "items" in field_props:- property_schema["items"] = field_props["items"]+ if field_props["type"] == "array":+ if "items" in field_props:+ property_schema["items"] = field_props["items"]+ elif "anyOf" in field_props:+ property_schema["items"] = [t for t in field_props["anyOf"] if "items" in t][0]["items"]# Add the property to the schemaproperties_json[field_name] = property_schemadiff --git a/tests/test_tool_schema_parsing.py b/tests/test_tool_schema_parsing.pyindex 89b2ed730..9d63c09f9 100644--- a/tests/test_tool_schema_parsing.py+++ b/tests/test_tool_schema_parsing.py@@ -289,8 +289,8 @@ def test_composio_tool_schema_generation(openai_model: str, structured_output: baction_names = ["GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER", # Simple"CAL_GET_AVAILABLE_SLOTS_INFO", # has an array arg, needs to be converted properly- "SALESFORCE_RETRIEVE_LEAD_BY_ID",- # has an array arg, needs to be converted properly+ "SALESFORCE_RETRIEVE_LEAD_BY_ID", # has an array arg, needs to be converted properly+ "FIRECRAWL_SEARCH", # has an optional array arg, needs to be converted properly]# Create a pool of processes