xpander-sdk 2.0.205__py3-none-any.whl → 2.0.207__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.
@@ -74,10 +74,13 @@ class OrchestrationCondition(XPanderSharedModel):
74
74
  Attributes:
75
75
  type: Type of condition (regex, contains, or else).
76
76
  term: The pattern or string to match against. Optional for 'else' type.
77
+ group_id: Optional group ID for group-based classifier routing.
78
+ When set, routing matches by group ID instead of term matching.
77
79
  """
78
80
 
79
81
  type: OrchestrationConditionType
80
82
  term: Optional[str] = None
83
+ group_id: Optional[str] = None
81
84
 
82
85
  class OrchestrationRetryStrategy(XPanderSharedModel):
83
86
  """Strategy for retrying failed orchestration nodes.
@@ -159,8 +159,33 @@ class ToolsRepository(XPanderSharedModel):
159
159
 
160
160
  for tool in self.list:
161
161
 
162
- # add json schema to the model doc
163
- tool.schema.__doc__ = "Pay attention to the schema, dont miss. " + json.dumps(tool.schema.model_json_schema(mode="serialization"))
162
+ # add json schema to the model doc with enhanced guidance
163
+ schema_json = tool.schema.model_json_schema(mode="serialization")
164
+
165
+ # Build example with actual schema structure
166
+ example_payload = {}
167
+ if 'properties' in schema_json:
168
+ for prop_name, prop_def in schema_json['properties'].items():
169
+ if prop_def.get('type') == 'object':
170
+ if prop_def.get('properties'):
171
+ # Show one example nested field
172
+ first_nested = list(prop_def['properties'].keys())[0]
173
+ example_payload[prop_name] = {first_nested: "<value>"}
174
+ else:
175
+ example_payload[prop_name] = {}
176
+ else:
177
+ example_payload[prop_name] = f"<{prop_def.get('type', 'value')}>"
178
+
179
+ tool.schema.__doc__ = f"""CRITICAL: This entire schema must be wrapped in a 'payload' parameter.
180
+
181
+ Call this function as: function_name(payload={{...}})
182
+ DO NOT call as: function_name(body_params={{...}}, headers={{...}}, ...)
183
+
184
+ Example correct call:
185
+ {json.dumps({"payload": example_payload}, indent=2)}
186
+
187
+ Full schema: {json.dumps(schema_json, indent=2)}
188
+ """
164
189
 
165
190
  schema_cls: Type[BaseModel] = tool.schema
166
191
 
@@ -208,7 +233,44 @@ class ToolsRepository(XPanderSharedModel):
208
233
 
209
234
  # --- Metadata ---
210
235
  tool_function.__name__ = tool_ref.id
211
- tool_function.__doc__ = tool_ref.description or tool_ref.name
236
+
237
+ # Build comprehensive docstring with parameter structure guidance
238
+ base_doc = tool_ref.description or tool_ref.name
239
+
240
+ # Extract schema properties for examples
241
+ schema_props = schema_ref.model_json_schema().get('properties', {})
242
+ param_names = list(schema_props.keys())
243
+
244
+ # Create example structure
245
+ example_parts = []
246
+ for prop_name in param_names:
247
+ prop_info = schema_props.get(prop_name, {})
248
+ if prop_info.get('type') == 'object' and prop_info.get('properties'):
249
+ # Show nested structure
250
+ nested_props = list(prop_info['properties'].keys())
251
+ if nested_props:
252
+ example_parts.append(f'"{prop_name}": {{"{nested_props[0]}": ...}}')
253
+ else:
254
+ example_parts.append(f'"{prop_name}": {{}}')
255
+ else:
256
+ example_parts.append(f'"{prop_name}": ...')
257
+
258
+ example_json = "{" + ", ".join(example_parts) + "}"
259
+
260
+ tool_function.__doc__ = f"""{base_doc}
261
+
262
+ IMPORTANT - Parameter Structure:
263
+ All parameters must be passed as a single 'payload' object containing the required fields.
264
+
265
+ Correct usage example:
266
+ {{
267
+ "payload": {example_json}
268
+ }}
269
+
270
+ DO NOT pass parameters as separate top-level arguments.
271
+ DO NOT use: {{"{param_names[0] if param_names else 'param'}": ..., "{param_names[1] if len(param_names) > 1 else 'param2'}": ...}}
272
+ USE: {{"payload": {{"{param_names[0] if param_names else 'param'}": ..., "{param_names[1] if len(param_names) > 1 else 'param2'}": ..., ...}}}}
273
+ """
212
274
 
