Skip to content

Commit

Permalink
remove chat connector and do not include payload in the exception mes…
Browse files Browse the repository at this point in the history
…sage

Signed-off-by: Xun Zhang <[email protected]>
  • Loading branch information
Zhangxunmt committed Jun 29, 2023
1 parent 56bc7a8 commit 6a43a0a
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 544 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

import org.opensearch.ml.common.connector.template.DetachedConnector;

import static org.opensearch.ml.common.connector.template.APISchema.HEADERS_FIELD;
import static org.opensearch.ml.common.connector.template.APISchema.METHOD_FIELD;
import static org.opensearch.ml.common.connector.template.APISchema.REQUEST_BODY_FIELD;
import static org.opensearch.ml.common.connector.template.APISchema.URL_FIELD;
import static org.opensearch.ml.common.model.MLModelConfig.ALL_CONFIG_FIELD;
import static org.opensearch.ml.common.model.MLModelConfig.MODEL_TYPE_FIELD;
import static org.opensearch.ml.common.model.TextEmbeddingModelConfig.EMBEDDING_DIMENSION_FIELD;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ public class ConnectorNames {

public static final String HTTP_V1 = "http/v1";
public static final String AWS_V1 = "aws/v1";
public static final String CHAT_V1 = "chat/v1";
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public <T> T createPredictPayload(Map<String, String> parameters) {
payload = substitutor.replace(payload);

if (!isJson(payload)) {
throw new IllegalArgumentException("Invalid JSON: " + payload);
throw new IllegalArgumentException("Invalid JSON in payload");
}
return (T) payload;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ public <T> T createPredictPayload(Map<String, String> parameters) {
payload = substitutor.replace(payload);

if (!isJson(payload)) {
throw new IllegalArgumentException("Invalid JSON: " + payload);
throw new IllegalArgumentException("Invalid JSON in payload!");
}
return (T) payload;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,12 @@ public ModelTensorOutput executePredict(MLInput mlInput) {
ModelTensors tensors = processOutput(modelResponse, connector, scriptService, parameters, modelTensors);
tensorOutputs.add(tensors);
return new ModelTensorOutput(tensorOutputs);
} catch (IllegalArgumentException exception) {
log.error("Failed to execute predict in aws connector: " + exception.getMessage(), exception);
throw new MLException("Fail to execute predict in aws connector", exception);
} catch (Throwable e) {
log.error("Failed to execute aws connector", e);
throw new MLException("Fail to execute aws connector", e);
log.error("Failed to execute predict in aws connector", e);
throw new MLException("Fail to execute predict in aws connector", e);
}
}

Expand Down
Loading

0 comments on commit 6a43a0a

Please sign in to comment.