composio-openai-agents 0.7.7__py3-none-any.whl → 0.7.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -154,13 +154,67 @@ class ComposioToolSet(
154
154
  modified_schema = schema_params.copy()
155
155
  modified_schema["additionalProperties"] = False
156
156
 
157
+ # Recursively remove 'examples' keys from the schema properties
158
+ def remove_examples_from_schema(schema_obj: t.Dict[str, t.Any]) -> None:
159
+ """Remove 'examples', 'pattern', and 'default' keys from all properties in the schema, including nested ones.
160
+ Also ensure that any 'items' object has a 'type' key."""
161
+ # Handle properties directly
162
+ if "properties" in schema_obj and isinstance(
163
+ schema_obj["properties"], dict
164
+ ):
165
+ for _, prop_value in schema_obj["properties"].items():
166
+ if isinstance(prop_value, dict):
167
+ # Remove examples, pattern, and default from this property
168
+ if "examples" in prop_value:
169
+ del prop_value["examples"]
170
+ if "pattern" in prop_value:
171
+ del prop_value["pattern"]
172
+ if "default" in prop_value:
173
+ del prop_value["default"]
174
+
175
+ # Ensure 'items' has a 'type' key
176
+ if "items" in prop_value and isinstance(
177
+ prop_value["items"], dict
178
+ ):
179
+ if "type" not in prop_value["items"]:
180
+ # Default to string type for items if not specified
181
+ prop_value["items"]["type"] = "string"
182
+
183
+ # Recursively process nested properties
184
+ remove_examples_from_schema(prop_value)
185
+
186
+ # Handle array items
187
+ if "items" in schema_obj and isinstance(schema_obj["items"], dict):
188
+ if "examples" in schema_obj["items"]:
189
+ del schema_obj["items"]["examples"]
190
+ if "pattern" in schema_obj["items"]:
191
+ del schema_obj["items"]["pattern"]
192
+ if "default" in schema_obj["items"]:
193
+ del schema_obj["items"]["default"]
194
+ # Ensure items has a type
195
+ if "type" not in schema_obj["items"]:
196
+ schema_obj["items"]["type"] = "string"
197
+ remove_examples_from_schema(schema_obj["items"])
198
+
199
+ # Handle any other nested object properties
200
+ for _, value in schema_obj.items():
201
+ if isinstance(value, dict):
202
+ remove_examples_from_schema(value)
203
+ elif isinstance(value, list):
204
+ for item in value:
205
+ if isinstance(item, dict):
206
+ remove_examples_from_schema(item)
207
+
208
+ # Apply the example removal function. This is done to optimize the schema as much as possible for Responses API
209
+ remove_examples_from_schema(modified_schema)
210
+
157
211
  # Create a custom FunctionTool with the appropriate schema
158
212
  tool = FunctionTool(
159
213
  name=action,
160
214
  description=description,
161
215
  params_json_schema=modified_schema,
162
216
  on_invoke_tool=execute_action_wrapper,
163
- strict_json_schema=True,
217
+ strict_json_schema=False, # To avoid schema errors due to required flags. Composio tools already process to have optimal schemas.
164
218
  )
165
219
 
166
220
  return tool
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: composio_openai_agents
3
- Version: 0.7.7
3
+ Version: 0.7.8
4
4
  Summary: Use Composio to get array of strongly typed tools for OpenAI Agents
5
5
  Home-page: https://github.com/ComposioHQ/composio
6
6
  Author: Siddharth
@@ -0,0 +1,6 @@
1
+ composio_openai_agents/__init__.py,sha256=E_-3XZ6yN4oM-yHfu3rJ0gHuLnfdDujYxT2XuZAcq1U,255
2
+ composio_openai_agents/toolset.py,sha256=Jz9f1JvHO0dFT26HqPpqfeRr6Q9GG7rNj8UUNzUgVxg,9852
3
+ composio_openai_agents-0.7.8.dist-info/METADATA,sha256=7IeLBcM-_-GXngF7aLMFQmmMW26SRYm63IAcXeIphZo,2216
4
+ composio_openai_agents-0.7.8.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
5
+ composio_openai_agents-0.7.8.dist-info/top_level.txt,sha256=_YKpUJOoiq4jzAZX0LC2SfaYhsCOcyNcoK9lbK5uWQw,23
6
+ composio_openai_agents-0.7.8.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- composio_openai_agents/__init__.py,sha256=E_-3XZ6yN4oM-yHfu3rJ0gHuLnfdDujYxT2XuZAcq1U,255
2
- composio_openai_agents/toolset.py,sha256=MYDv0uika_e7SfZCNb4FQQiCSYjEVyw5vmoRfz-PNVs,6922
3
- composio_openai_agents-0.7.7.dist-info/METADATA,sha256=07gA4lBRAhOLxNXwkkpKMBHtx7asqaWCI6oO3MXvizk,2216
4
- composio_openai_agents-0.7.7.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
5
- composio_openai_agents-0.7.7.dist-info/top_level.txt,sha256=_YKpUJOoiq4jzAZX0LC2SfaYhsCOcyNcoK9lbK5uWQw,23
6
- composio_openai_agents-0.7.7.dist-info/RECORD,,