Skip to content

Conversation

ymao1
Copy link
Contributor

@ymao1 ymao1 commented Mar 19, 2025

Resolves #111273

Summary

Exposes the return_documents and top_n parameters as root level fields in the Perform Inference API for rerank task types. Previously, this setting was available for certain services as a task setting. The root option, if specified, will now take precedence over the task settings option.


Services that support rerank

AlibabaCloud AI Search - docs
Does not accept return_documents or top_n parameters so throws validation exception if either is specified

Cohere - docs

Elasticearch
Updated to respect the top_n option if defined

Google Vertex AI - docs

Jina AI - docs

Voyage AI - docs

@ymao1 ymao1 changed the title wip Adding common rerank options Mar 19, 2025
@ymao1 ymao1 changed the title Adding common rerank options Adding common rerank options to Perform Inference API Mar 19, 2025
@ymao1
Copy link
Contributor Author

ymao1 commented Mar 19, 2025

run elasticsearch-ci/8.19.0/bwc-snapshots

@ymao1
Copy link
Contributor Author

ymao1 commented Mar 19, 2025

run elasticsearch-ci/bwc-snapshots

@ymao1 ymao1 self-assigned this Mar 20, 2025
@ymao1 ymao1 added >enhancement :ml Machine learning Team:ML Meta label for the ML team v8.19.0 labels Mar 20, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @ymao1, I've created a changelog YAML for you.

@ymao1 ymao1 marked this pull request as ready for review March 20, 2025 14:38
@elasticsearchmachine
Copy link
Collaborator

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

import java.util.List;
import java.util.Objects;

public record GoogleVertexAiRerankRequestEntity(String query, List<String> inputs, @Nullable String model, @Nullable Integer topN)
Copy link
Contributor

Choose a reason for hiding this comment

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

How about we move the logic to determine which topN to use in the GoogleVertexAiRerankRequest. That way this class does need both variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 458ff31

@ymao1
Copy link
Contributor Author

ymao1 commented Mar 25, 2025

run elasticsearch-ci/rest-compatibility

@ymao1 ymao1 merged commit a6f685c into elastic:main Mar 25, 2025
17 checks passed
@ymao1
Copy link
Contributor Author

ymao1 commented Mar 25, 2025

💚 All backports created successfully

Status Branch Result
8.x

Questions ?

Please refer to the Backport tool documentation

@ymao1 ymao1 deleted the es-111273 branch March 25, 2025 17:17
ymao1 added a commit to ymao1/elasticsearch that referenced this pull request Mar 25, 2025
* wip * Adding rerank common options * Linting * Linting * [CI] Auto commit changes from spotless * Update docs/changelog/125239.yaml * PR feedback --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> (cherry picked from commit a6f685c) # Conflicts: #	server/src/main/java/org/elasticsearch/TransportVersions.java #	x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/inference/action/InferenceActionRequestTests.java
elasticsearchmachine pushed a commit that referenced this pull request Mar 25, 2025
) * wip * Adding rerank common options * Linting * Linting * [CI] Auto commit changes from spotless * Update docs/changelog/125239.yaml * PR feedback --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> (cherry picked from commit a6f685c) # Conflicts: #	server/src/main/java/org/elasticsearch/TransportVersions.java #	x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/inference/action/InferenceActionRequestTests.java
omricohenn pushed a commit to omricohenn/elasticsearch that referenced this pull request Mar 28, 2025
* wip * Adding rerank common options * Linting * Linting * [CI] Auto commit changes from spotless * Update docs/changelog/125239.yaml * PR feedback --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :ml Machine learning Team:ML Meta label for the ML team v8.19.0 v9.1.0

3 participants