Skip to content

[ML] Custom service add support for input_type, top_n, and return_documents #129441

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

jonathan-buttner
Copy link
Contributor

This PR addresses the feedback item from the original PR: #127939

This PR adds support for input_type, top_n, and return_documents.

Comments:
#127939 (comment)

@jonathan-buttner jonathan-buttner added >refactoring :ml Machine learning Team:ML Meta label for the ML team auto-backport Automatically create backport pull requests when merged v8.19.0 v9.1.0 labels Jun 13, 2025
@jonathan-buttner jonathan-buttner marked this pull request as ready for review June 18, 2025 14:23
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)

Strings.format(
"Input type translation value for key [%s] must be a String that is not null and not empty, received: [%s].",
key,
value.getClass().getSimpleName()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can value be null?

Suggested change
value.getClass().getSimpleName()
value == null ? "null" : value.getClass().getSimpleName()

Strings.format(
"Invalid input type translation for key: [%s], is not a valid value. Must be one of %s",
key,
EnumSet.of(InputType.CLASSIFICATION, InputType.CLUSTERING, InputType.INGEST, InputType.SEARCH)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
EnumSet.of(InputType.CLASSIFICATION, InputType.CLUSTERING, InputType.INGEST, InputType.SEARCH)
SUPPORTED_REQUEST_VALUES

* @param inputTypeTranslation the map of input type translations to validate
* @param validationException a ValidationException to which errors will be added
*/
public static Map<InputType, String> validateInputTypeTranslationValues(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this

entity.toXContent(builder, null);
String xContentResult = Strings.toString(builder);

var expected = XContentHelper.stripWhitespace("""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged :ml Machine learning >refactoring Team:ML Meta label for the ML team v8.19.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants