diff --git a/.gitignore b/.gitignore index 4269de1628..b8afe43816 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,7 @@ ml-algorithms/build/ plugin/build/ plugin/src/test/resources/bwc/* .DS_Store +*/bin/ +.classpath +.project +.settings diff --git a/spi/src/main/java/org/opensearch/ml/common/spi/MLCommonsExtension.java b/spi/src/main/java/org/opensearch/ml/common/spi/MLCommonsExtension.java index ff85f0cf52..f017004bd5 100644 --- a/spi/src/main/java/org/opensearch/ml/common/spi/MLCommonsExtension.java +++ b/spi/src/main/java/org/opensearch/ml/common/spi/MLCommonsExtension.java @@ -1,3 +1,8 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + package org.opensearch.ml.common.spi; import org.opensearch.ml.common.spi.tools.Tool; @@ -11,13 +16,13 @@ public interface MLCommonsExtension { /** * Get tools. - * @return + * @return A list of provided tools */ List getTools(); /** * Get tool factories. - * @return + * @return A list of tool factories */ - List getToolFactories(); -} + List> getToolFactories(); +} \ No newline at end of file diff --git a/spi/src/main/java/org/opensearch/ml/common/spi/tools/Parser.java b/spi/src/main/java/org/opensearch/ml/common/spi/tools/Parser.java index ec1f799de4..c621cf7467 100644 --- a/spi/src/main/java/org/opensearch/ml/common/spi/tools/Parser.java +++ b/spi/src/main/java/org/opensearch/ml/common/spi/tools/Parser.java @@ -1,16 +1,21 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + package org.opensearch.ml.common.spi.tools; /** * General parser interface. - * @param - * @param + * @param The input type + * @param The return type */ public interface Parser { /** * Parse input. * @param input - * @return + * @return output */ T parse(S input); } diff --git a/spi/src/main/java/org/opensearch/ml/common/spi/tools/Tool.java b/spi/src/main/java/org/opensearch/ml/common/spi/tools/Tool.java index 3898666a51..354749f395 100644 --- a/spi/src/main/java/org/opensearch/ml/common/spi/tools/Tool.java +++ b/spi/src/main/java/org/opensearch/ml/common/spi/tools/Tool.java @@ -16,10 +16,12 @@ public interface Tool { /** * Run tool and return response. * @param parameters input parameters - * @return - * @param + * @return the tool's output + * @param The output type */ - default T run(Map parameters) {return null;}; + default T run(Map parameters) { + return null; + }; default void run(Map parameters, ActionListener listener) {}; @@ -27,13 +29,13 @@ public interface Tool { * Set input parser. * @param parser */ - default void setInputParser(Parser parser){}; + default void setInputParser(Parser parser) {}; /** * Set output parser. * @param parser */ - default void setOutputParser(Parser parser){}; + default void setOutputParser(Parser parser) {}; /** * Get tool name. @@ -78,13 +80,15 @@ public interface Tool { * the tool may end the whole CoT process by returning true. * @param input * @param toolParameters - * @return + * @return true as a signal to CoT to end the chain, false to continue CoT */ - default boolean end(String input, Map toolParameters){return false;} + default boolean end(String input, Map toolParameters) { + return false; + } /** * Tool factory which can create instance of {@link Tool}. - * @param + * @param The subclass this factory produces */ interface Factory { T create(Map params); diff --git a/spi/src/main/java/org/opensearch/ml/common/spi/tools/ToolAnnotation.java b/spi/src/main/java/org/opensearch/ml/common/spi/tools/ToolAnnotation.java index bfedd185c5..f9e8ea8fe9 100644 --- a/spi/src/main/java/org/opensearch/ml/common/spi/tools/ToolAnnotation.java +++ b/spi/src/main/java/org/opensearch/ml/common/spi/tools/ToolAnnotation.java @@ -1,3 +1,8 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + package org.opensearch.ml.common.spi.tools; import java.lang.annotation.ElementType;