Skip to content

Commit 334de43

Browse files
committed
Make max dimensions configurable
1 parent 1beb1da commit 334de43

File tree

1 file changed

+7
-1
lines changed
  • x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/model

1 file changed

+7
-1
lines changed

x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/model/TestModel.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.List;
3232
import java.util.Map;
3333

34+
import static org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapper.BBQ_MIN_DIMS;
3435
import static org.elasticsearch.test.ESTestCase.randomAlphaOfLength;
3536
import static org.elasticsearch.test.ESTestCase.randomFrom;
3637
import static org.elasticsearch.test.ESTestCase.randomInt;
@@ -46,9 +47,14 @@ public static TestModel createRandomInstance(TaskType taskType) {
4647
}
4748

4849
public static TestModel createRandomInstance(TaskType taskType, List<SimilarityMeasure> excludedSimilarities) {
50+
// Use a max dimension count that has a reasonable probability of being compatible with BBQ
51+
return createRandomInstance(taskType, excludedSimilarities, BBQ_MIN_DIMS * 2);
52+
}
53+
54+
public static TestModel createRandomInstance(TaskType taskType, List<SimilarityMeasure> excludedSimilarities, int maxDimensions) {
4955
var elementType = taskType == TaskType.TEXT_EMBEDDING ? randomFrom(DenseVectorFieldMapper.ElementType.values()) : null;
5056
var dimensions = taskType == TaskType.TEXT_EMBEDDING
51-
? DenseVectorFieldMapperTestUtils.randomCompatibleDimensions(elementType, 64)
57+
? DenseVectorFieldMapperTestUtils.randomCompatibleDimensions(elementType, maxDimensions)
5258
: null;
5359

5460
SimilarityMeasure similarity = null;

0 commit comments

Comments
 (0)