Skip to content

Commit 8deb06c

Browse files
Fixing ChunkingSettingsBuilder test for generating rerank chunking settings (#135965) (#136100)
Co-authored-by: Elastic Machine <[email protected]>
1 parent c750906 commit 8deb06c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/chunking/ChunkingSettingsBuilderTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void testValidChunkingSettingsMap() {
5454
public void testBuildChunkingSettingsForElasticReranker_QueryTokenCountLessThanHalfOfTokenLimit() {
5555
// Generate a word count for a non-empty query that takes up less than half the token limit
5656
int maxQueryTokenCount = (ELASTIC_RERANKER_TOKEN_LIMIT - ELASTIC_RERANKER_EXTRA_TOKEN_COUNT) / 2;
57-
int queryWordCount = randomIntBetween(1, (int) (maxQueryTokenCount * WORDS_PER_TOKEN));
57+
int queryWordCount = randomIntBetween(1, (int) (maxQueryTokenCount * WORDS_PER_TOKEN) - 1);
5858
var queryTokenCount = Math.ceil(queryWordCount / WORDS_PER_TOKEN);
5959
ChunkingSettings chunkingSettings = ChunkingSettingsBuilder.buildChunkingSettingsForElasticRerank(queryWordCount);
6060
assertTrue(chunkingSettings instanceof SentenceBoundaryChunkingSettings);

0 commit comments

Comments
 (0)