Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private static CommonFields commonFieldsFromMap(Map<String, Object> map, Validat
private final DenseVectorFieldMapper.ElementType elementType;

CustomElandInternalTextEmbeddingServiceSettings(
int numAllocations,
Integer numAllocations,
int numThreads,
String modelId,
AdaptiveAllocationsSettings adaptiveAllocationsSettings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentFactory;
import org.elasticsearch.xcontent.XContentType;
import org.elasticsearch.xpack.core.ml.inference.assignment.AdaptiveAllocationsSettings;
import org.elasticsearch.xpack.inference.services.ConfigurationParseContext;
import org.elasticsearch.xpack.inference.services.ServiceFields;

Expand All @@ -31,23 +32,23 @@ public class CustomElandInternalTextEmbeddingServiceSettingsTests extends Abstra
CustomElandInternalTextEmbeddingServiceSettings> {

public static CustomElandInternalTextEmbeddingServiceSettings createRandom() {
var numAllocations = randomIntBetween(1, 10);
var withAdaptiveAllocations = randomBoolean();
var numAllocations = withAdaptiveAllocations ? null : randomIntBetween(1, 10);
var adaptiveAllocationsSettings = withAdaptiveAllocations
? new AdaptiveAllocationsSettings(true, randomIntBetween(0, 2), randomIntBetween(2, 5))
: null;
var numThreads = randomIntBetween(1, 10);
var modelId = randomAlphaOfLength(8);
SimilarityMeasure similarityMeasure = SimilarityMeasure.COSINE;
Integer dims = null;
var similarityMeasure = SimilarityMeasure.COSINE;
var setDimensions = randomBoolean();
if (setDimensions) {
dims = 123;
}

var dims = setDimensions ? 123 : null;
var elementType = randomFrom(DenseVectorFieldMapper.ElementType.values());

return new CustomElandInternalTextEmbeddingServiceSettings(
numAllocations,
numThreads,
modelId,
null,
adaptiveAllocationsSettings,
null,
dims,
similarityMeasure,
Expand Down