Skip to content

Commit

Permalink
fix spotless and compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhangxunmt committed Nov 17, 2023
1 parent 60e483e commit 1e5da99
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Collections;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;

Expand Down Expand Up @@ -410,40 +410,70 @@ public void testSearchInteractions() {
final String conversation2 = "conversation2";
CountDownLatch cdl = new CountDownLatch(1);
StepListener<String> iid1 = new StepListener<>();
index.createInteraction(conversation1, "input about fish", "pt", "response about fish", "origin1", Collections.singletonMap("metadata", "some meta"), iid1);
index
.createInteraction(
conversation1,
"input about fish",
"pt",
"response about fish",
"origin1",
Collections.singletonMap("metadata", "some meta"),
iid1
);

StepListener<String> iid2 = new StepListener<>();
iid1
.whenComplete(
r -> { index.createInteraction(conversation1, "input about squash", "pt", "response about squash", "origin1", Collections.singletonMap("metadata", "some meta"), iid2); },
e -> {
cdl.countDown();
log.error(e);
assert (false);
}
);
iid1.whenComplete(r -> {
index
.createInteraction(
conversation1,
"input about squash",
"pt",
"response about squash",
"origin1",
Collections.singletonMap("metadata", "some meta"),
iid2
);
}, e -> {
cdl.countDown();
log.error(e);
assert (false);
});

StepListener<String> iid3 = new StepListener<>();
iid2
.whenComplete(
r -> { index.createInteraction(conversation2, "input about fish", "pt2", "response about fish", "origin1", Collections.singletonMap("metadata", "some meta"), iid3); },
e -> {
cdl.countDown();
log.error(e);
assert (false);
}
);
iid2.whenComplete(r -> {
index
.createInteraction(
conversation2,
"input about fish",
"pt2",
"response about fish",
"origin1",
Collections.singletonMap("metadata", "some meta"),
iid3
);
}, e -> {
cdl.countDown();
log.error(e);
assert (false);
});

StepListener<String> iid4 = new StepListener<>();
iid3
.whenComplete(
r -> { index.createInteraction(conversation1, "input about france", "pt", "response about france", "origin1", Collections.singletonMap("metadata", "some meta"), iid4); },
e -> {
cdl.countDown();
log.error(e);
assert (false);
}
);
iid3.whenComplete(r -> {
index
.createInteraction(
conversation1,
"input about france",
"pt",
"response about france",
"origin1",
Collections.singletonMap("metadata", "some meta"),
iid4
);
}, e -> {
cdl.countDown();
log.error(e);
assert (false);
});

StepListener<SearchResponse> searchListener = new StepListener<>();
iid4.whenComplete(r -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@
import org.opensearch.ml.memory.action.conversation.GetConversationsTransportAction;
import org.opensearch.ml.memory.action.conversation.GetInteractionsAction;
import org.opensearch.ml.memory.action.conversation.GetInteractionsTransportAction;
import org.opensearch.ml.memory.index.ConversationMetaIndex;
import org.opensearch.ml.memory.action.conversation.SearchConversationsAction;
import org.opensearch.ml.memory.action.conversation.SearchConversationsTransportAction;
import org.opensearch.ml.memory.action.conversation.SearchInteractionsAction;
import org.opensearch.ml.memory.action.conversation.SearchInteractionsTransportAction;
import org.opensearch.ml.memory.index.ConversationMetaIndex;
import org.opensearch.ml.memory.index.OpenSearchConversationalMemoryHandler;
import org.opensearch.ml.model.MLModelCacheHelper;
import org.opensearch.ml.model.MLModelManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.opensearch.ml.common.conversation.ConversationalIndexConstants;
import org.opensearch.ml.memory.action.conversation.SearchConversationsAction;

import com.google.common.collect.ImmutableList;
import org.opensearch.ml.repackage.com.google.common.collect.ImmutableList;

public class RestMemorySearchConversationsAction extends AbstractMLSearchAction<ConversationMeta> {
private static final String SEARCH_CONVERSATIONS_NAME = "conversation_memory_search_conversations";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import org.opensearch.rest.action.RestResponseListener;
import org.opensearch.search.builder.SearchSourceBuilder;

import com.google.common.collect.ImmutableList;
import org.opensearch.ml.repackage.com.google.common.collect.ImmutableList;

public class RestMemorySearchInteractionsAction extends BaseRestHandler {
private static final String SEARCH_INTERACTIONS_NAME = "conversation_memory_search_interactions";
Expand Down

0 comments on commit 1e5da99

Please sign in to comment.