Skip to content

Commit 760f70f

Browse files
Removing ChunkingSettingsFeatureFlag (#114634)
* Removing ChunkingSettingsFeatureFlag * Removing chunking settings feature flag from tests and ModelRegistryIT
1 parent 3b3d827 commit 760f70f

File tree

27 files changed

+186
-1457
lines changed

27 files changed

+186
-1457
lines changed

test/test-clusters/src/main/java/org/elasticsearch/test/cluster/FeatureFlag.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
public enum FeatureFlag {
1919
TIME_SERIES_MODE("es.index_mode_feature_flag_registered=true", Version.fromString("8.0.0"), null),
2020
FAILURE_STORE_ENABLED("es.failure_store_feature_flag_enabled=true", Version.fromString("8.12.0"), null),
21-
CHUNKING_SETTINGS_ENABLED("es.inference_chunking_settings_feature_flag_enabled=true", Version.fromString("8.16.0"), null),
2221
INFERENCE_DEFAULT_ELSER("es.inference_default_elser_feature_flag_enabled=true", Version.fromString("8.16.0"), null);
2322

2423
public final String systemProperty;

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/ChunkingSettingsFeatureFlag.java

Lines changed: 0 additions & 24 deletions
This file was deleted.

x-pack/plugin/inference/src/internalClusterTest/java/org/elasticsearch/xpack/inference/integration/ModelRegistryIT.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.elasticsearch.threadpool.ThreadPool;
2828
import org.elasticsearch.xcontent.ToXContentObject;
2929
import org.elasticsearch.xcontent.XContentBuilder;
30-
import org.elasticsearch.xpack.core.inference.ChunkingSettingsFeatureFlag;
3130
import org.elasticsearch.xpack.inference.InferencePlugin;
3231
import org.elasticsearch.xpack.inference.chunking.ChunkingSettingsTests;
3332
import org.elasticsearch.xpack.inference.registry.ModelRegistry;
@@ -486,7 +485,7 @@ private Model buildElserModelConfig(String inferenceEntityId, TaskType taskType)
486485
ElasticsearchInternalService.NAME,
487486
ElserInternalServiceSettingsTests.createRandom(),
488487
ElserMlNodeTaskSettingsTests.createRandom(),
489-
ChunkingSettingsFeatureFlag.isEnabled() && randomBoolean() ? ChunkingSettingsTests.createRandomChunkingSettings() : null
488+
randomBoolean() ? ChunkingSettingsTests.createRandomChunkingSettings() : null
490489
);
491490
default -> throw new IllegalArgumentException("task type " + taskType + " is not supported");
492491
};

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/alibabacloudsearch/AlibabaCloudSearchService.java

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.elasticsearch.inference.SimilarityMeasure;
2626
import org.elasticsearch.inference.TaskType;
2727
import org.elasticsearch.rest.RestStatus;
28-
import org.elasticsearch.xpack.core.inference.ChunkingSettingsFeatureFlag;
2928
import org.elasticsearch.xpack.inference.chunking.ChunkingSettingsBuilder;
3029
import org.elasticsearch.xpack.inference.chunking.EmbeddingRequestChunker;
3130
import org.elasticsearch.xpack.inference.external.action.alibabacloudsearch.AlibabaCloudSearchActionCreator;
@@ -78,7 +77,7 @@ public void parseRequestConfig(
7877
Map<String, Object> taskSettingsMap = removeFromMapOrDefaultEmpty(config, ModelConfigurations.TASK_SETTINGS);
7978

8079
ChunkingSettings chunkingSettings = null;
81-
if (ChunkingSettingsFeatureFlag.isEnabled() && List.of(TaskType.TEXT_EMBEDDING, TaskType.SPARSE_EMBEDDING).contains(taskType)) {
80+
if (List.of(TaskType.TEXT_EMBEDDING, TaskType.SPARSE_EMBEDDING).contains(taskType)) {
8281
chunkingSettings = ChunkingSettingsBuilder.fromMap(
8382
removeFromMapOrDefaultEmpty(config, ModelConfigurations.CHUNKING_SETTINGS)
8483
);
@@ -191,7 +190,7 @@ public AlibabaCloudSearchModel parsePersistedConfigWithSecrets(
191190
Map<String, Object> secretSettingsMap = removeFromMapOrThrowIfNull(secrets, ModelSecrets.SECRET_SETTINGS);
192191

193192
ChunkingSettings chunkingSettings = null;
194-
if (ChunkingSettingsFeatureFlag.isEnabled() && List.of(TaskType.TEXT_EMBEDDING, TaskType.SPARSE_EMBEDDING).contains(taskType)) {
193+
if (List.of(TaskType.TEXT_EMBEDDING, TaskType.SPARSE_EMBEDDING).contains(taskType)) {
195194
chunkingSettings = ChunkingSettingsBuilder.fromMap(removeFromMapOrDefaultEmpty(config, ModelConfigurations.CHUNKING_SETTINGS));
196195
}
197196

@@ -212,7 +211,7 @@ public AlibabaCloudSearchModel parsePersistedConfig(String inferenceEntityId, Ta
212211
Map<String, Object> taskSettingsMap = removeFromMapOrDefaultEmpty(config, ModelConfigurations.TASK_SETTINGS);
213212

214213
ChunkingSettings chunkingSettings = null;
215-
if (ChunkingSettingsFeatureFlag.isEnabled() && List.of(TaskType.TEXT_EMBEDDING, TaskType.SPARSE_EMBEDDING).contains(taskType)) {
214+
if (List.of(TaskType.TEXT_EMBEDDING, TaskType.SPARSE_EMBEDDING).contains(taskType)) {
216215
chunkingSettings = ChunkingSettingsBuilder.fromMap(removeFromMapOrDefaultEmpty(config, ModelConfigurations.CHUNKING_SETTINGS));
217216
}
218217

@@ -266,21 +265,12 @@ protected void doChunkedInfer(
266265
AlibabaCloudSearchModel alibabaCloudSearchModel = (AlibabaCloudSearchModel) model;
267266
var actionCreator = new AlibabaCloudSearchActionCreator(getSender(), getServiceComponents());
268267

269-
List<EmbeddingRequestChunker.BatchRequestAndListener> batchedRequests;
270-
if (ChunkingSettingsFeatureFlag.isEnabled()) {
271-
batchedRequests = new EmbeddingRequestChunker(
272-
inputs.getInputs(),
273-
EMBEDDING_MAX_BATCH_SIZE,
274-
getEmbeddingTypeFromTaskType(alibabaCloudSearchModel.getTaskType()),
275-
alibabaCloudSearchModel.getConfigurations().getChunkingSettings()
276-
).batchRequestsWithListeners(listener);
277-
} else {
278-
batchedRequests = new EmbeddingRequestChunker(
279-
inputs.getInputs(),
280-
EMBEDDING_MAX_BATCH_SIZE,
281-
getEmbeddingTypeFromTaskType(alibabaCloudSearchModel.getTaskType())
282-
).batchRequestsWithListeners(listener);
283-
}
268+
List<EmbeddingRequestChunker.BatchRequestAndListener> batchedRequests = new EmbeddingRequestChunker(
269+
inputs.getInputs(),
270+
EMBEDDING_MAX_BATCH_SIZE,
271+
getEmbeddingTypeFromTaskType(alibabaCloudSearchModel.getTaskType()),
272+
alibabaCloudSearchModel.getConfigurations().getChunkingSettings()
273+
).batchRequestsWithListeners(listener);
284274

285275
for (var request : batchedRequests) {
286276
var action = alibabaCloudSearchModel.accept(actionCreator, taskSettings, inputType);

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/amazonbedrock/AmazonBedrockService.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.elasticsearch.inference.ModelSecrets;
2525
import org.elasticsearch.inference.TaskType;
2626
import org.elasticsearch.rest.RestStatus;
27-
import org.elasticsearch.xpack.core.inference.ChunkingSettingsFeatureFlag;
2827
import org.elasticsearch.xpack.inference.chunking.ChunkingSettingsBuilder;
2928
import org.elasticsearch.xpack.inference.chunking.EmbeddingRequestChunker;
3029
import org.elasticsearch.xpack.inference.external.action.amazonbedrock.AmazonBedrockActionCreator;
@@ -103,18 +102,12 @@ protected void doChunkedInfer(
103102
if (model instanceof AmazonBedrockModel baseAmazonBedrockModel) {
104103
var maxBatchSize = getEmbeddingsMaxBatchSize(baseAmazonBedrockModel.provider());
105104

106-
List<EmbeddingRequestChunker.BatchRequestAndListener> batchedRequests;
107-
if (ChunkingSettingsFeatureFlag.isEnabled()) {
108-
batchedRequests = new EmbeddingRequestChunker(
109-
inputs.getInputs(),
110-
maxBatchSize,
111-
EmbeddingRequestChunker.EmbeddingType.FLOAT,
112-
baseAmazonBedrockModel.getConfigurations().getChunkingSettings()
113-
).batchRequestsWithListeners(listener);
114-
} else {
115-
batchedRequests = new EmbeddingRequestChunker(inputs.getInputs(), maxBatchSize, EmbeddingRequestChunker.EmbeddingType.FLOAT)
116-
.batchRequestsWithListeners(listener);
117-
}
105+
List<EmbeddingRequestChunker.BatchRequestAndListener> batchedRequests = new EmbeddingRequestChunker(
106+
inputs.getInputs(),
107+
maxBatchSize,
108+
EmbeddingRequestChunker.EmbeddingType.FLOAT,
109+
baseAmazonBedrockModel.getConfigurations().getChunkingSettings()
110+
).batchRequestsWithListeners(listener);
118111

119112
for (var request : batchedRequests) {
120113
var action = baseAmazonBedrockModel.accept(actionCreator, taskSettings);
@@ -142,7 +135,7 @@ public void parseRequestConfig(
142135
Map<String, Object> taskSettingsMap = removeFromMapOrDefaultEmpty(config, ModelConfigurations.TASK_SETTINGS);
143136

144137
ChunkingSettings chunkingSettings = null;
145-
if (ChunkingSettingsFeatureFlag.isEnabled() && TaskType.TEXT_EMBEDDING.equals(taskType)) {
138+
if (TaskType.TEXT_EMBEDDING.equals(taskType)) {
146139
chunkingSettings = ChunkingSettingsBuilder.fromMap(
147140
removeFromMapOrDefaultEmpty(config, ModelConfigurations.CHUNKING_SETTINGS)
148141
);
@@ -181,7 +174,7 @@ public Model parsePersistedConfigWithSecrets(
181174
Map<String, Object> secretSettingsMap = removeFromMapOrDefaultEmpty(secrets, ModelSecrets.SECRET_SETTINGS);
182175

183176
ChunkingSettings chunkingSettings = null;
184-
if (ChunkingSettingsFeatureFlag.isEnabled() && TaskType.TEXT_EMBEDDING.equals(taskType)) {
177+
if (TaskType.TEXT_EMBEDDING.equals(taskType)) {
185178
chunkingSettings = ChunkingSettingsBuilder.fromMap(removeFromMapOrDefaultEmpty(config, ModelConfigurations.CHUNKING_SETTINGS));
186179
}
187180

@@ -203,7 +196,7 @@ public Model parsePersistedConfig(String modelId, TaskType taskType, Map<String,
203196
Map<String, Object> taskSettingsMap = removeFromMapOrDefaultEmpty(config, ModelConfigurations.TASK_SETTINGS);
204197

205198
ChunkingSettings chunkingSettings = null;
206-
if (ChunkingSettingsFeatureFlag.isEnabled() && TaskType.TEXT_EMBEDDING.equals(taskType)) {
199+
if (TaskType.TEXT_EMBEDDING.equals(taskType)) {
207200
chunkingSettings = ChunkingSettingsBuilder.fromMap(removeFromMapOrDefaultEmpty(config, ModelConfigurations.CHUNKING_SETTINGS));
208201
}
209202

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/azureaistudio/AzureAiStudioService.java

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.elasticsearch.inference.SimilarityMeasure;
2626
import org.elasticsearch.inference.TaskType;
2727
import org.elasticsearch.rest.RestStatus;
28-
import org.elasticsearch.xpack.core.inference.ChunkingSettingsFeatureFlag;
2928
import org.elasticsearch.xpack.inference.chunking.ChunkingSettingsBuilder;
3029
import org.elasticsearch.xpack.inference.chunking.EmbeddingRequestChunker;
3130
import org.elasticsearch.xpack.inference.external.action.azureaistudio.AzureAiStudioActionCreator;
@@ -95,21 +94,12 @@ protected void doChunkedInfer(
9594
if (model instanceof AzureAiStudioModel baseAzureAiStudioModel) {
9695
var actionCreator = new AzureAiStudioActionCreator(getSender(), getServiceComponents());
9796

98-
List<EmbeddingRequestChunker.BatchRequestAndListener> batchedRequests;
99-
if (ChunkingSettingsFeatureFlag.isEnabled()) {
100-
batchedRequests = new EmbeddingRequestChunker(
101-
inputs.getInputs(),
102-
EMBEDDING_MAX_BATCH_SIZE,
103-
EmbeddingRequestChunker.EmbeddingType.FLOAT,
104-
baseAzureAiStudioModel.getConfigurations().getChunkingSettings()
105-
).batchRequestsWithListeners(listener);
106-
} else {
107-
batchedRequests = new EmbeddingRequestChunker(
108-
inputs.getInputs(),
109-
EMBEDDING_MAX_BATCH_SIZE,
110-
EmbeddingRequestChunker.EmbeddingType.FLOAT
111-
).batchRequestsWithListeners(listener);
112-
}
97+
List<EmbeddingRequestChunker.BatchRequestAndListener> batchedRequests = new EmbeddingRequestChunker(
98+
inputs.getInputs(),
99+
EMBEDDING_MAX_BATCH_SIZE,
100+
EmbeddingRequestChunker.EmbeddingType.FLOAT,
101+
baseAzureAiStudioModel.getConfigurations().getChunkingSettings()
102+
).batchRequestsWithListeners(listener);
113103

114104
for (var request : batchedRequests) {
115105
var action = baseAzureAiStudioModel.accept(actionCreator, taskSettings);
@@ -132,7 +122,7 @@ public void parseRequestConfig(
132122
Map<String, Object> taskSettingsMap = removeFromMapOrDefaultEmpty(config, ModelConfigurations.TASK_SETTINGS);
133123

134124
ChunkingSettings chunkingSettings = null;
135-
if (ChunkingSettingsFeatureFlag.isEnabled() && TaskType.TEXT_EMBEDDING.equals(taskType)) {
125+
if (TaskType.TEXT_EMBEDDING.equals(taskType)) {
136126
chunkingSettings = ChunkingSettingsBuilder.fromMap(
137127
removeFromMapOrDefaultEmpty(config, ModelConfigurations.CHUNKING_SETTINGS)
138128
);
@@ -171,7 +161,7 @@ public AzureAiStudioModel parsePersistedConfigWithSecrets(
171161
Map<String, Object> secretSettingsMap = removeFromMapOrDefaultEmpty(secrets, ModelSecrets.SECRET_SETTINGS);
172162

173163
ChunkingSettings chunkingSettings = null;
174-
if (ChunkingSettingsFeatureFlag.isEnabled() && TaskType.TEXT_EMBEDDING.equals(taskType)) {
164+
if (TaskType.TEXT_EMBEDDING.equals(taskType)) {
175165
chunkingSettings = ChunkingSettingsBuilder.fromMap(removeFromMapOrDefaultEmpty(config, ModelConfigurations.CHUNKING_SETTINGS));
176166
}
177167

@@ -192,7 +182,7 @@ public Model parsePersistedConfig(String inferenceEntityId, TaskType taskType, M
192182
Map<String, Object> taskSettingsMap = removeFromMapOrDefaultEmpty(config, ModelConfigurations.TASK_SETTINGS);
193183

194184
ChunkingSettings chunkingSettings = null;
195-
if (ChunkingSettingsFeatureFlag.isEnabled() && TaskType.TEXT_EMBEDDING.equals(taskType)) {
185+
if (TaskType.TEXT_EMBEDDING.equals(taskType)) {
196186
chunkingSettings = ChunkingSettingsBuilder.fromMap(removeFromMapOrDefaultEmpty(config, ModelConfigurations.CHUNKING_SETTINGS));
197187
}
198188

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/azureopenai/AzureOpenAiService.java

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.elasticsearch.inference.SimilarityMeasure;
2626
import org.elasticsearch.inference.TaskType;
2727
import org.elasticsearch.rest.RestStatus;
28-
import org.elasticsearch.xpack.core.inference.ChunkingSettingsFeatureFlag;
2928
import org.elasticsearch.xpack.inference.chunking.ChunkingSettingsBuilder;
3029
import org.elasticsearch.xpack.inference.chunking.EmbeddingRequestChunker;
3130
import org.elasticsearch.xpack.inference.external.action.azureopenai.AzureOpenAiActionCreator;
@@ -75,7 +74,7 @@ public void parseRequestConfig(
7574
Map<String, Object> taskSettingsMap = removeFromMapOrDefaultEmpty(config, ModelConfigurations.TASK_SETTINGS);
7675

7776
ChunkingSettings chunkingSettings = null;
78-
if (ChunkingSettingsFeatureFlag.isEnabled() && TaskType.TEXT_EMBEDDING.equals(taskType)) {
77+
if (TaskType.TEXT_EMBEDDING.equals(taskType)) {
7978
chunkingSettings = ChunkingSettingsBuilder.fromMap(
8079
removeFromMapOrDefaultEmpty(config, ModelConfigurations.CHUNKING_SETTINGS)
8180
);
@@ -173,7 +172,7 @@ public AzureOpenAiModel parsePersistedConfigWithSecrets(
173172
Map<String, Object> secretSettingsMap = removeFromMapOrDefaultEmpty(secrets, ModelSecrets.SECRET_SETTINGS);
174173

175174
ChunkingSettings chunkingSettings = null;
176-
if (ChunkingSettingsFeatureFlag.isEnabled() && TaskType.TEXT_EMBEDDING.equals(taskType)) {
175+
if (TaskType.TEXT_EMBEDDING.equals(taskType)) {
177176
chunkingSettings = ChunkingSettingsBuilder.fromMap(removeFromMapOrDefaultEmpty(config, ModelConfigurations.CHUNKING_SETTINGS));
178177
}
179178

@@ -194,7 +193,7 @@ public AzureOpenAiModel parsePersistedConfig(String inferenceEntityId, TaskType
194193
Map<String, Object> taskSettingsMap = removeFromMapOrDefaultEmpty(config, ModelConfigurations.TASK_SETTINGS);
195194

196195
ChunkingSettings chunkingSettings = null;
197-
if (ChunkingSettingsFeatureFlag.isEnabled() && TaskType.TEXT_EMBEDDING.equals(taskType)) {
196+
if (TaskType.TEXT_EMBEDDING.equals(taskType)) {
198197
chunkingSettings = ChunkingSettingsBuilder.fromMap(removeFromMapOrDefaultEmpty(config, ModelConfigurations.CHUNKING_SETTINGS));
199198
}
200199

@@ -247,21 +246,12 @@ protected void doChunkedInfer(
247246
AzureOpenAiModel azureOpenAiModel = (AzureOpenAiModel) model;
248247
var actionCreator = new AzureOpenAiActionCreator(getSender(), getServiceComponents());
249248

250-
List<EmbeddingRequestChunker.BatchRequestAndListener> batchedRequests;
251-
if (ChunkingSettingsFeatureFlag.isEnabled()) {
252-
batchedRequests = new EmbeddingRequestChunker(
253-
inputs.getInputs(),
254-
EMBEDDING_MAX_BATCH_SIZE,
255-
EmbeddingRequestChunker.EmbeddingType.FLOAT,
256-
azureOpenAiModel.getConfigurations().getChunkingSettings()
257-
).batchRequestsWithListeners(listener);
258-
} else {
259-
batchedRequests = new EmbeddingRequestChunker(
260-
inputs.getInputs(),
261-
EMBEDDING_MAX_BATCH_SIZE,
262-
EmbeddingRequestChunker.EmbeddingType.FLOAT
263-
).batchRequestsWithListeners(listener);
264-
}
249+
List<EmbeddingRequestChunker.BatchRequestAndListener> batchedRequests = new EmbeddingRequestChunker(
250+
inputs.getInputs(),
251+
EMBEDDING_MAX_BATCH_SIZE,
252+
EmbeddingRequestChunker.EmbeddingType.FLOAT,
253+
azureOpenAiModel.getConfigurations().getChunkingSettings()
254+
).batchRequestsWithListeners(listener);
265255

266256
for (var request : batchedRequests) {
267257
var action = azureOpenAiModel.accept(actionCreator, taskSettings);

0 commit comments

Comments
 (0)