-
Notifications
You must be signed in to change notification settings - Fork 12
fix(toolbox-core): Prevent rebinding of parameters in ToolboxTool #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the PR matches the behavior we discussed previously.
I think we want the 'default' behavior to be you can't bind a parameter if it doesn't exist. This behavior is the current functionality. This covers "rebinding" of parameters because once a param is bound, it "no longer exists" from the normal parameters perspective.
We discussed a small semantic improvement in the return error -- that if the parameter existed but was already bound, we would return a different error. IMO, this is a low priority.
Separately we discussed potentially needing to implement a strict flag. I thought when we left it we decided to implement the behavior that would error if "any of the parameters provided were attached to exactly 0 tools", and implement that consistently across both the single and group functions.
5d59af9
to
e841bc1
Compare
92e0f54
to
eb5630d
Compare
Just wanted to clarify my approach here: You're totally right – the main goal is still the default behavior we discussed: error if you try to bind a parameter that doesn't exist. That core logic eventually isn't changing. The reason it might look different in this PR is I was in the middle of moving this "parameter existence" check. The plan is to shift it from the This is based on our offline chat (link) about making So, this PR was just removing the check from Regarding the other check I added in I put that specific check here because attempting a rebind can only really happen when calling I can see how it looked like I swapped the high-priority "existence" check for the lower-priority "rebinding" check within this function 🤔. But really, the main existence check will just move to the constructor for consistency, not removed. The end state will be:
Note Since these two states are mutually exclusive, I suggest using distinct error messages for each, rather than the same Hope that clarifies the plan! Let me know if that makes sense or if you have other concerns. 🙂 |
eb5630d
to
8c2ee68
Compare
e841bc1
to
9a0c077
Compare
8c2ee68
to
83eb39a
Compare
83eb39a
to
a4e9402
Compare
9c03dac
to
f6301bd
Compare
This comment was marked as outdated.
This comment was marked as outdated.
f6301bd
to
af85f09
Compare
Here’s a summary of the updated plan: We've decided not to introduce the This decision has a positive cascading effect:
Therefore, with the |
This pull request updates the `bind_parameters` helper function within the `ToolboxTool` of the `toolbox-core` package to enhance parameter binding management. * The helper now throws an explicit error if a user attempts to bind a parameter that has already been bound. This change aims to prevent unexpected behavior and improve the clarity of parameter assignments. * The error that previously occurred when a user tried to bind a parameter not present in the tool's schema has been removed. This validation will be handled by a `strict` mode implementation in a future PR.
We will remove this once we actually implement the `strict` flag and centralize this functionality by moving this check to the tool's constructor in a future PR.
af85f09
to
574e39f
Compare
This pull request updates the
bind_parameters
helper function within theToolboxTool
of thetoolbox-core
package to enhance parameter binding management.strict
mode implementation in a future PR.