Skip to content

Commit 3196df5

Browse files
Remove unused methods
Signed-off-by: Nathalie Jonathan <[email protected]>
1 parent 8c5f3b4 commit 3196df5

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/tool/MLToolExecutor.java

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import org.opensearch.common.settings.Settings;
1515
import org.opensearch.core.action.ActionListener;
1616
import org.opensearch.core.xcontent.NamedXContentRegistry;
17-
import org.opensearch.ingest.ConfigurationUtils;
1817
import org.opensearch.ml.common.FunctionName;
1918
import org.opensearch.ml.common.dataset.remote.RemoteInferenceInputDataSet;
2019
import org.opensearch.ml.common.input.Input;
@@ -131,50 +130,4 @@ private void processOutput(Object output, List<ModelTensor> modelTensors) {
131130
modelTensors.add(ModelTensor.builder().name("response").result(result).build());
132131
}
133132
}
134-
135-
private void validateParameterTypes(String toolName, Map<String, String> parameters, Tool.Factory toolFactory) {
136-
try {
137-
for (Map.Entry<String, String> entry : parameters.entrySet()) {
138-
String paramName = entry.getKey();
139-
String paramValue = entry.getValue();
140-
141-
if (!isValidParameterValue(paramName, paramValue)) {
142-
throw new IllegalArgumentException(
143-
"Invalid parameter value for '" + paramName + "' in tool '" + toolName + "': " + paramValue
144-
);
145-
}
146-
}
147-
} catch (Exception e) {
148-
log.error("Could not validate parameter types for tool: " + toolName, e);
149-
if (e instanceof IllegalArgumentException) {
150-
throw e;
151-
}
152-
}
153-
}
154-
155-
private boolean isValidParameterValue(String paramName, String paramValue) {
156-
if (paramValue == null || paramValue.trim().isEmpty()) {
157-
return false;
158-
}
159-
160-
try {
161-
Map<String, Object> testConfig = new HashMap<>();
162-
testConfig.put(paramName, paramValue);
163-
164-
if (paramValue.matches("^-?\\d+$")) {
165-
ConfigurationUtils.readIntProperty("tool", "test", testConfig, paramName, 0);
166-
} else if ("true".equalsIgnoreCase(paramValue) || "false".equalsIgnoreCase(paramValue)) {
167-
ConfigurationUtils.readBooleanProperty("tool", "test", testConfig, paramName, false);
168-
} else if (paramValue.matches("^-?\\d*\\.\\d+$")) {
169-
ConfigurationUtils.readDoubleProperty("tool", "test", testConfig, paramName);
170-
} else if (paramValue.startsWith("[") && paramValue.endsWith("]")) {
171-
ConfigurationUtils.readOptionalList("tool", "test", testConfig, paramName);
172-
} else if (paramValue.startsWith("{") && paramValue.endsWith("}")) {
173-
ConfigurationUtils.readOptionalMap("tool", "test", testConfig, paramName);
174-
}
175-
return true;
176-
} catch (Exception e) {
177-
return false;
178-
}
179-
}
180133
}

0 commit comments

Comments
 (0)