Skip to content

Commit

Permalink
apply spotless
Browse files Browse the repository at this point in the history
Signed-off-by: xinyual <[email protected]>
  • Loading branch information
xinyual committed Nov 11, 2024
1 parent 9691e96 commit 0c100fe
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 112 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package org.opensearch.ml.engine.tools;

import org.opensearch.action.search.SearchRequest;
import org.opensearch.index.query.BoolQueryBuilder;
import org.opensearch.index.query.QueryBuilder;
import org.opensearch.index.query.QueryBuilders;
import org.opensearch.ml.common.spi.tools.Tool;
import org.opensearch.search.builder.SearchSourceBuilder;
import static org.opensearch.ml.common.CommonValue.ML_AGENT_INDEX;
import static org.opensearch.ml.common.CommonValue.TOOL_MODEL_RELATED_FIELD_PREFIX;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -14,11 +10,14 @@
import java.util.Map;
import java.util.Set;

import static org.opensearch.ml.common.CommonValue.ML_AGENT_INDEX;
import static org.opensearch.ml.common.CommonValue.TOOL_MODEL_RELATED_FIELD_PREFIX;
import org.opensearch.action.search.SearchRequest;
import org.opensearch.index.query.BoolQueryBuilder;
import org.opensearch.index.query.QueryBuilders;
import org.opensearch.ml.common.spi.tools.Tool;
import org.opensearch.search.builder.SearchSourceBuilder;

public class RelatedModelIdHelper {
private Map<String, List<String> > relatedModelIdMap;
private Map<String, List<String>> relatedModelIdMap;

public RelatedModelIdHelper(Map<String, Tool.Factory> ToolFactories) {
relatedModelIdMap = new HashMap<>();
Expand All @@ -29,7 +28,7 @@ public RelatedModelIdHelper(Map<String, Tool.Factory> ToolFactories) {
}
}

public SearchRequest constructQueryRequest(String candidateModelId){
public SearchRequest constructQueryRequest(String candidateModelId) {
SearchRequest searchRequest = new SearchRequest(ML_AGENT_INDEX);
List<String> allKeyFields = collectAllKeys();
BoolQueryBuilder shouldQuery = QueryBuilders.boolQuery();
Expand All @@ -40,7 +39,7 @@ public SearchRequest constructQueryRequest(String candidateModelId){
return searchRequest;
}

private List<String> collectAllKeys(){
private List<String> collectAllKeys() {
Set<String> keys = new HashSet<>();
for (Map.Entry<String, List<String>> entry : relatedModelIdMap.entrySet()) {
keys.addAll(entry.getValue());
Expand Down
Loading

0 comments on commit 0c100fe

Please sign in to comment.