You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## 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>
| type | string | true | Must be one of "string", "integer", "float", "boolean" "array" |
84
-
| description | string | true | Natural language description of the parameter to describe it to the agent. |
85
-
| default | parameter type | false | Default value of the parameter. If provided, `required` will be `false`. |
86
-
| required | bool | false | Indicate if the parameter is required. Default to `true`. |
87
-
| allowedValues | []string | false | Input value will be checked against this field. Regex is also supported. |
88
-
| escape | string | false | Only available for type `string`. Indicate the escaping delimiters used for the parameter. This field is intended to be used with templateParameters. Must be one of "single-quotes", "double-quotes", "backticks", "square-brackets". |
89
-
| minValue | int or float | false | Only available for type `integer` and `float`. Indicate the minimum value allowed. |
90
-
| maxValue | int or float | false | Only available for type `integer` and `float`. Indicate the maximum value allowed. |
| type | string | true | Must be one of "string", "integer", "float", "boolean" "array" |
84
+
| description | string | true | Natural language description of the parameter to describe it to the agent. |
85
+
| default | parameter type | false | Default value of the parameter. If provided, `required` will be `false`. |
86
+
| required | bool | false | Indicate if the parameter is required. Default to `true`. |
87
+
| allowedValues | []string | false | Input value will be checked against this field. Regex is also supported. |
88
+
| excludedValues | []string | false | Input value will be checked against this field. Regex is also supported. |
89
+
| escape | string | false | Only available for type `string`. Indicate the escaping delimiters used for the parameter. This field is intended to be used with templateParameters. Must be one of "single-quotes", "double-quotes", "backticks", "square-brackets". |
90
+
| minValue | int or float | false | Only available for type `integer` and `float`. Indicate the minimum value allowed. |
91
+
| maxValue | int or float | false | Only available for type `integer` and `float`. Indicate the maximum value allowed. |
91
92
92
93
### Array Parameters
93
94
@@ -108,15 +109,16 @@ in the list using the items field:
108
109
SELECT * FROM airlines WHERE preferred_airlines = ANY($1);
0 commit comments