Skip to content

Commit 6e8b850

Browse files
committed
fix UTs
Signed-off-by: Jing Zhang <[email protected]>
1 parent 4b9afec commit 6e8b850

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

plugin/src/main/java/org/opensearch/ml/rest/RestMLPredictionAction.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client
8989
Optional<FunctionName> functionName = modelManager.getOptionalModelFunctionName(modelId);
9090

9191
if (userAlgorithm != null) {
92-
MLPredictionTaskRequest mlPredictionTaskRequest = getRequest(modelId, "", userAlgorithm, request);
92+
MLPredictionTaskRequest mlPredictionTaskRequest = getRequest(modelId, null, userAlgorithm, request);
9393
return channel -> client
9494
.execute(MLPredictionTaskAction.INSTANCE, mlPredictionTaskRequest, new RestToXContentListener<>(channel));
9595
}
@@ -149,9 +149,9 @@ public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client
149149
MLPredictionTaskRequest getRequest(String modelId, String modelType, String userAlgorithm, RestRequest request) throws IOException {
150150
String tenantId = getTenantID(mlFeatureEnabledSetting.isMultiTenancyEnabled(), request);
151151
ActionType actionType = ActionType.from(getActionTypeFromRestRequest(request));
152-
if (FunctionName.REMOTE.name().equals(modelType) && !mlFeatureEnabledSetting.isRemoteInferenceEnabled()) {
152+
if (modelType != null && FunctionName.REMOTE.name().equals(modelType) && !mlFeatureEnabledSetting.isRemoteInferenceEnabled()) {
153153
throw new IllegalStateException(REMOTE_INFERENCE_DISABLED_ERR_MSG);
154-
} else if (FunctionName.isDLModel(FunctionName.from(modelType.toUpperCase(Locale.ROOT)))
154+
} else if (modelType != null && FunctionName.isDLModel(FunctionName.from(modelType.toUpperCase(Locale.ROOT)))
155155
&& !mlFeatureEnabledSetting.isLocalModelEnabled()) {
156156
throw new IllegalStateException(LOCAL_MODEL_DISABLED_ERR_MSG);
157157
} else if (ActionType.BATCH_PREDICT == actionType && !mlFeatureEnabledSetting.isOfflineBatchInferenceEnabled()) {

0 commit comments

Comments
 (0)