diff --git a/ml-algorithms/src/test/java/org/opensearch/ml/engine/tools/ConnectorToolTests.java b/ml-algorithms/src/test/java/org/opensearch/ml/engine/tools/ConnectorToolTests.java index f7177d529a..5bc507869e 100644 --- a/ml-algorithms/src/test/java/org/opensearch/ml/engine/tools/ConnectorToolTests.java +++ b/ml-algorithms/src/test/java/org/opensearch/ml/engine/tools/ConnectorToolTests.java @@ -69,8 +69,8 @@ public void testConnectorTool_NullConnectorId() { }).when(client).execute(eq(MLExecuteConnectorAction.INSTANCE), any(), any()); Exception exception = assertThrows( - IllegalArgumentException.class, - () -> ConnectorTool.Factory.getInstance().create(Map.of("connector_action", "execute")) + IllegalArgumentException.class, + () -> ConnectorTool.Factory.getInstance().create(Map.of("connector_action", "execute")) ); MatcherAssert.assertThat(exception.getMessage(), containsString("connector_id can't be null")); } diff --git a/plugin/src/main/java/org/opensearch/ml/action/connector/ExecuteConnectorTransportAction.java b/plugin/src/main/java/org/opensearch/ml/action/connector/ExecuteConnectorTransportAction.java index 9841a8fe12..5ecd4c0123 100644 --- a/plugin/src/main/java/org/opensearch/ml/action/connector/ExecuteConnectorTransportAction.java +++ b/plugin/src/main/java/org/opensearch/ml/action/connector/ExecuteConnectorTransportAction.java @@ -45,14 +45,14 @@ public class ExecuteConnectorTransportAction extends HandledTransportAction encryptor.decrypt(credential)); RemoteConnectorExecutor connectorExecutor = MLEngineClassLoader - .initInstance(connector.getProtocol(), connector, Connector.class); + .initInstance(connector.getProtocol(), connector, Connector.class); connectorExecutor.setScriptService(scriptService); connectorExecutor.setClusterService(clusterService); connectorExecutor.setClient(client); connectorExecutor.setXContentRegistry(xContentRegistry); connectorExecutor - .executeAction(connectorAction, executeConnectorRequest.getMlInput(), ActionListener.wrap(taskResponse -> { - actionListener.onResponse(taskResponse); - }, e -> { actionListener.onFailure(e); })); + .executeAction(connectorAction, executeConnectorRequest.getMlInput(), ActionListener.wrap(taskResponse -> { + actionListener.onResponse(taskResponse); + }, e -> { actionListener.onFailure(e); })); } }, e -> { log.error("Failed to get connector " + connectorId, e); @@ -96,4 +96,4 @@ protected void doExecute(Task task, ActionRequest request, ActionListener executeAgent(agentId, agentInput)); @@ -101,23 +101,23 @@ public void testConnectorToolInFlowAgent_WrongAction() throws IOException, Parse public void testConnectorToolInFlowAgent() throws IOException, ParseException { String registerAgentRequestBody = "{\n" - + " \"name\": \"Test agent with connector tool\",\n" - + " \"type\": \"flow\",\n" - + " \"description\": \"This is a demo agent for connector tool\",\n" - + " \"app_type\": \"test1\",\n" - + " \"tools\": [\n" - + " {\n" - + " \"type\": \"ConnectorTool\",\n" - + " \"name\": \"bedrock_model\",\n" - + " \"parameters\": {\n" - + " \"connector_id\": \"" - + bedrockClaudeConnectorId - + "\",\n" - + " \"connector_action\": \"execute\"\n" - + " }\n" - + " }\n" - + " ]\n" - + "}"; + + " \"name\": \"Test agent with connector tool\",\n" + + " \"type\": \"flow\",\n" + + " \"description\": \"This is a demo agent for connector tool\",\n" + + " \"app_type\": \"test1\",\n" + + " \"tools\": [\n" + + " {\n" + + " \"type\": \"ConnectorTool\",\n" + + " \"name\": \"bedrock_model\",\n" + + " \"parameters\": {\n" + + " \"connector_id\": \"" + + bedrockClaudeConnectorId + + "\",\n" + + " \"connector_action\": \"execute\"\n" + + " }\n" + + " }\n" + + " ]\n" + + "}"; String agentId = createAgent(registerAgentRequestBody); String agentInput = "{\n" + " \"parameters\": {\n" + " \"question\": \"hello\"\n" + " }\n" + "}"; String result = executeAgent(agentId, agentInput);