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

Base class for Integ test; add integ test for NeuralSparseSearchTool #86

Merged
merged 12 commits into from
Jan 2, 2024
Prev Previous commit
Next Next commit
change neural sparse model to pretrained tokenizer
Signed-off-by: zhichao-aws <[email protected]>
zhichao-aws committed Dec 29, 2023
commit 4593afec7becf43ea7587b89feda01de70a83a04
Original file line number Diff line number Diff line change
@@ -114,7 +114,7 @@ protected Response waitTaskComplete(String taskId) {
if (state.equals(MLTaskState.FAILED.toString())
|| state.equals(MLTaskState.CANCELLED.toString())
|| state.equals(MLTaskState.COMPLETED_WITH_ERROR.toString())) {
break;
fail("The task failed with state " + state);
}
Thread.sleep(DEFAULT_TASK_RESULT_QUERY_INTERVAL_IN_MILLISECOND);
}
Original file line number Diff line number Diff line change
@@ -96,8 +96,8 @@ public void testNeuralSparseSearchToolInFlowAgent() {
String result = executeAgent(agentId, "{\"parameters\": {\"question\": \"a\"}}");
assertEquals(
"The agent execute response not equal with expected.",
"{\"_index\":\"test_index\",\"_source\":{\"text\":\"text doc 3\"},\"_id\":\"2\",\"_score\":6.0}\n"
+ "{\"_index\":\"test_index\",\"_source\":{\"text\":\"text doc 2\"},\"_id\":\"1\",\"_score\":3.0}\n",
"{\"_index\":\"test_index\",\"_source\":{\"text\":\"text doc 3\"},\"_id\":\"2\",\"_score\":2.4136734}\n"
+ "{\"_index\":\"test_index\",\"_source\":{\"text\":\"text doc 2\"},\"_id\":\"1\",\"_score\":1.2068367}\n",
result
);

@@ -120,8 +120,8 @@ public void testNeuralSparseSearchToolInFlowAgent_withIllegalSourceField_thenGet
String result = executeAgent(agentId, "{\"parameters\": {\"question\": \"a\"}}");
assertEquals(
"The agent execute response not equal with expected.",
"{\"_index\":\"test_index\",\"_source\":{},\"_id\":\"2\",\"_score\":6.0}\n"
+ "{\"_index\":\"test_index\",\"_source\":{},\"_id\":\"1\",\"_score\":3.0}\n",
"{\"_index\":\"test_index\",\"_source\":{},\"_id\":\"2\",\"_score\":2.4136734}\n"
+ "{\"_index\":\"test_index\",\"_source\":{},\"_id\":\"1\",\"_score\":1.2068367}\n",
result
);
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"name": "tokenize-idf-0915",
"version": "1.0.0",
"function_name": "SPARSE_TOKENIZE",
"description": "test model",
"model_format": "TORCH_SCRIPT",
"model_content_hash_value": "b345e9e943b62c405a8dd227ef2c46c84c5ff0a0b71b584be9132b37bce91a9a",
"url": "https://github.com/opensearch-project/ml-commons/raw/main/ml-algorithms/src/test/resources/org/opensearch/ml/engine/algorithms/sparse_encoding/sparse_demo.zip"
"name":"amazon/neural-sparse/opensearch-neural-sparse-tokenizer-v1",
"version":"1.0.1",
"model_format": "TORCH_SCRIPT"
}