Skip to content

Commit

Permalink
change method name back
Browse files Browse the repository at this point in the history
Signed-off-by: zane-neo <[email protected]>
  • Loading branch information
zane-neo committed Jan 26, 2024
1 parent e1fe572 commit 38cb4ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public class MLPostProcessFunction {
JSON_PATH_EXPRESSION.put(COHERE_EMBEDDING, "$.embeddings");
JSON_PATH_EXPRESSION.put(DEFAULT_EMBEDDING, "$[*]");
JSON_PATH_EXPRESSION.put(BEDROCK_EMBEDDING, "$.embedding");
POST_PROCESS_FUNCTIONS.put(OPENAI_EMBEDDING, buildModelTensorResult());
POST_PROCESS_FUNCTIONS.put(COHERE_EMBEDDING, buildModelTensorResult());
POST_PROCESS_FUNCTIONS.put(DEFAULT_EMBEDDING, buildModelTensorResult());
POST_PROCESS_FUNCTIONS.put(BEDROCK_EMBEDDING, buildModelTensorResult());
POST_PROCESS_FUNCTIONS.put(OPENAI_EMBEDDING, buildModelTensorList());
POST_PROCESS_FUNCTIONS.put(COHERE_EMBEDDING, buildModelTensorList());
POST_PROCESS_FUNCTIONS.put(DEFAULT_EMBEDDING, buildModelTensorList());
POST_PROCESS_FUNCTIONS.put(BEDROCK_EMBEDDING, buildModelTensorList());
}

public static Function<List<?>, List<ModelTensor>> buildModelTensorResult() {
public static Function<List<?>, List<ModelTensor>> buildModelTensorList() {
return embeddings -> {
List<ModelTensor> modelTensors = new ArrayList<>();
if (embeddings == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ public void test_getResponseFilter() {

@Test
public void test_buildMultipleResultModelTensorList() {
Assert.assertNotNull(MLPostProcessFunction.buildModelTensorResult());
Assert.assertNotNull(MLPostProcessFunction.buildModelTensorList());
List<List<Float>> numbersList = new ArrayList<>();
numbersList.add(Collections.singletonList(1.0f));
Assert.assertNotNull(MLPostProcessFunction.buildModelTensorResult().apply(numbersList));
Assert.assertNotNull(MLPostProcessFunction.buildModelTensorList().apply(numbersList));
}

@Test
public void test_buildMultipleResultModelTensorList_exception() {
exceptionRule.expect(IllegalArgumentException.class);
MLPostProcessFunction.buildModelTensorResult().apply(null);
MLPostProcessFunction.buildModelTensorList().apply(null);
}

@Test
Expand Down

0 comments on commit 38cb4ac

Please sign in to comment.