fix: composio tools with array args (#2762)

This commit is contained in:
cthomas
2025-06-11 16:24:37 -07:00
committed by GitHub
parent cf357b931d
commit 03f4867cbe
2 changed files with 7 additions and 4 deletions

View File

@@ -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 schema
properties_json[field_name] = property_schema

View File

@@ -289,8 +289,8 @@ def test_composio_tool_schema_generation(openai_model: str, structured_output: b
action_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