File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
packages/toolbox-core/src/toolbox_core Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -89,11 +89,13 @@ def __init__(
89
89
self .__params = params
90
90
self .__pydantic_model = params_to_pydantic_model (name , self .__params )
91
91
92
- # Sort parameters to ensure required ones (required=True) come before
93
- # optional ones (required=False). This prevents the "non-default argument
94
- # follows default argument" error when creating the signature.
95
- sorted_params = sorted (self .__params , key = lambda p : p .required , reverse = True )
96
- inspect_type_params = [param .to_param () for param in sorted_params ]
92
+ # Separate parameters into required (no default) and optional (with
93
+ # default) to prevent the "non-default argument follows default
94
+ # argument" error when creating the function signature.
95
+ required_params = [p for p in self .__params if p .required ]
96
+ optional_params = [p for p in self .__params if not p .required ]
97
+ ordered_params = required_params + optional_params
98
+ inspect_type_params = [param .to_param () for param in ordered_params ]
97
99
98
100
# the following properties are set to help anyone that might inspect it determine usage
99
101
self .__name__ = name
@@ -468,4 +470,4 @@ def bind_param(
468
470
the tool's definition.
469
471
470
472
"""
471
- return self .bind_params ({param_name : param_value })
473
+ return self .bind_params ({param_name : param_value })
You can’t perform that action at this time.
0 commit comments