File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/model Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 3131import java .util .List ;
3232import java .util .Map ;
3333
34+ import static org .elasticsearch .index .mapper .vectors .DenseVectorFieldMapper .BBQ_MIN_DIMS ;
3435import static org .elasticsearch .test .ESTestCase .randomAlphaOfLength ;
3536import static org .elasticsearch .test .ESTestCase .randomFrom ;
3637import 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 ;
You can’t perform that action at this time.
0 commit comments