@@ -89,7 +89,7 @@ public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client
89
89
Optional <FunctionName > functionName = modelManager .getOptionalModelFunctionName (modelId );
90
90
91
91
if (userAlgorithm != null ) {
92
- MLPredictionTaskRequest mlPredictionTaskRequest = getRequest (modelId , "" , userAlgorithm , request );
92
+ MLPredictionTaskRequest mlPredictionTaskRequest = getRequest (modelId , null , userAlgorithm , request );
93
93
return channel -> client
94
94
.execute (MLPredictionTaskAction .INSTANCE , mlPredictionTaskRequest , new RestToXContentListener <>(channel ));
95
95
}
@@ -149,9 +149,9 @@ public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client
149
149
MLPredictionTaskRequest getRequest (String modelId , String modelType , String userAlgorithm , RestRequest request ) throws IOException {
150
150
String tenantId = getTenantID (mlFeatureEnabledSetting .isMultiTenancyEnabled (), request );
151
151
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 ()) {
153
153
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 )))
155
155
&& !mlFeatureEnabledSetting .isLocalModelEnabled ()) {
156
156
throw new IllegalStateException (LOCAL_MODEL_DISABLED_ERR_MSG );
157
157
} else if (ActionType .BATCH_PREDICT == actionType && !mlFeatureEnabledSetting .isOfflineBatchInferenceEnabled ()) {
0 commit comments