Skip to content

Commit

Permalink
Fix RAG feature flag enablement.
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Lee <[email protected]>
  • Loading branch information
austintlee committed Sep 4, 2023
1 parent 8f4d90d commit a1df6a1
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import static org.opensearch.ml.common.CommonValue.ML_MODEL_INDEX;
import static org.opensearch.ml.common.CommonValue.ML_TASK_INDEX;
import static org.opensearch.ml.settings.MLCommonsSettings.ML_COMMONS_RAG_PIPELINE_FEATURE_ENABLED;

import java.nio.file.Path;
import java.util.Collection;
Expand Down Expand Up @@ -251,6 +250,10 @@ public class MachineLearningPlugin extends Plugin implements ActionPlugin, Searc

private volatile boolean ragSearchPipelineEnabled;

public MachineLearningPlugin(Settings settings) {
this.ragSearchPipelineEnabled = MLCommonsSettings.ML_COMMONS_RAG_PIPELINE_FEATURE_ENABLED.get(settings);
}

@Override
public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() {
return ImmutableList
Expand Down Expand Up @@ -342,12 +345,6 @@ public Collection<Object> createComponents(
stats.put(MLNodeLevelStat.ML_NODE_TOTAL_CIRCUIT_BREAKER_TRIGGER_COUNT, new MLStat<>(false, new CounterSupplier()));
this.mlStats = new MLStats(stats);

// TODO move this into MLFeatureEnabledSetting
this.ragSearchPipelineEnabled = ML_COMMONS_RAG_PIPELINE_FEATURE_ENABLED.get(clusterService.getSettings());
clusterService
.getClusterSettings()
.addSettingsUpdateConsumer(ML_COMMONS_RAG_PIPELINE_FEATURE_ENABLED, it -> ragSearchPipelineEnabled = it);

mlIndicesHandler = new MLIndicesHandler(clusterService, client);
mlTaskManager = new MLTaskManager(client, threadPool, mlIndicesHandler);
modelHelper = new ModelHelper(mlEngine);
Expand Down Expand Up @@ -459,6 +456,11 @@ public Collection<Object> createComponents(
encryptor
);

// TODO move this into MLFeatureEnabledSetting
clusterService
.getClusterSettings()
.addSettingsUpdateConsumer(MLCommonsSettings.ML_COMMONS_RAG_PIPELINE_FEATURE_ENABLED, it -> ragSearchPipelineEnabled = it);

return ImmutableList
.of(
encryptor,
Expand Down Expand Up @@ -665,7 +667,7 @@ public List<Setting<?>> getSettings() {
MLCommonsSettings.ML_COMMONS_CONNECTOR_ACCESS_CONTROL_ENABLED,
MLCommonsSettings.ML_COMMONS_TRUSTED_CONNECTOR_ENDPOINTS_REGEX,
MLCommonsSettings.ML_COMMONS_MEMORY_FEATURE_ENABLED,
ML_COMMONS_RAG_PIPELINE_FEATURE_ENABLED
MLCommonsSettings.ML_COMMONS_RAG_PIPELINE_FEATURE_ENABLED
);
return settings;
}
Expand Down

0 comments on commit a1df6a1

Please sign in to comment.