Skip to content

Commit

Permalink
add rank search result step
Browse files Browse the repository at this point in the history
Signed-off-by: Jackie Han <[email protected]>
  • Loading branch information
jackiehanyang committed Feb 1, 2024
1 parent 693b71d commit 09b23b7
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import org.opensearch.ml.client.MachineLearningNodeClient;
import org.opensearch.plugins.ActionPlugin;
import org.opensearch.plugins.Plugin;
import org.opensearch.plugins.SearchPipelinePlugin;
import org.opensearch.repositories.RepositoriesService;
import org.opensearch.rest.RestController;
import org.opensearch.rest.RestHandler;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.opensearch.flowframework.workflow;

import org.opensearch.action.support.PlainActionFuture;

import java.util.Map;

public class RankSearchResultStep implements WorkflowStep {

public RankSearchResultStep() {}

public static final String NAME = "rank_search_result";
/**
* Triggers the actual processing of the building block.
*
* @param currentNodeId The id of the node executing this step
* @param currentNodeInputs Input params and content for this node, from workflow parsing
* @param outputs WorkflowData content of previous steps.
* @param previousNodeInputs Input params for this node that come from previous steps
* @return A CompletableFuture of the building block. This block should return immediately, but not be completed until the step executes, containing either the step's output data or {@link WorkflowData#EMPTY} which may be passed to follow-on steps.
*/
@Override
public PlainActionFuture<WorkflowData> execute(String currentNodeId,
WorkflowData currentNodeInputs,
Map<String, WorkflowData> outputs,
Map<String, String> previousNodeInputs) {
PlainActionFuture<WorkflowData> future = PlainActionFuture.newFuture();
future.onResponse(WorkflowData.EMPTY);
return future;
}

/**
* Gets the name of the workflow step.
*
* @return the name of this workflow step.
*/
@Override
public String getName() {
return NAME;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public WorkflowStepFactory(
stepMap.put(ToolStep.NAME, ToolStep::new);
stepMap.put(RegisterAgentStep.NAME, () -> new RegisterAgentStep(mlClient, flowFrameworkIndicesHandler));
stepMap.put(DeleteAgentStep.NAME, () -> new DeleteAgentStep(mlClient));
stepMap.put(RankSearchResultStep.NAME, RankSearchResultStep::new);
}

/**
Expand Down

0 comments on commit 09b23b7

Please sign in to comment.