Skip to content

Commit 32f59b3

Browse files
committed
Consolidate default endpoints
1 parent 5a870a6 commit 32f59b3

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/rank/textsimilarity/TextSimilarityRankBuilder.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@
3939
import static org.elasticsearch.xpack.inference.rank.textsimilarity.TextSimilarityRankRetrieverBuilder.INFERENCE_TEXT_FIELD;
4040
import static org.elasticsearch.xpack.inference.rank.textsimilarity.TextSimilarityRankRetrieverBuilder.MIN_SCORE_FIELD;
4141
import static org.elasticsearch.xpack.inference.rank.textsimilarity.TextSimilarityRankRetrieverBuilder.SNIPPETS_FIELD;
42-
import static org.elasticsearch.xpack.inference.services.elasticsearch.ElasticsearchInternalService.DEFAULT_RERANK_ID;
43-
import static org.elasticsearch.xpack.inference.services.elasticsearch.ElasticsearchInternalService.RERANKER_ID;
4442

4543
/**
4644
* A {@code RankBuilder} that enables ranking with text similarity model inference. Supports parameters for configuring the inference call.
@@ -52,13 +50,7 @@ public class TextSimilarityRankBuilder extends RankBuilder {
5250
/**
5351
* The default token size limit of the Elastic reranker is 512.
5452
*/
55-
private static final int RERANK_TOKEN_SIZE_LIMIT = 512;
56-
57-
/**
58-
* 4096 is a safe default token size limit for other reranker models.
59-
* Reranker models with smaller token limits will be truncated.
60-
*/
61-
private static final int DEFAULT_TOKEN_SIZE_LIMIT = 4_096;
53+
private static final int DEFAULT_TOKEN_SIZE_LIMIT = 512;
6254

6355
public static final LicensedFeature.Momentary TEXT_SIMILARITY_RERANKER_FEATURE = LicensedFeature.momentary(
6456
null,
@@ -266,9 +258,6 @@ public RankFeaturePhaseRankCoordinatorContext buildRankFeaturePhaseCoordinatorCo
266258
* TODO: This should be pulled from the inference endpoint when available, not hardcoded.
267259
*/
268260
public static Integer tokenSizeLimit(String inferenceId) {
269-
if (inferenceId.equals(DEFAULT_RERANK_ID) || inferenceId.equals(RERANKER_ID)) {
270-
return RERANK_TOKEN_SIZE_LIMIT;
271-
}
272261
return DEFAULT_TOKEN_SIZE_LIMIT;
273262
}
274263

0 commit comments

Comments
 (0)