Skip to content

Commit

Permalink
Fixed compilation errors after recent changes in ml-commons (opensear…
Browse files Browse the repository at this point in the history
…ch-project#285)

* Fixed compilation errors after recent changes in ml-commons

Signed-off-by: Martin Gaievski <[email protected]>
  • Loading branch information
martin-gaievski authored Sep 7, 2023
1 parent 2208c05 commit 5bf36ed
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import static org.opensearch.neuralsearch.common.VectorUtil.vectorAsListToArray;

import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
Expand Down Expand Up @@ -50,6 +49,7 @@
import org.opensearch.knn.index.SpaceType;
import org.opensearch.neuralsearch.OpenSearchSecureRestTestCase;

import com.carrotsearch.randomizedtesting.RandomizedTest;
import com.google.common.collect.ImmutableList;

public abstract class BaseNeuralSearchIT extends OpenSearchSecureRestTestCase {
Expand Down Expand Up @@ -137,7 +137,7 @@ protected void loadModel(String modelId) throws Exception {
Response uploadResponse = makeRequest(
client(),
"POST",
String.format(LOCALE, "/_plugins/_ml/models/%s/_load", modelId),
String.format(LOCALE, "/_plugins/_ml/models/%s/_deploy", modelId),
null,
toHttpEntity(""),
ImmutableList.of(new BasicHeader(HttpHeaders.USER_AGENT, DEFAULT_USER_AGENT))
Expand Down Expand Up @@ -685,10 +685,10 @@ protected String getDeployedModelId() {
}

@SneakyThrows
private String registerModelGroup() throws IOException, URISyntaxException {
private String registerModelGroup() {
String modelGroupRegisterRequestBody = Files.readString(
Path.of(classLoader.getResource("processor/CreateModelGroupRequestBody.json").toURI())
);
).replace("<MODEL_GROUP_NAME>", "public_model_" + RandomizedTest.randomAsciiAlphanumOfLength(8));
Response modelGroupResponse = makeRequest(
client(),
"POST",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;

import org.junit.Before;
import org.mockito.InjectMocks;
Expand Down Expand Up @@ -168,7 +169,9 @@ private ModelTensorOutput createModelTensorOutput(final Float[] output) {
output,
new long[] { 1, 2 },
MLResultDataType.FLOAT64,
ByteBuffer.wrap(new byte[12])
ByteBuffer.wrap(new byte[12]),
"someValue",
Map.of()
);
mlModelTensorList.add(tensor);
final ModelTensors modelTensors = new ModelTensors(mlModelTensorList);
Expand Down
5 changes: 2 additions & 3 deletions src/test/resources/processor/CreateModelGroupRequestBody.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"name": "test_model_group_public",
"description": "This is a public model group",
"access_mode": "public"
"name": "<MODEL_GROUP_NAME>",
"description": "This is a public model group"
}

0 comments on commit 5bf36ed

Please sign in to comment.