Skip to content

Commit

Permalink
static DLModels
Browse files Browse the repository at this point in the history
Signed-off-by: HenryL27 <[email protected]>
  • Loading branch information
HenryL27 committed Dec 5, 2023
1 parent 6d7b429 commit 97e10b1
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions common/src/main/java/org/opensearch/ml/common/FunctionName.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,18 @@ public static FunctionName from(String value) {
}
}

private static final HashSet<FunctionName> DL_MODELS = new HashSet<>(Set.of(
TEXT_EMBEDDING,
TEXT_SIMILARITY,
SPARSE_ENCODING,
SPARSE_TOKENIZE
));

/**
* Check if model is deep learning model.
* @return true for deep learning model.
*/
public static boolean isDLModel(FunctionName functionName) {
Set<FunctionName> dlmodels = new HashSet<>(Set.of(
TEXT_EMBEDDING,
TEXT_SIMILARITY,
SPARSE_ENCODING,
SPARSE_TOKENIZE
));
return dlmodels.contains(functionName);
return DL_MODELS.contains(functionName);
}
}

0 comments on commit 97e10b1

Please sign in to comment.