mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-02-04 12:15:09 -05:00
## Description ### This PR introduces a new excludedValues field for tool parameters, enhancing validation capabilities. This change introduces a new excludedValues field for tool parameters. This field allows developers to specify a list of values that are not allowed for a parameter. The excludedValues field supports both exact value matching and regular expression matching. The changes include: - Updating the tool parameter documentation to include the excludedValues field. - Adding the excludedValues field to the CommonParameter struct. - Implementing the logic to check for excluded values in the Parse method of each parameter type. - Updating the MatchStringOrRegex function to support non-string inputs by converting them to strings before regex matching. This makes the allowedValues and excludedValues checks more robust. - Adding unit tests for allowedValues to verify the MatchStringOrRegex change on parameters. - Adding unit tests to verify the excludedValues functionality. ## PR Checklist - [x] Make sure you reviewed CONTRIBUTING.md (httpshttps://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md) - [x] Make sure to open an issue as a bug/issue (https://github.com/googleapis/genai-toolbox/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) - [ ] Make sure to add ! if this involve a breaking change 🛠️ Fixes #1792 Co-authored-by: Averi Kitsch <akitsch@google.com>