-
Notifications
You must be signed in to change notification settings - Fork 140
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
[RFC] Connector payload validation #2748
Comments
Implemented this RFC in a draft PR: #2724. Despite being able to resolve the bug, the draft PR restricts that connector payload can only fill in required parameters. If users wants to fill in parameters with parameter map
Then the created payload would be |
Perhaps we can deal with the drawbacks with two different regex. The format |
Any comments would be appreciated :) |
This seem a pretty advanced use case, I don't think this exist now. No need to consider this until we received customer's callout. |
The current |
Suggest to add a new parameter to |
Updated in PR: #2724. Can you help review? @ylwu-amzn @jngz-es @zane-neo |
Reached an agreement on the following solution:
|
hi, Yuye, have you guys discussed pros/cons of using By adding Can you explain how to get required parameters? Like we discussed before, I would suggest to fix the problem directly rather than introducing new unnecessary logic which may brings new issues. |
I'll showcase with an example
|
The parameter is #2724 (comment) shows a drawback of the current connector, i.e., users may not want to recursively filling in parameter in their payload. We need a way for user to configure this behavior. |
Not supporting agent level override this parameter? |
If we are supporting this, how about introducing parameter to agents? @jngz-es @Zhangxunmt @ylwu-amzn |
We can iterate and optimize. How about supporting agent level override in another PR? |
We have to support this case, because different agent might have different behaviors in terms of validating the payload, missing this can cause application running in unexpected status and customer not aware of it at all. |
I think this already supported? User can set parameters in tool configuration when create agent. |
Like I said, you fixed one problem by adding something new. This required parameter is not a general feature. I think the general parameter validation feature should though model interface. @b4sjoo built model interface to validate input/output parameter list and type. Why we build another feature for the same thing? Your example is the basic use case. We should consider more cases. For example connector http body is
The required parameter should be |
Do you expect user to send such a |
Can you think of some use case where the user needs to disable the |
Side noteYou can always use model interface to control the eligibility of a field name, for instance, consider an input like this:
Can represent a general schema like this: General schema
This represents any JSON object input, when it has a field called
'required' KeywordHowever, if we want the
So that:
'additionalProperties' KeywordIn the meantime, if we don't want any other fields to be introduced by user, we can use `additionalProperties' Keyword:
So that:
'not' keyword with subschemaLast but not least, we can use a 'not' keyword to introduce a subschema to reject certain field. That means if we don't want some certain fields to be introduced by user, we can use 'not' keyword to reject those fields:
Then
You can always check https://json-schema.org/learn/glossary to get more information on JSON schema. |
Closing this issue as this PR: #2812 has been merged |
This RFC aims to resolve the bug issue resulted from payload validation in connector. You can refer to this issue on how to reproduce the bug.
How the bug works
The connector creates the payload and then validates it.
During payload creation, all parameters within
${parameters.foo}
will be replaced by values inparameters
ml-commons/common/src/main/java/org/opensearch/ml/common/connector/HttpConnector.java
Lines 311 to 325 in 5ad26df
For payload validation, any string with format like
${parameters.foo}
will lead to an exception, which is possible for every parameter.ml-commons/common/src/main/java/org/opensearch/ml/common/connector/Connector.java
Lines 80 to 93 in 5ad26df
Solution
We propose a new validation and creation process for the connector payload.
Open question
recursive_parameters
(false by default). We need to instruct user that settingrecursive_parameters
to be true may lead to the bug.The text was updated successfully, but these errors were encountered: