Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix parameter name in preprocess function; fix remote model function … #1362

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class MLPreProcessFunction {
" }\n" +
" }\n" +
" builder.append(\"]\");\n" +
" def parameters = \"{\" +\"\\\"prompt\\\":\" + builder + \"}\";\n" +
" def parameters = \"{\" +\"\\\"texts\\\":\" + builder + \"}\";\n" +
" return \"{\" +\"\\\"parameters\\\":\" + parameters + \"}\";");

PRE_PROCESS_FUNCTIONS.put(TEXT_DOCS_TO_OPENAI_EMBEDDING_INPUT, "\n StringBuilder builder = new StringBuilder();\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ public void dispatchTask(
ActionListener<MLTaskResponse> listener
) {
String modelId = request.getModelId();
MLInput input = request.getMlInput();
FunctionName algorithm = input.getAlgorithm();
try {
ActionListener<DiscoveryNode> actionListener = ActionListener.wrap(node -> {
if (clusterService.localNode().getId().equals(node.getId())) {
Expand All @@ -133,9 +131,9 @@ public void dispatchTask(
transportService.sendRequest(node, getTransportActionName(), request, getResponseHandler(listener));
}
}, e -> { listener.onFailure(e); });
String[] workerNodes = mlModelManager.getWorkerNodes(modelId, algorithm, true);
String[] workerNodes = mlModelManager.getWorkerNodes(modelId, functionName, true);
if (workerNodes == null || workerNodes.length == 0) {
if (algorithm == FunctionName.TEXT_EMBEDDING || algorithm == FunctionName.REMOTE) {
if (functionName == FunctionName.TEXT_EMBEDDING || functionName == FunctionName.REMOTE) {
listener
.onFailure(
new IllegalArgumentException(
Expand All @@ -144,7 +142,7 @@ public void dispatchTask(
);
return;
} else {
workerNodes = nodeHelper.getEligibleNodeIds(algorithm);
workerNodes = nodeHelper.getEligibleNodeIds(functionName);
}
}
mlTaskDispatcher.dispatchPredictTask(workerNodes, actionListener);
Expand Down
Loading