Validate tool names returned by model against allowed tools#103
Validate tool names returned by model against allowed tools#103jph00 merged 5 commits intoAnswerDotAI:mainfrom
Conversation
|
Found 1 changed notebook. Review the changes at https://app.gitnotebooks.com/AnswerDotAI/claudette/pull/103 |
Adds safety mechanism to ensure only explicitly allowed tools can be executed. When a model attempts to call a tool not in the allowed set (via tools parameter or tool_choice), the call fails with an error message rather than executing arbitrary code. Implements allowed_tools() to extract valid tool names from specs Updates mk_toolres() to accept limit_to parameter for filtering Modifies Chat.__call__() to validate tool calls automatically
|
Thanks @PiotrCzapla! I like how you're returning the tool not found msg to the LLM so it can retry. One thing, the nb does not run end2end for me. I think the case of no defined tools and no tools called is not handled?
|
|
@RensDimmendaal Thank you for noticing that! I've fixed the issue and added support to async, and cleaned toolloop notebook as it was throwing errors when run under nbdev_tests. Moreover I've noticed that my notebook get changes in many places when I run them in solve it, is it normal? |
|
This PR is almost identical code to the one in Cosette, what would you think about moving allowed_tools and limit_ns to toolslm? I claudette, cosette and lisette? |
|
Thanks! :) |

similar PR to AnswerDotAI/cosette#34