-
Notifications
You must be signed in to change notification settings - Fork 25.3k
[ML] CustomService adding template validation prior to request flow #129591
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
[ML] CustomService adding template validation prior to request flow #129591
Conversation
Pinging @elastic/ml-core (Team:ML) |
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.
LGTM
Definitly an improvement, this change should make it much easier to configure a custom service
|
||
try { | ||
new CustomRequest(query, List.of("test input"), model).createHttpRequest(); | ||
} catch (Exception e) { |
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.
Is there a more specific exception to catch, perhaps define a new exception class CustomServiceSubsitutionException extends ElasticsearchException
and throw that in ValidatingSubstitutor
@@ -94,12 +95,32 @@ public void parseRequestConfig( | |||
throwIfNotEmptyMap(serviceSettingsMap, NAME); | |||
throwIfNotEmptyMap(taskSettingsMap, NAME); | |||
|
|||
validateConfiguration(model); |
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.
👍
💚 Backport successful
|
This PR addresses the feedback item from the original PR: #127939
This PR adds some additional validation logic prior to the typical test request validation. This addresses the validation error being nested a couple levels deep when the traditional validation is executed.
The error would also be caught in the normal request validation logic but it is nested a few levels. This change performs the initial validation for schema before making an actual request.
Comments:
#127939 (comment)
Example error after this change