From 3e6307b584a79da1c4d81a07863c8d13014556d0 Mon Sep 17 00:00:00 2001 From: kokibas Date: Mon, 26 Jan 2026 14:07:51 +0500 Subject: [PATCH 1/9] Refactor to const DeployModel & RegisterRemoteModel Steps Signed-off-by: kokibas --- .../workflow/DeployModelStep.java | 13 +++++++----- .../workflow/RegisterRemoteModelStep.java | 20 ++++++++++++++----- .../workflow/WorkflowStepFactory.java | 12 ++++++++--- .../model/WorkflowStepValidatorTests.java | 20 +++++++++++++++++++ 4 files changed, 52 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/opensearch/flowframework/workflow/DeployModelStep.java b/src/main/java/org/opensearch/flowframework/workflow/DeployModelStep.java index 1303c67bb..ce74c482d 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/DeployModelStep.java +++ b/src/main/java/org/opensearch/flowframework/workflow/DeployModelStep.java @@ -41,6 +41,12 @@ public class DeployModelStep extends AbstractRetryableWorkflowStep { /** The name of this step, used as a key in the template and the {@link WorkflowStepFactory} */ public static final String NAME = "deploy_model"; + /** Required input keys **/ + public static final Set REQUIRED_INPUTS = Set.of(MODEL_ID); + /** Optional input keys */ + public static final Set OPTIONAL_INPUTS = Collections.emptySet(); + /** Provided output keys */ + public static final Set PROVIDED_OUTPUTS = Set.of(MODEL_ID); /** * Instantiate this class @@ -71,13 +77,10 @@ public PlainActionFuture execute( PlainActionFuture deployModelFuture = PlainActionFuture.newFuture(); - Set requiredKeys = Set.of(MODEL_ID); - Set optionalKeys = Collections.emptySet(); - try { Map inputs = ParseUtils.getInputsFromPreviousSteps( - requiredKeys, - optionalKeys, + REQUIRED_INPUTS, + OPTIONAL_INPUTS, currentNodeInputs, outputs, previousNodeInputs, diff --git a/src/main/java/org/opensearch/flowframework/workflow/RegisterRemoteModelStep.java b/src/main/java/org/opensearch/flowframework/workflow/RegisterRemoteModelStep.java index 183a757e9..6578a4c22 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/RegisterRemoteModelStep.java +++ b/src/main/java/org/opensearch/flowframework/workflow/RegisterRemoteModelStep.java @@ -41,6 +41,7 @@ import static org.opensearch.flowframework.common.CommonValue.REGISTER_MODEL_STATUS; import static org.opensearch.flowframework.common.WorkflowResources.CONNECTOR_ID; import static org.opensearch.flowframework.common.WorkflowResources.MODEL_GROUP_ID; +import static org.opensearch.flowframework.common.WorkflowResources.MODEL_ID; import static org.opensearch.flowframework.common.WorkflowResources.getResourceByWorkflowStep; import static org.opensearch.flowframework.exception.WorkflowStepException.getSafeException; @@ -57,6 +58,18 @@ public class RegisterRemoteModelStep implements WorkflowStep { /** The name of this step, used as a key in the template and the {@link WorkflowStepFactory} */ public static final String NAME = "register_remote_model"; + /** Required input keys **/ + public static final Set REQUIRED_INPUTS = Set.of(NAME_FIELD, CONNECTOR_ID); + /** Optional input keys */ + public static final Set OPTIONAL_INPUTS = Set.of( + MODEL_GROUP_ID, + DESCRIPTION_FIELD, + DEPLOY_FIELD, + GUARDRAILS_FIELD, + INTERFACE_FIELD + ); + /** Provided output keys */ + public static final Set PROVIDED_OUTPUTS = Set.of(MODEL_ID, REGISTER_MODEL_STATUS); /** * Instantiate this class @@ -80,13 +93,10 @@ public PlainActionFuture execute( PlainActionFuture registerRemoteModelFuture = PlainActionFuture.newFuture(); - Set requiredKeys = Set.of(NAME_FIELD, CONNECTOR_ID); - Set optionalKeys = Set.of(MODEL_GROUP_ID, DESCRIPTION_FIELD, DEPLOY_FIELD, GUARDRAILS_FIELD, INTERFACE_FIELD); - try { Map inputs = ParseUtils.getInputsFromPreviousSteps( - requiredKeys, - optionalKeys, + REQUIRED_INPUTS, + OPTIONAL_INPUTS, currentNodeInputs, outputs, previousNodeInputs, diff --git a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java index f0c80e800..40e4ffa58 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java +++ b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java @@ -198,8 +198,8 @@ public enum WorkflowSteps { /** Register Remote Model Step */ REGISTER_REMOTE_MODEL( RegisterRemoteModelStep.NAME, - List.of(NAME_FIELD, CONNECTOR_ID), - List.of(MODEL_ID, REGISTER_MODEL_STATUS), + RegisterRemoteModelStep.REQUIRED_INPUTS, + RegisterRemoteModelStep.PROVIDED_OUTPUTS, List.of(OPENSEARCH_ML), null ), @@ -214,7 +214,13 @@ public enum WorkflowSteps { ), /** Deploy Model Step */ - DEPLOY_MODEL(DeployModelStep.NAME, List.of(MODEL_ID), List.of(MODEL_ID), List.of(OPENSEARCH_ML), TimeValue.timeValueSeconds(15)), + DEPLOY_MODEL( + DeployModelStep.NAME, + DeployModelStep.REQUIRED_INPUTS, + DeployModelStep.PROVIDED_OUTPUTS, + List.of(OPENSEARCH_ML), + TimeValue.timeValueSeconds(15) + ), /** Undeploy Model Step */ UNDEPLOY_MODEL(UndeployModelStep.NAME, List.of(MODEL_ID), List.of(SUCCESS), List.of(OPENSEARCH_ML), null), diff --git a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java index c1e581beb..f3047ab94 100644 --- a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java +++ b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java @@ -11,6 +11,8 @@ import org.opensearch.flowframework.workflow.CreateConnectorStep; import org.opensearch.flowframework.workflow.CreateIndexStep; import org.opensearch.flowframework.workflow.DeleteIndexStep; +import org.opensearch.flowframework.workflow.DeployModelStep; +import org.opensearch.flowframework.workflow.RegisterRemoteModelStep; import org.opensearch.flowframework.workflow.WorkflowStepFactory; import org.opensearch.test.OpenSearchTestCase; @@ -71,4 +73,22 @@ public void testCreateIndexStepValidator() throws IOException { ); } + public void testDeployModelStepValidator() throws IOException { + assertStepValidatorMatches( + WorkflowStepFactory.WorkflowSteps.DEPLOY_MODEL, + DeployModelStep.NAME, + DeployModelStep.REQUIRED_INPUTS, + DeployModelStep.PROVIDED_OUTPUTS + ); + } + + public void testRegisterRemoteModelStepValidator() throws IOException { + assertStepValidatorMatches( + WorkflowStepFactory.WorkflowSteps.REGISTER_REMOTE_MODEL, + RegisterRemoteModelStep.NAME, + RegisterRemoteModelStep.REQUIRED_INPUTS, + RegisterRemoteModelStep.PROVIDED_OUTPUTS + ); + } + } From e43f41b6161fb9a1de01e58ec961b1965b817269 Mon Sep 17 00:00:00 2001 From: kokibas Date: Tue, 27 Jan 2026 16:56:26 +0500 Subject: [PATCH 2/9] Refactor ReIndexStep to use const Signed-off-by: kokibas --- .../flowframework/workflow/ReindexStep.java | 14 ++++++++------ .../workflow/WorkflowStepFactory.java | 4 +--- .../model/WorkflowStepValidatorTests.java | 10 ++++++++++ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/opensearch/flowframework/workflow/ReindexStep.java b/src/main/java/org/opensearch/flowframework/workflow/ReindexStep.java index 1d221f60b..a15991f28 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/ReindexStep.java +++ b/src/main/java/org/opensearch/flowframework/workflow/ReindexStep.java @@ -51,6 +51,12 @@ public class ReindexStep implements WorkflowStep { private static final String SLICES = "slices"; /** The max_docs field for reindex */ private static final String MAX_DOCS = "max_docs"; + /** Required input keys **/ + public static final Set REQUIRED_INPUTS = Set.of(SOURCE_INDEX, DESTINATION_INDEX); + /** Optional input keys */ + public static final Set OPTIONAL_INPUTS = Set.of(REFRESH, REQUESTS_PER_SECOND, REQUIRE_ALIAS, SLICES, MAX_DOCS); + /** Provided output keys */ + public static final Set PROVIDED_OUTPUTS = Set.of(NAME); /** * Instantiate this class @@ -74,14 +80,10 @@ public PlainActionFuture execute( PlainActionFuture reIndexFuture = PlainActionFuture.newFuture(); - Set requiredKeys = Set.of(SOURCE_INDEX, DESTINATION_INDEX); - - Set optionalKeys = Set.of(REFRESH, REQUESTS_PER_SECOND, REQUIRE_ALIAS, SLICES, MAX_DOCS); - try { Map inputs = ParseUtils.getInputsFromPreviousSteps( - requiredKeys, - optionalKeys, + REQUIRED_INPUTS, + OPTIONAL_INPUTS, currentNodeInputs, outputs, previousNodeInputs, diff --git a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java index 40e4ffa58..c1d7eed9a 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java +++ b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java @@ -34,7 +34,6 @@ import java.util.stream.Stream; import static org.opensearch.flowframework.common.CommonValue.CONFIGURATIONS; -import static org.opensearch.flowframework.common.CommonValue.DESTINATION_INDEX; import static org.opensearch.flowframework.common.CommonValue.EMBEDDING_DIMENSION; import static org.opensearch.flowframework.common.CommonValue.FRAMEWORK_TYPE; import static org.opensearch.flowframework.common.CommonValue.FUNCTION_NAME; @@ -46,7 +45,6 @@ import static org.opensearch.flowframework.common.CommonValue.OPENSEARCH_ML; import static org.opensearch.flowframework.common.CommonValue.PIPELINE_ID; import static org.opensearch.flowframework.common.CommonValue.REGISTER_MODEL_STATUS; -import static org.opensearch.flowframework.common.CommonValue.SOURCE_INDEX; import static org.opensearch.flowframework.common.CommonValue.SUCCESS; import static org.opensearch.flowframework.common.CommonValue.TYPE; import static org.opensearch.flowframework.common.CommonValue.URL; @@ -147,7 +145,7 @@ public enum WorkflowSteps { ), /** Create ReIndex Step */ - REINDEX(ReindexStep.NAME, List.of(SOURCE_INDEX, DESTINATION_INDEX), List.of(ReindexStep.NAME), Collections.emptyList(), null), + REINDEX(ReindexStep.NAME, ReindexStep.REQUIRED_INPUTS, ReindexStep.PROVIDED_OUTPUTS, Collections.emptyList(), null), /** Create Connector Step */ CREATE_CONNECTOR( diff --git a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java index f3047ab94..ed903c3ab 100644 --- a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java +++ b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java @@ -13,6 +13,7 @@ import org.opensearch.flowframework.workflow.DeleteIndexStep; import org.opensearch.flowframework.workflow.DeployModelStep; import org.opensearch.flowframework.workflow.RegisterRemoteModelStep; +import org.opensearch.flowframework.workflow.ReindexStep; import org.opensearch.flowframework.workflow.WorkflowStepFactory; import org.opensearch.test.OpenSearchTestCase; @@ -91,4 +92,13 @@ public void testRegisterRemoteModelStepValidator() throws IOException { ); } + public void testReIndexStepValidator() throws IOException { + assertStepValidatorMatches( + WorkflowStepFactory.WorkflowSteps.REINDEX, + ReindexStep.NAME, + ReindexStep.REQUIRED_INPUTS, + ReindexStep.PROVIDED_OUTPUTS + ); + } + } From b7ebb434f40ce7c54d6ea31df85e200ce8b112d3 Mon Sep 17 00:00:00 2001 From: kokibas Date: Tue, 27 Jan 2026 17:03:28 +0500 Subject: [PATCH 3/9] Refactor RegisterModelGroupStep to use const Signed-off-by: kokibas --- .../workflow/RegisterModelGroupStep.java | 19 ++++++++++++++----- .../workflow/WorkflowStepFactory.java | 6 ++---- .../model/WorkflowStepValidatorTests.java | 10 ++++++++++ 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/opensearch/flowframework/workflow/RegisterModelGroupStep.java b/src/main/java/org/opensearch/flowframework/workflow/RegisterModelGroupStep.java index 871e1f24d..9e8ddb33d 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/RegisterModelGroupStep.java +++ b/src/main/java/org/opensearch/flowframework/workflow/RegisterModelGroupStep.java @@ -38,6 +38,7 @@ import static org.opensearch.flowframework.common.CommonValue.MODEL_ACCESS_MODE; import static org.opensearch.flowframework.common.CommonValue.MODEL_GROUP_STATUS; import static org.opensearch.flowframework.common.CommonValue.NAME_FIELD; +import static org.opensearch.flowframework.common.WorkflowResources.MODEL_GROUP_ID; import static org.opensearch.flowframework.exception.WorkflowStepException.getSafeException; /** @@ -53,6 +54,17 @@ public class RegisterModelGroupStep implements WorkflowStep { /** The name of this step, used as a key in the template and the {@link WorkflowStepFactory} */ public static final String NAME = "register_model_group"; + /** Required input keys **/ + public static final Set REQUIRED_INPUTS = Set.of(NAME_FIELD); + /** Optional input keys */ + public static final Set OPTIONAL_INPUTS = Set.of( + DESCRIPTION_FIELD, + BACKEND_ROLES_FIELD, + MODEL_ACCESS_MODE, + ADD_ALL_BACKEND_ROLES + ); + /** Provided output keys */ + public static final Set PROVIDED_OUTPUTS = Set.of(MODEL_GROUP_ID, MODEL_GROUP_STATUS); /** * Instantiate this class @@ -103,13 +115,10 @@ public void onFailure(Exception ex) { } }; - Set requiredKeys = Set.of(NAME_FIELD); - Set optionalKeys = Set.of(DESCRIPTION_FIELD, BACKEND_ROLES_FIELD, MODEL_ACCESS_MODE, ADD_ALL_BACKEND_ROLES); - try { Map inputs = ParseUtils.getInputsFromPreviousSteps( - requiredKeys, - optionalKeys, + REQUIRED_INPUTS, + OPTIONAL_INPUTS, currentNodeInputs, outputs, previousNodeInputs, diff --git a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java index c1d7eed9a..1978aefff 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java +++ b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java @@ -39,7 +39,6 @@ import static org.opensearch.flowframework.common.CommonValue.FUNCTION_NAME; import static org.opensearch.flowframework.common.CommonValue.MODEL_CONTENT_HASH_VALUE; import static org.opensearch.flowframework.common.CommonValue.MODEL_FORMAT; -import static org.opensearch.flowframework.common.CommonValue.MODEL_GROUP_STATUS; import static org.opensearch.flowframework.common.CommonValue.MODEL_TYPE; import static org.opensearch.flowframework.common.CommonValue.NAME_FIELD; import static org.opensearch.flowframework.common.CommonValue.OPENSEARCH_ML; @@ -52,7 +51,6 @@ import static org.opensearch.flowframework.common.WorkflowResources.AGENT_ID; import static org.opensearch.flowframework.common.WorkflowResources.CONNECTOR_ID; import static org.opensearch.flowframework.common.WorkflowResources.INDEX_NAME; -import static org.opensearch.flowframework.common.WorkflowResources.MODEL_GROUP_ID; import static org.opensearch.flowframework.common.WorkflowResources.MODEL_ID; /** @@ -205,8 +203,8 @@ public enum WorkflowSteps { /** Register Model Group Step */ REGISTER_MODEL_GROUP( RegisterModelGroupStep.NAME, - List.of(NAME_FIELD), - List.of(MODEL_GROUP_ID, MODEL_GROUP_STATUS), + RegisterModelGroupStep.REQUIRED_INPUTS, + RegisterModelGroupStep.PROVIDED_OUTPUTS, List.of(OPENSEARCH_ML), null ), diff --git a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java index ed903c3ab..f535dedb8 100644 --- a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java +++ b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java @@ -12,6 +12,7 @@ import org.opensearch.flowframework.workflow.CreateIndexStep; import org.opensearch.flowframework.workflow.DeleteIndexStep; import org.opensearch.flowframework.workflow.DeployModelStep; +import org.opensearch.flowframework.workflow.RegisterModelGroupStep; import org.opensearch.flowframework.workflow.RegisterRemoteModelStep; import org.opensearch.flowframework.workflow.ReindexStep; import org.opensearch.flowframework.workflow.WorkflowStepFactory; @@ -101,4 +102,13 @@ public void testReIndexStepValidator() throws IOException { ); } + public void testRegisterModelGroupStepValidator() throws IOException { + assertStepValidatorMatches( + WorkflowStepFactory.WorkflowSteps.REGISTER_MODEL_GROUP, + RegisterModelGroupStep.NAME, + RegisterModelGroupStep.REQUIRED_INPUTS, + RegisterModelGroupStep.PROVIDED_OUTPUTS + ); + } + } From 0821e0ac48fb15f7c19647a6539179eaf98e15e6 Mon Sep 17 00:00:00 2001 From: kokibas Date: Fri, 30 Jan 2026 17:03:00 +0500 Subject: [PATCH 4/9] Refactor UndeployModelStep to use const Signed-off-by: kokibas --- .../flowframework/workflow/UndeployModelStep.java | 14 +++++++++----- .../workflow/WorkflowStepFactory.java | 2 +- .../model/WorkflowStepValidatorTests.java | 9 +++++++++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/opensearch/flowframework/workflow/UndeployModelStep.java b/src/main/java/org/opensearch/flowframework/workflow/UndeployModelStep.java index a4764576f..b67e0669e 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/UndeployModelStep.java +++ b/src/main/java/org/opensearch/flowframework/workflow/UndeployModelStep.java @@ -43,7 +43,12 @@ public class UndeployModelStep implements WorkflowStep { /** The name of this step, used as a key in the template and the {@link WorkflowStepFactory} */ public static final String NAME = "undeploy_model"; - + /** Required input keys **/ + public static final Set REQUIRED_INPUTS = Set.of(MODEL_ID); + /** Optional input keys */ + public static final Set OPTIONAL_INPUTS = Collections.emptySet(); + /** Provided output keys */ + public static final Set PROVIDED_OUTPUTS = Set.of(SUCCESS); /** * Instantiate this class * @param mlClient Machine Learning client to perform the undeploy @@ -63,13 +68,12 @@ public PlainActionFuture execute( ) { PlainActionFuture undeployModelFuture = PlainActionFuture.newFuture(); - Set requiredKeys = Set.of(MODEL_ID); - Set optionalKeys = Collections.emptySet(); + try { Map inputs = ParseUtils.getInputsFromPreviousSteps( - requiredKeys, - optionalKeys, + REQUIRED_INPUTS, + OPTIONAL_INPUTS, currentNodeInputs, outputs, previousNodeInputs, diff --git a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java index 1978aefff..df058c069 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java +++ b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java @@ -219,7 +219,7 @@ public enum WorkflowSteps { ), /** Undeploy Model Step */ - UNDEPLOY_MODEL(UndeployModelStep.NAME, List.of(MODEL_ID), List.of(SUCCESS), List.of(OPENSEARCH_ML), null), + UNDEPLOY_MODEL(UndeployModelStep.NAME, UndeployModelStep.REQUIRED_INPUTS, UndeployModelStep.PROVIDED_OUTPUTS, List.of(OPENSEARCH_ML), null), /** Delete Model Step */ DELETE_MODEL(DeleteModelStep.NAME, List.of(MODEL_ID), List.of(MODEL_ID), List.of(OPENSEARCH_ML), null), diff --git a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java index f535dedb8..43c15376d 100644 --- a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java +++ b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java @@ -15,6 +15,7 @@ import org.opensearch.flowframework.workflow.RegisterModelGroupStep; import org.opensearch.flowframework.workflow.RegisterRemoteModelStep; import org.opensearch.flowframework.workflow.ReindexStep; +import org.opensearch.flowframework.workflow.UndeployModelStep; import org.opensearch.flowframework.workflow.WorkflowStepFactory; import org.opensearch.test.OpenSearchTestCase; @@ -110,5 +111,13 @@ public void testRegisterModelGroupStepValidator() throws IOException { RegisterModelGroupStep.PROVIDED_OUTPUTS ); } + public void testUndeployModelStepValidator() throws IOException { + assertStepValidatorMatches( + WorkflowStepFactory.WorkflowSteps.UNDEPLOY_MODEL, + UndeployModelStep.NAME, + UndeployModelStep.REQUIRED_INPUTS, + UndeployModelStep.PROVIDED_OUTPUTS + ); + } } From 8c1218597eaad1d3c6e09f8b07c78aa00c9cd2b2 Mon Sep 17 00:00:00 2001 From: kokibas Date: Fri, 30 Jan 2026 17:07:30 +0500 Subject: [PATCH 5/9] Refactor DeleteModelStep to use const Signed-off-by: kokibas --- .../workflow/DeleteModelStep.java | 13 ++++++++----- .../workflow/UndeployModelStep.java | 3 +-- .../workflow/WorkflowStepFactory.java | 11 ++++++++--- .../model/WorkflowStepValidatorTests.java | 19 +++++++++++++++---- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/opensearch/flowframework/workflow/DeleteModelStep.java b/src/main/java/org/opensearch/flowframework/workflow/DeleteModelStep.java index 207ea1c76..2560c1033 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/DeleteModelStep.java +++ b/src/main/java/org/opensearch/flowframework/workflow/DeleteModelStep.java @@ -40,6 +40,12 @@ public class DeleteModelStep implements WorkflowStep { /** The name of this step, used as a key in the template and the {@link WorkflowStepFactory} */ public static final String NAME = "delete_model"; + /** Required input keys **/ + public static final Set REQUIRED_INPUTS = Set.of(MODEL_ID); + /** Optional input keys */ + public static final Set OPTIONAL_INPUTS = Collections.emptySet(); + /** Provided output keys */ + public static final Set PROVIDED_OUTPUTS = Set.of(MODEL_ID); /** * Instantiate this class @@ -60,13 +66,10 @@ public PlainActionFuture execute( ) { PlainActionFuture deleteModelFuture = PlainActionFuture.newFuture(); - Set requiredKeys = Set.of(MODEL_ID); - Set optionalKeys = Collections.emptySet(); - try { Map inputs = ParseUtils.getInputsFromPreviousSteps( - requiredKeys, - optionalKeys, + REQUIRED_INPUTS, + OPTIONAL_INPUTS, currentNodeInputs, outputs, previousNodeInputs, diff --git a/src/main/java/org/opensearch/flowframework/workflow/UndeployModelStep.java b/src/main/java/org/opensearch/flowframework/workflow/UndeployModelStep.java index b67e0669e..185f69ca1 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/UndeployModelStep.java +++ b/src/main/java/org/opensearch/flowframework/workflow/UndeployModelStep.java @@ -49,6 +49,7 @@ public class UndeployModelStep implements WorkflowStep { public static final Set OPTIONAL_INPUTS = Collections.emptySet(); /** Provided output keys */ public static final Set PROVIDED_OUTPUTS = Set.of(SUCCESS); + /** * Instantiate this class * @param mlClient Machine Learning client to perform the undeploy @@ -68,8 +69,6 @@ public PlainActionFuture execute( ) { PlainActionFuture undeployModelFuture = PlainActionFuture.newFuture(); - - try { Map inputs = ParseUtils.getInputsFromPreviousSteps( REQUIRED_INPUTS, diff --git a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java index df058c069..fb4e54781 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java +++ b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java @@ -44,7 +44,6 @@ import static org.opensearch.flowframework.common.CommonValue.OPENSEARCH_ML; import static org.opensearch.flowframework.common.CommonValue.PIPELINE_ID; import static org.opensearch.flowframework.common.CommonValue.REGISTER_MODEL_STATUS; -import static org.opensearch.flowframework.common.CommonValue.SUCCESS; import static org.opensearch.flowframework.common.CommonValue.TYPE; import static org.opensearch.flowframework.common.CommonValue.URL; import static org.opensearch.flowframework.common.CommonValue.VERSION_FIELD; @@ -219,10 +218,16 @@ public enum WorkflowSteps { ), /** Undeploy Model Step */ - UNDEPLOY_MODEL(UndeployModelStep.NAME, UndeployModelStep.REQUIRED_INPUTS, UndeployModelStep.PROVIDED_OUTPUTS, List.of(OPENSEARCH_ML), null), + UNDEPLOY_MODEL( + UndeployModelStep.NAME, + UndeployModelStep.REQUIRED_INPUTS, + UndeployModelStep.PROVIDED_OUTPUTS, + List.of(OPENSEARCH_ML), + null + ), /** Delete Model Step */ - DELETE_MODEL(DeleteModelStep.NAME, List.of(MODEL_ID), List.of(MODEL_ID), List.of(OPENSEARCH_ML), null), + DELETE_MODEL(DeleteModelStep.NAME, DeleteModelStep.REQUIRED_INPUTS, DeleteModelStep.PROVIDED_OUTPUTS, List.of(OPENSEARCH_ML), null), /** Delete Connector Step */ DELETE_CONNECTOR(DeleteConnectorStep.NAME, List.of(CONNECTOR_ID), List.of(CONNECTOR_ID), List.of(OPENSEARCH_ML), null), diff --git a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java index 43c15376d..75b2f4386 100644 --- a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java +++ b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java @@ -11,6 +11,7 @@ import org.opensearch.flowframework.workflow.CreateConnectorStep; import org.opensearch.flowframework.workflow.CreateIndexStep; import org.opensearch.flowframework.workflow.DeleteIndexStep; +import org.opensearch.flowframework.workflow.DeleteModelStep; import org.opensearch.flowframework.workflow.DeployModelStep; import org.opensearch.flowframework.workflow.RegisterModelGroupStep; import org.opensearch.flowframework.workflow.RegisterRemoteModelStep; @@ -111,12 +112,22 @@ public void testRegisterModelGroupStepValidator() throws IOException { RegisterModelGroupStep.PROVIDED_OUTPUTS ); } + public void testUndeployModelStepValidator() throws IOException { assertStepValidatorMatches( - WorkflowStepFactory.WorkflowSteps.UNDEPLOY_MODEL, - UndeployModelStep.NAME, - UndeployModelStep.REQUIRED_INPUTS, - UndeployModelStep.PROVIDED_OUTPUTS + WorkflowStepFactory.WorkflowSteps.UNDEPLOY_MODEL, + UndeployModelStep.NAME, + UndeployModelStep.REQUIRED_INPUTS, + UndeployModelStep.PROVIDED_OUTPUTS + ); + } + + public void testDeleteModelStepValidator() throws IOException { + assertStepValidatorMatches( + WorkflowStepFactory.WorkflowSteps.DELETE_MODEL, + DeleteModelStep.NAME, + DeleteModelStep.REQUIRED_INPUTS, + DeleteModelStep.PROVIDED_OUTPUTS ); } From 3ea68010f6a29bd77c52de4e7d5c3605db21f5a1 Mon Sep 17 00:00:00 2001 From: kokibas Date: Fri, 30 Jan 2026 17:12:46 +0500 Subject: [PATCH 6/9] Refactor DeleteConnectorStep to use const Signed-off-by: kokibas --- .../flowframework/workflow/DeleteConnectorStep.java | 13 ++++++++----- .../flowframework/workflow/WorkflowStepFactory.java | 9 +++++++-- .../model/WorkflowStepValidatorTests.java | 11 +++++++++++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/opensearch/flowframework/workflow/DeleteConnectorStep.java b/src/main/java/org/opensearch/flowframework/workflow/DeleteConnectorStep.java index 2ddcb75b8..ee4221d1f 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/DeleteConnectorStep.java +++ b/src/main/java/org/opensearch/flowframework/workflow/DeleteConnectorStep.java @@ -38,6 +38,12 @@ public class DeleteConnectorStep implements WorkflowStep { /** The name of this step, used as a key in the template and the {@link WorkflowStepFactory} */ public static final String NAME = "delete_connector"; + /** Required input keys **/ + public static final Set REQUIRED_INPUTS = Set.of(CONNECTOR_ID); + /** Optional input keys */ + public static final Set OPTIONAL_INPUTS = Collections.emptySet(); + /** Provided output keys */ + public static final Set PROVIDED_OUTPUTS = Set.of(CONNECTOR_ID); /** * Instantiate this class @@ -58,13 +64,10 @@ public PlainActionFuture execute( ) { PlainActionFuture deleteConnectorFuture = PlainActionFuture.newFuture(); - Set requiredKeys = Set.of(CONNECTOR_ID); - Set optionalKeys = Collections.emptySet(); - try { Map inputs = ParseUtils.getInputsFromPreviousSteps( - requiredKeys, - optionalKeys, + REQUIRED_INPUTS, + OPTIONAL_INPUTS, currentNodeInputs, outputs, previousNodeInputs, diff --git a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java index fb4e54781..abbff6af3 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java +++ b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java @@ -48,7 +48,6 @@ import static org.opensearch.flowframework.common.CommonValue.URL; import static org.opensearch.flowframework.common.CommonValue.VERSION_FIELD; import static org.opensearch.flowframework.common.WorkflowResources.AGENT_ID; -import static org.opensearch.flowframework.common.WorkflowResources.CONNECTOR_ID; import static org.opensearch.flowframework.common.WorkflowResources.INDEX_NAME; import static org.opensearch.flowframework.common.WorkflowResources.MODEL_ID; @@ -230,7 +229,13 @@ public enum WorkflowSteps { DELETE_MODEL(DeleteModelStep.NAME, DeleteModelStep.REQUIRED_INPUTS, DeleteModelStep.PROVIDED_OUTPUTS, List.of(OPENSEARCH_ML), null), /** Delete Connector Step */ - DELETE_CONNECTOR(DeleteConnectorStep.NAME, List.of(CONNECTOR_ID), List.of(CONNECTOR_ID), List.of(OPENSEARCH_ML), null), + DELETE_CONNECTOR( + DeleteConnectorStep.NAME, + DeleteConnectorStep.REQUIRED_INPUTS, + DeleteConnectorStep.PROVIDED_OUTPUTS, + List.of(OPENSEARCH_ML), + null + ), /** Register Agent Step */ REGISTER_AGENT(RegisterAgentStep.NAME, List.of(NAME_FIELD, TYPE), List.of(AGENT_ID), List.of(OPENSEARCH_ML), null), diff --git a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java index 75b2f4386..562f898cf 100644 --- a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java +++ b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java @@ -10,6 +10,7 @@ import org.opensearch.flowframework.workflow.CreateConnectorStep; import org.opensearch.flowframework.workflow.CreateIndexStep; +import org.opensearch.flowframework.workflow.DeleteConnectorStep; import org.opensearch.flowframework.workflow.DeleteIndexStep; import org.opensearch.flowframework.workflow.DeleteModelStep; import org.opensearch.flowframework.workflow.DeployModelStep; @@ -131,4 +132,14 @@ public void testDeleteModelStepValidator() throws IOException { ); } + public void testDeleteConnectorStepValidator() throws IOException { + assertStepValidatorMatches( + WorkflowStepFactory.WorkflowSteps.DELETE_CONNECTOR, + DeleteConnectorStep.NAME, + DeleteConnectorStep.REQUIRED_INPUTS, + DeleteConnectorStep.PROVIDED_OUTPUTS + ); + + } + } From 81c25b7443adbf250004130126bf2f2f7019aa62 Mon Sep 17 00:00:00 2001 From: kokibas Date: Fri, 30 Jan 2026 17:17:52 +0500 Subject: [PATCH 7/9] Refactor RegisterAgentStep to use const Signed-off-by: kokibas --- .../workflow/RegisterAgentStep.java | 35 ++++++++++--------- .../workflow/WorkflowStepFactory.java | 9 +++-- .../model/WorkflowStepValidatorTests.java | 10 ++++++ 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/opensearch/flowframework/workflow/RegisterAgentStep.java b/src/main/java/org/opensearch/flowframework/workflow/RegisterAgentStep.java index 599b370aa..65a8560be 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/RegisterAgentStep.java +++ b/src/main/java/org/opensearch/flowframework/workflow/RegisterAgentStep.java @@ -55,6 +55,7 @@ import static org.opensearch.flowframework.common.CommonValue.TOOLS_FIELD; import static org.opensearch.flowframework.common.CommonValue.TOOLS_ORDER_FIELD; import static org.opensearch.flowframework.common.CommonValue.TYPE; +import static org.opensearch.flowframework.common.WorkflowResources.AGENT_ID; import static org.opensearch.flowframework.exception.WorkflowStepException.getSafeException; import static org.opensearch.flowframework.util.ParseUtils.getStringToStringMap; @@ -70,7 +71,22 @@ public class RegisterAgentStep implements WorkflowStep { /** The name of this step, used as a key in the template and the {@link WorkflowStepFactory} */ public static final String NAME = "register_agent"; - + /** Required input keys **/ + public static final Set REQUIRED_INPUTS = Set.of(NAME_FIELD, TYPE); + /** Optional input keys */ + public static final Set OPTIONAL_INPUTS = Set.of( + DESCRIPTION_FIELD, + LLM, + TOOLS_FIELD, + TOOLS_ORDER_FIELD, + PARAMETERS_FIELD, + MEMORY_FIELD, + CREATED_TIME, + LAST_UPDATED_TIME_FIELD, + APP_TYPE_FIELD + ); + /** Provided output keys */ + public static final Set PROVIDED_OUTPUTS = Set.of(AGENT_ID); /** The model ID for the LLM */ public static final String MODEL_ID = "model_id"; @@ -121,23 +137,10 @@ public void onFailure(Exception ex) { } }; - Set requiredKeys = Set.of(NAME_FIELD, TYPE); - Set optionalKeys = Set.of( - DESCRIPTION_FIELD, - LLM, - TOOLS_FIELD, - TOOLS_ORDER_FIELD, - PARAMETERS_FIELD, - MEMORY_FIELD, - CREATED_TIME, - LAST_UPDATED_TIME_FIELD, - APP_TYPE_FIELD - ); - try { Map inputs = ParseUtils.getInputsFromPreviousSteps( - requiredKeys, - optionalKeys, + REQUIRED_INPUTS, + OPTIONAL_INPUTS, currentNodeInputs, outputs, previousNodeInputs, diff --git a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java index abbff6af3..a987141ed 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java +++ b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java @@ -44,7 +44,6 @@ import static org.opensearch.flowframework.common.CommonValue.OPENSEARCH_ML; import static org.opensearch.flowframework.common.CommonValue.PIPELINE_ID; import static org.opensearch.flowframework.common.CommonValue.REGISTER_MODEL_STATUS; -import static org.opensearch.flowframework.common.CommonValue.TYPE; import static org.opensearch.flowframework.common.CommonValue.URL; import static org.opensearch.flowframework.common.CommonValue.VERSION_FIELD; import static org.opensearch.flowframework.common.WorkflowResources.AGENT_ID; @@ -238,7 +237,13 @@ public enum WorkflowSteps { ), /** Register Agent Step */ - REGISTER_AGENT(RegisterAgentStep.NAME, List.of(NAME_FIELD, TYPE), List.of(AGENT_ID), List.of(OPENSEARCH_ML), null), + REGISTER_AGENT( + RegisterAgentStep.NAME, + RegisterAgentStep.REQUIRED_INPUTS, + RegisterAgentStep.PROVIDED_OUTPUTS, + List.of(OPENSEARCH_ML), + null + ), /** Delete Agent Step */ DELETE_AGENT(DeleteAgentStep.NAME, List.of(AGENT_ID), List.of(AGENT_ID), List.of(OPENSEARCH_ML), null), diff --git a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java index 562f898cf..564c13695 100644 --- a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java +++ b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java @@ -14,6 +14,7 @@ import org.opensearch.flowframework.workflow.DeleteIndexStep; import org.opensearch.flowframework.workflow.DeleteModelStep; import org.opensearch.flowframework.workflow.DeployModelStep; +import org.opensearch.flowframework.workflow.RegisterAgentStep; import org.opensearch.flowframework.workflow.RegisterModelGroupStep; import org.opensearch.flowframework.workflow.RegisterRemoteModelStep; import org.opensearch.flowframework.workflow.ReindexStep; @@ -142,4 +143,13 @@ public void testDeleteConnectorStepValidator() throws IOException { } + public void testRegisterAgentStepValidator() throws IOException { + assertStepValidatorMatches( + WorkflowStepFactory.WorkflowSteps.REGISTER_AGENT, + RegisterAgentStep.NAME, + RegisterAgentStep.REQUIRED_INPUTS, + RegisterAgentStep.PROVIDED_OUTPUTS + ); + } + } From 8c9f085e21a2328ce8c0d2c8fd7db79307ea3711 Mon Sep 17 00:00:00 2001 From: kokibas Date: Fri, 30 Jan 2026 17:21:24 +0500 Subject: [PATCH 8/9] Refactor DeleteAgentStep to use const Signed-off-by: kokibas --- .../flowframework/workflow/DeleteAgentStep.java | 13 ++++++++----- .../flowframework/workflow/WorkflowStepFactory.java | 3 +-- .../model/WorkflowStepValidatorTests.java | 10 ++++++++++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/opensearch/flowframework/workflow/DeleteAgentStep.java b/src/main/java/org/opensearch/flowframework/workflow/DeleteAgentStep.java index 2d54d6498..caaf4efb2 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/DeleteAgentStep.java +++ b/src/main/java/org/opensearch/flowframework/workflow/DeleteAgentStep.java @@ -40,6 +40,12 @@ public class DeleteAgentStep implements WorkflowStep { /** The name of this step, used as a key in the template and the {@link WorkflowStepFactory} */ public static final String NAME = "delete_agent"; + /** Required input keys */ + public static final Set REQUIRED_INPUTS = Set.of(AGENT_ID); + /** Optional input keys */ + public static final Set OPTIONAL_INPUTS = Collections.emptySet(); + /** Provided output keys */ + public static final Set PROVIDED_OUTPUTS = Set.of(AGENT_ID); /** * Instantiate this class @@ -60,13 +66,10 @@ public PlainActionFuture execute( ) { PlainActionFuture deleteAgentFuture = PlainActionFuture.newFuture(); - Set requiredKeys = Set.of(AGENT_ID); - Set optionalKeys = Collections.emptySet(); - try { Map inputs = ParseUtils.getInputsFromPreviousSteps( - requiredKeys, - optionalKeys, + REQUIRED_INPUTS, + OPTIONAL_INPUTS, currentNodeInputs, outputs, previousNodeInputs, diff --git a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java index a987141ed..a4e47122d 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java +++ b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java @@ -46,7 +46,6 @@ import static org.opensearch.flowframework.common.CommonValue.REGISTER_MODEL_STATUS; import static org.opensearch.flowframework.common.CommonValue.URL; import static org.opensearch.flowframework.common.CommonValue.VERSION_FIELD; -import static org.opensearch.flowframework.common.WorkflowResources.AGENT_ID; import static org.opensearch.flowframework.common.WorkflowResources.INDEX_NAME; import static org.opensearch.flowframework.common.WorkflowResources.MODEL_ID; @@ -246,7 +245,7 @@ public enum WorkflowSteps { ), /** Delete Agent Step */ - DELETE_AGENT(DeleteAgentStep.NAME, List.of(AGENT_ID), List.of(AGENT_ID), List.of(OPENSEARCH_ML), null), + DELETE_AGENT(DeleteAgentStep.NAME, DeleteAgentStep.REQUIRED_INPUTS, DeleteAgentStep.PROVIDED_OUTPUTS, List.of(OPENSEARCH_ML), null), /** Create Tool Step */ CREATE_TOOL(ToolStep.NAME, ToolStep.REQUIRED_INPUTS, ToolStep.PROVIDED_OUTPUTS, List.of(OPENSEARCH_ML), null), diff --git a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java index 564c13695..dfc2878d7 100644 --- a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java +++ b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java @@ -10,6 +10,7 @@ import org.opensearch.flowframework.workflow.CreateConnectorStep; import org.opensearch.flowframework.workflow.CreateIndexStep; +import org.opensearch.flowframework.workflow.DeleteAgentStep; import org.opensearch.flowframework.workflow.DeleteConnectorStep; import org.opensearch.flowframework.workflow.DeleteIndexStep; import org.opensearch.flowframework.workflow.DeleteModelStep; @@ -152,4 +153,13 @@ public void testRegisterAgentStepValidator() throws IOException { ); } + public void testDeleteAgentStepValidator() throws IOException { + assertStepValidatorMatches( + WorkflowStepFactory.WorkflowSteps.DELETE_AGENT, + DeleteAgentStep.NAME, + DeleteAgentStep.REQUIRED_INPUTS, + DeleteAgentStep.PROVIDED_OUTPUTS + ); + } + } From 049b04cfe4f427a005c997ff7756018813022010 Mon Sep 17 00:00:00 2001 From: kokibas Date: Fri, 30 Jan 2026 17:27:58 +0500 Subject: [PATCH 9/9] Refactor UpdateIndexStep to use const Signed-off-by: kokibas --- .../flowframework/workflow/UpdateIndexStep.java | 13 ++++++++----- .../flowframework/workflow/WorkflowStepFactory.java | 9 +++++++-- .../model/WorkflowStepValidatorTests.java | 10 ++++++++++ 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/opensearch/flowframework/workflow/UpdateIndexStep.java b/src/main/java/org/opensearch/flowframework/workflow/UpdateIndexStep.java index b527f4c1d..8f21bf359 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/UpdateIndexStep.java +++ b/src/main/java/org/opensearch/flowframework/workflow/UpdateIndexStep.java @@ -48,6 +48,12 @@ public class UpdateIndexStep implements WorkflowStep { /** The name of this step */ public static final String NAME = "update_index"; + /** Required input keys */ + public static final Set REQUIRED_INPUTS = Set.of(INDEX_NAME, CONFIGURATIONS); + /** Optional input keys */ + public static final Set OPTIONAL_INPUTS = Collections.emptySet(); + /** Provided output keys */ + public static final Set PROVIDED_OUTPUTS = Set.of(INDEX_NAME); /** * Instantiate this class @@ -69,14 +75,11 @@ public PlainActionFuture execute( ) { PlainActionFuture updateIndexFuture = PlainActionFuture.newFuture(); - Set requiredKeys = Set.of(INDEX_NAME, CONFIGURATIONS); - Set optionalKeys = Collections.emptySet(); - try { Map inputs = ParseUtils.getInputsFromPreviousSteps( - requiredKeys, - optionalKeys, + REQUIRED_INPUTS, + OPTIONAL_INPUTS, currentNodeInputs, outputs, previousNodeInputs, diff --git a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java index a4e47122d..fce015d73 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java +++ b/src/main/java/org/opensearch/flowframework/workflow/WorkflowStepFactory.java @@ -46,7 +46,6 @@ import static org.opensearch.flowframework.common.CommonValue.REGISTER_MODEL_STATUS; import static org.opensearch.flowframework.common.CommonValue.URL; import static org.opensearch.flowframework.common.CommonValue.VERSION_FIELD; -import static org.opensearch.flowframework.common.WorkflowResources.INDEX_NAME; import static org.opensearch.flowframework.common.WorkflowResources.MODEL_ID; /** @@ -296,7 +295,13 @@ public enum WorkflowSteps { ), /** Update Index Step */ - UPDATE_INDEX(UpdateIndexStep.NAME, List.of(INDEX_NAME, CONFIGURATIONS), List.of(INDEX_NAME), Collections.emptyList(), null), + UPDATE_INDEX( + UpdateIndexStep.NAME, + UpdateIndexStep.REQUIRED_INPUTS, + UpdateIndexStep.PROVIDED_OUTPUTS, + Collections.emptyList(), + null + ), /** Delete Search Pipeline Step */ DELETE_SEARCH_PIPELINE( diff --git a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java index dfc2878d7..22cc87a9b 100644 --- a/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java +++ b/src/test/java/org/opensearch/flowframework/model/WorkflowStepValidatorTests.java @@ -20,6 +20,7 @@ import org.opensearch.flowframework.workflow.RegisterRemoteModelStep; import org.opensearch.flowframework.workflow.ReindexStep; import org.opensearch.flowframework.workflow.UndeployModelStep; +import org.opensearch.flowframework.workflow.UpdateIndexStep; import org.opensearch.flowframework.workflow.WorkflowStepFactory; import org.opensearch.test.OpenSearchTestCase; @@ -162,4 +163,13 @@ public void testDeleteAgentStepValidator() throws IOException { ); } + public void testUpdateIndexStepValidator() throws IOException { + assertStepValidatorMatches( + WorkflowStepFactory.WorkflowSteps.UPDATE_INDEX, + UpdateIndexStep.NAME, + UpdateIndexStep.REQUIRED_INPUTS, + UpdateIndexStep.PROVIDED_OUTPUTS + ); + } + }