From a48dba5d86db5c56a8665e4c0e49f254d9cd8e19 Mon Sep 17 00:00:00 2001 From: Dhrubo Saha Date: Thu, 17 Aug 2023 17:24:14 -0700 Subject: [PATCH] updating integration tests Signed-off-by: Dhrubo Saha --- .../ml/common/connector/HttpConnectorTest.java | 2 +- .../opensearch/ml/rest/RestMLRemoteInferenceIT.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/src/test/java/org/opensearch/ml/common/connector/HttpConnectorTest.java b/common/src/test/java/org/opensearch/ml/common/connector/HttpConnectorTest.java index 1b0bc281e2..d42cf7562e 100644 --- a/common/src/test/java/org/opensearch/ml/common/connector/HttpConnectorTest.java +++ b/common/src/test/java/org/opensearch/ml/common/connector/HttpConnectorTest.java @@ -202,7 +202,7 @@ public void testIsJsonCompatibleWithInvalidCases() { Assert.assertFalse(connector.isNotPlainString("{\"key\": \"value\"")); Assert.assertFalse(connector.isNotPlainString("not_an_integer")); } - + @Test public void testApplyCustomSubstitution() { HttpConnector connector = createHttpConnector(); diff --git a/plugin/src/test/java/org/opensearch/ml/rest/RestMLRemoteInferenceIT.java b/plugin/src/test/java/org/opensearch/ml/rest/RestMLRemoteInferenceIT.java index 346d210ebc..f19ddcaffb 100644 --- a/plugin/src/test/java/org/opensearch/ml/rest/RestMLRemoteInferenceIT.java +++ b/plugin/src/test/java/org/opensearch/ml/rest/RestMLRemoteInferenceIT.java @@ -53,7 +53,7 @@ public class RestMLRemoteInferenceIT extends MLCommonsRestTestCase { + " \"headers\": {\n" + " \"Authorization\": \"Bearer ${credential.openAI_key}\"\n" + " },\n" - + " \"request_body\": \"{ \\\"model\\\": \\\"${parameters.model}\\\", \\\"prompt\\\": \\\"${parameters.prompt}\\\", \\\"max_tokens\\\": ${parameters.max_tokens}, \\\"temperature\\\": ${parameters.temperature} }\"\n" + + " \"request_body\": \"{ \\\"model\\\": ${parameters.model}, \\\"prompt\\\": ${parameters.prompt}, \\\"max_tokens\\\": ${parameters.max_tokens}, \\\"temperature\\\": ${parameters.temperature} }\"\n" + " }\n" + " ]\n" + "}"; @@ -221,7 +221,7 @@ public void testOpenAIChatCompletionModel() throws IOException, InterruptedExcep + " \"headers\": { \n" + " \"Authorization\": \"Bearer ${credential.openAI_key}\"\n" + " },\n" - + " \"request_body\": \"{ \\\"model\\\": \\\"${parameters.model}\\\", \\\"messages\\\": ${parameters.messages} }\"\n" + + " \"request_body\": \"{ \\\"model\\\": ${parameters.model}, \\\"messages\\\": ${parameters.messages} }\"\n" + " }\n" + " ]\n" + "}"; @@ -279,7 +279,7 @@ public void testOpenAIEditsModel() throws IOException, InterruptedException { + " \"headers\": { \n" + " \"Authorization\": \"Bearer ${credential.openAI_key}\"\n" + " },\n" - + " \"request_body\": \"{ \\\"model\\\": \\\"${parameters.model}\\\", \\\"input\\\": \\\"${parameters.input}\\\", \\\"instruction\\\": \\\"${parameters.instruction}\\\" }\"\n" + + " \"request_body\": \"{ \\\"model\\\": ${parameters.model}, \\\"input\\\": ${parameters.input}, \\\"instruction\\\": ${parameters.instruction} }\"\n" + " }\n" + " ]\n" + "}"; @@ -348,7 +348,7 @@ public void testOpenAIModerationsModel() throws IOException, InterruptedExceptio + " \"headers\": { \n" + " \"Authorization\": \"Bearer ${credential.openAI_key}\"\n" + " },\n" - + " \"request_body\": \"{ \\\"input\\\": \\\"${parameters.input}\\\" }\"\n" + + " \"request_body\": \"{ \\\"input\\\": ${parameters.input} }\"\n" + " }\n" + " ]\n" + "}"; @@ -415,7 +415,7 @@ public void testOpenAITextEmbeddingModel() throws IOException, InterruptedExcept + " \"headers\": { \n" + " \"Authorization\": \"Bearer ${credential.openAI_key}\"\n" + " },\n" - + " \"request_body\": \"{ \\\"model\\\": \\\"${parameters.model}\\\", \\\"input\\\": \\\"${parameters.input}\\\" }\",\n" + + " \"request_body\": \"{ \\\"model\\\": ${parameters.model}, \\\"input\\\": ${parameters.input} }\",\n" + " \"pre_process_function\": \"text_docs_to_openai_embedding_input\",\n" + " \"post_process_function\": \"openai_embedding\"\n" + " }\n" @@ -477,7 +477,7 @@ public void testCohereGenerateTextModel() throws IOException, InterruptedExcepti + " \"headers\": { \n" + " \"Authorization\": \"Bearer ${credential.cohere_key}\"\n" + " },\n" - + " \"request_body\": \"{ \\\"max_tokens\\\": ${parameters.max_tokens}, \\\"return_likelihoods\\\": \\\"NONE\\\", \\\"truncate\\\": \\\"END\\\", \\\"prompt\\\": \\\"${parameters.prompt}\\\" }\"\n" + + " \"request_body\": \"{ \\\"max_tokens\\\": ${parameters.max_tokens}, \\\"return_likelihoods\\\": \\\"NONE\\\", \\\"truncate\\\": \\\"END\\\", \\\"prompt\\\": ${parameters.prompt} }\"\n" + " }\n" + " ]\n" + "}";