213
275
  # --- Signature ---
214
276
  payload_param = Parameter(
@@ -98,20 +98,24 @@ def build_model_from_schema(
98
98
 
99
99
  field_args = {}
100
100
 
101
- # Enhance description to clarify optional vs required status
101
+ # Enhance description to clarify optional vs required status AND nesting
102
102
  enhanced_description = description or f"Parameter: {prop_name}"
103
+
104
+ # Add payload wrapper reminder for top-level params
105
+ wrapper_note = " (must be inside payload object)"
106
+
103
107
  if is_empty_param_container:
104
- enhanced_description = f"[OPTIONAL - empty container] {enhanced_description} (default: empty object)"
108
+ enhanced_description = f"[OPTIONAL - empty container] {enhanced_description} (default: empty object){wrapper_note}"
105
109
  elif prop_name in required:
106
110
  if default is not None:
107
- enhanced_description = f"[REQUIRED with default] {enhanced_description} (default: {default})"
111
+ enhanced_description = f"[REQUIRED with default] {enhanced_description} (default: {default}){wrapper_note}"
108
112
  else:
109
- enhanced_description = f"[REQUIRED] {enhanced_description}"
113
+ enhanced_description = f"[REQUIRED] {enhanced_description}{wrapper_note}"
110
114
  else:
111
115
  if default is not None:
112
- enhanced_description = f"[OPTIONAL with default] {enhanced_description} (default: {default})"
116
+ enhanced_description = f"[OPTIONAL with default] {enhanced_description} (default: {default}){wrapper_note}"
113
117
  else:
114
- enhanced_description = f"[OPTIONAL] {enhanced_description} - can be omitted or set to null"
118
+ enhanced_description = f"[OPTIONAL] {enhanced_description} - can be omitted or set to null{wrapper_note}"
115
119
 
116
120
  field_args["description"] = enhanced_description
117
121
 
@@ -169,7 +173,16 @@ def build_model_from_schema(
169
173
  strict=False, # Allow flexibility with types to handle AI agent inputs better
170
174
  extra="allow",
171
175
  title=model_name,
172
- description="IMPORTANT: Required fields must be provided. Optional fields can be omitted entirely or set to null. All parameters with defaults will use those defaults if not provided. Check the 'required' array in the schema to see which fields are mandatory."
176
+ description="""CRITICAL - This schema must be wrapped in a 'payload' parameter.
177
+
178
+ CORRECT: Call function with {"payload": {<this_schema>}}
179
+ INCORRECT: Call function with {<this_schema>} directly
180
+
181
+ All fields shown below must be nested inside a 'payload' object when calling the function.
182
+
183
+ Required fields must be provided. Optional fields can be omitted entirely or set to null.
184
+ All parameters with defaults will use those defaults if not provided.
185
+ Check the 'required' array in the schema to see which fields are mandatory."""
173
186
  )
174
187
  return create_model(
175
188
  model_name,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xpander-sdk
3
- Version: 2.0.205
3
+ Version: 2.0.207
4
4
  Summary: xpander.ai Backend-as-a-service for AI Agents - SDK
5
5
  Home-page: https://www.xpander.ai
6
6
  Author: xpanderAI
@@ -16,7 +16,7 @@ xpander_sdk/models/events.py,sha256=HnootQSUIIRM4BIdaTbuPUEJ55hLVtA7KDCSsnHeBKw,
16
16
  xpander_sdk/models/frameworks.py,sha256=-7W_m5cvgS1qLp0gGAFP4noNWT82IT1ZqtQv5WuOC2k,2939
17
17
  xpander_sdk/models/generic.py,sha256=yw5rBRdZ-6ucTI4AwtskenddepOooiFRM--9xx5jrL8,681
18
18
  xpander_sdk/models/notifications.py,sha256=3tK4Z2gmA6YxRtqsWgzjiVISgJyHvmjTooiRgzrj5zY,3373
19
- xpander_sdk/models/orchestrations.py,sha256=_cYaD5bGF80_1gYxd9MGeuGJ4GSFHcuDFfv9qFYDM5A,11454
19
+ xpander_sdk/models/orchestrations.py,sha256=OWhCqHMi-hZZYj2lWCXzhDg6KigFIT7AoaUTaZ7DGL0,11642
20
20
  xpander_sdk/models/shared.py,sha256=gW88kA_UslNinUjtQKpLVF0sHDZnckwLWexRapxPivU,3125
21
21
  xpander_sdk/models/user.py,sha256=_FTG0JO6iTrbcvJp-BBJ6nuj281zhyQB5ldQkBCyYDU,749
22
22
  xpander_sdk/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -71,7 +71,7 @@ xpander_sdk/modules/tasks/sub_modules/task.py,sha256=zRDHsE_LnYYa3OC79wVQqeRnpAo
71
71
  xpander_sdk/modules/tasks/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
72
72
  xpander_sdk/modules/tasks/utils/files.py,sha256=KqqwSQSrwim2-H3XP5wOadDDfngAyEI034tA7Oon-vc,3631
73
73
  xpander_sdk/modules/tools_repository/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
- xpander_sdk/modules/tools_repository/tools_repository_module.py,sha256=HpiOtsJwIeyDqb1499X4FuRUdh8v-mQZQlQ2Zlgq1lY,9557
74
+ xpander_sdk/modules/tools_repository/tools_repository_module.py,sha256=Hck2dACK2O8BHPXfFdVY8xBMQGYSFrB-trVCJ15LKN4,12393
75
75
  xpander_sdk/modules/tools_repository/decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
76
  xpander_sdk/modules/tools_repository/decorators/register_tool.py,sha256=ep-BlJHmqvG7zcW6l-hz_V0ZJx3PGfNqdijw6VjUGek,4078
77
77
  xpander_sdk/modules/tools_repository/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -82,7 +82,7 @@ xpander_sdk/modules/tools_repository/sub_modules/tool.py,sha256=rivnznxi6CrrOWE1
82
82
  xpander_sdk/modules/tools_repository/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
83
83
  xpander_sdk/modules/tools_repository/utils/generic.py,sha256=bQ31-RoAq12lpDoIWsgmqAt7NL5YdzW1j3WKqZtYb2A,1904
84
84
  xpander_sdk/modules/tools_repository/utils/local_tools.py,sha256=zp5P8hVnRUJQb-w-2jCEMV5eUB_awmvYfY_rin5qvEw,1875
85
- xpander_sdk/modules/tools_repository/utils/schemas.py,sha256=EUi35h7CRrOVXV-TH-lyCpOdK5pu1uODDxvGB1JGDXY,13734
85
+ xpander_sdk/modules/tools_repository/utils/schemas.py,sha256=EAoxhkVmwtqPOm-FkXiQRDNmcrmcnEeXbw73k7PzvUk,14242
86
86
  xpander_sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
87
87
  xpander_sdk/utils/env.py,sha256=U_zIhqWgKs5fk2-HXjAaODj4oWMc5dRQ0fvw6fqVcFk,1522
88
88
  xpander_sdk/utils/event_loop.py,sha256=kJrN0upgBhyI86tkTdfHeajznrIZl44Rl6WDiDG3GHE,2516
@@ -90,8 +90,8 @@ xpander_sdk/utils/generic.py,sha256=XrRj2-L8c0YWpfPdDyXE-pVL-6lKF9VpyZzKHQ4wuCc,
90
90
  xpander_sdk/utils/tools.py,sha256=lyFkq2yP7DxBkyXYVlnFRwDhQCvf0fZZMDm5fBycze4,1244
91
91
  xpander_sdk/utils/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
92
92
  xpander_sdk/utils/agents/compactization_agent.py,sha256=S_U1dSmDC7I0JUsp_THUYjfutEI5QMBaMPJEXGp0_Sw,14389
93
- xpander_sdk-2.0.205.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
94
- xpander_sdk-2.0.205.dist-info/METADATA,sha256=H05TKvuI0Q8YEykvUD4RGsx68dZ_dLh2LuqKxrxZt5U,17952
95
- xpander_sdk-2.0.205.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
96
- xpander_sdk-2.0.205.dist-info/top_level.txt,sha256=UCjnxQpsMy5Zoe7lmRuVDO6DI2V_6PgRFfm4oizRbVs,12
97
- xpander_sdk-2.0.205.dist-info/RECORD,,
93
+ xpander_sdk-2.0.207.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
94
+ xpander_sdk-2.0.207.dist-info/METADATA,sha256=DD0MwqtsCcc7b2XXQReMG6y4P-4Rqkbu-sutigeeoIg,17952
95
+ xpander_sdk-2.0.207.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
96
+ xpander_sdk-2.0.207.dist-info/top_level.txt,sha256=UCjnxQpsMy5Zoe7lmRuVDO6DI2V_6PgRFfm4oizRbVs,12
97
+ xpander_sdk-2.0.207.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5