From f0b4d55e16c6293aab571a1c29a3554d20f36971 Mon Sep 17 00:00:00 2001 From: HenryL27 Date: Tue, 29 Aug 2023 17:25:43 -0700 Subject: [PATCH] propagate name change to variables and parameters Signed-off-by: HenryL27 --- .../common/conversation/ActionConstants.java | 2 +- .../ConversationalIndexConstants.java | 8 ++--- .../ml/common/conversation/Interaction.java | 36 +++++++++---------- .../memory/ConversationalMemoryHandler.java | 8 ++--- .../CreateInteractionRequest.java | 10 +++--- .../CreateInteractionTransportAction.java | 4 +-- .../ml/memory/index/InteractionsIndex.java | 6 ++-- ...OpenSearchConversationalMemoryHandler.java | 18 +++++----- .../CreateInteractionRequestTests.java | 4 +-- .../GetInteractionsResponseTests.java | 4 +-- ...earchConversationalMemoryHandlerTests.java | 4 +-- .../RestMemoryCreateInteractionActionIT.java | 2 +- ...estMemoryCreateInteractionActionTests.java | 4 +-- .../RestMemoryDeleteConversationActionIT.java | 2 +- .../RestMemoryGetInteractionsActionIT.java | 6 ++-- 15 files changed, 59 insertions(+), 59 deletions(-) diff --git a/common/src/main/java/org/opensearch/ml/common/conversation/ActionConstants.java b/common/src/main/java/org/opensearch/ml/common/conversation/ActionConstants.java index 60c9b470c8..5bb8334bc1 100644 --- a/common/src/main/java/org/opensearch/ml/common/conversation/ActionConstants.java +++ b/common/src/main/java/org/opensearch/ml/common/conversation/ActionConstants.java @@ -47,7 +47,7 @@ public class ActionConstants { /** name of prompt template field in all requests */ public final static String PROMPT_TEMPLATE_FIELD = "prompt_template"; /** name of metadata field in all requests */ - public final static String METADATA_FIELD = "additional_info"; + public final static String ADDITIONAL_INFO_FIELD = "additional_info"; /** name of success field in all requests */ public final static String SUCCESS_FIELD = "success"; diff --git a/common/src/main/java/org/opensearch/ml/common/conversation/ConversationalIndexConstants.java b/common/src/main/java/org/opensearch/ml/common/conversation/ConversationalIndexConstants.java index b58c1b6c60..142d768292 100644 --- a/common/src/main/java/org/opensearch/ml/common/conversation/ConversationalIndexConstants.java +++ b/common/src/main/java/org/opensearch/ml/common/conversation/ConversationalIndexConstants.java @@ -64,9 +64,9 @@ public class ConversationalIndexConstants { /** Name of the interaction field for the response's origin */ public final static String INTERACTIONS_ORIGIN_FIELD = "origin"; /** Name of the interaction field for additional metadata */ - public final static String INTERACTIONS_METADATA_FIELD = "additional_info"; + public final static String INTERACTIONS_ADDITIONAL_INFO_FIELD = "additional_info"; /** Name of the interaction field for the timestamp */ - public final static String INTERACTIONS_TIMESTAMP_FIELD = "create_time"; + public final static String INTERACTIONS_CREATE_TIME_FIELD = "create_time"; /** Mappings for the interactions index */ public final static String INTERACTIONS_MAPPINGS = "{\n" + " \"_meta\": {\n" @@ -77,7 +77,7 @@ public class ConversationalIndexConstants { + INTERACTIONS_CONVERSATION_ID_FIELD + "\": {\"type\": \"keyword\"},\n" + " \"" - + INTERACTIONS_TIMESTAMP_FIELD + + INTERACTIONS_CREATE_TIME_FIELD + "\": {\"type\": \"date\", \"format\": \"strict_date_time||epoch_millis\"},\n" + " \"" + INTERACTIONS_INPUT_FIELD @@ -92,7 +92,7 @@ public class ConversationalIndexConstants { + INTERACTIONS_ORIGIN_FIELD + "\": {\"type\": \"keyword\"},\n" + " \"" - + INTERACTIONS_METADATA_FIELD + + INTERACTIONS_ADDITIONAL_INFO_FIELD + "\": {\"type\": \"text\"}\n" + " }\n" + "}"; diff --git a/common/src/main/java/org/opensearch/ml/common/conversation/Interaction.java b/common/src/main/java/org/opensearch/ml/common/conversation/Interaction.java index 799ccc6d4d..9b6ec636bd 100644 --- a/common/src/main/java/org/opensearch/ml/common/conversation/Interaction.java +++ b/common/src/main/java/org/opensearch/ml/common/conversation/Interaction.java @@ -42,7 +42,7 @@ public class Interaction implements Writeable, ToXContentObject { @Getter private String id; @Getter - private Instant timestamp; + private Instant createTime; @Getter private String conversationId; @Getter @@ -54,7 +54,7 @@ public class Interaction implements Writeable, ToXContentObject { @Getter private String origin; @Getter - private String metadata; + private String additionalInfo; /** * Creates an Interaction object from a map of fields in the OS index @@ -63,14 +63,14 @@ public class Interaction implements Writeable, ToXContentObject { * @return a new Interaction object representing the OS document */ public static Interaction fromMap(String id, Map fields) { - Instant timestamp = Instant.parse((String) fields.get(ConversationalIndexConstants.INTERACTIONS_TIMESTAMP_FIELD)); + Instant createTime = Instant.parse((String) fields.get(ConversationalIndexConstants.INTERACTIONS_CREATE_TIME_FIELD)); String conversationId = (String) fields.get(ConversationalIndexConstants.INTERACTIONS_CONVERSATION_ID_FIELD); String input = (String) fields.get(ConversationalIndexConstants.INTERACTIONS_INPUT_FIELD); String promptTemplate = (String) fields.get(ConversationalIndexConstants.INTERACTIONS_PROMPT_TEMPLATE_FIELD); String response = (String) fields.get(ConversationalIndexConstants.INTERACTIONS_RESPONSE_FIELD); String origin = (String) fields.get(ConversationalIndexConstants.INTERACTIONS_ORIGIN_FIELD); - String metadata = (String) fields.get(ConversationalIndexConstants.INTERACTIONS_METADATA_FIELD); - return new Interaction(id, timestamp, conversationId, input, promptTemplate, response, origin, metadata); + String additionalInfo = (String) fields.get(ConversationalIndexConstants.INTERACTIONS_ADDITIONAL_INFO_FIELD); + return new Interaction(id, createTime, conversationId, input, promptTemplate, response, origin, additionalInfo); } /** @@ -91,27 +91,27 @@ public static Interaction fromSearchHit(SearchHit hit) { */ public static Interaction fromStream(StreamInput in) throws IOException { String id = in.readString(); - Instant timestamp = in.readInstant(); + Instant createTime = in.readInstant(); String conversationId = in.readString(); String input = in.readString(); String promptTemplate = in.readString(); String response = in.readString(); String origin = in.readString(); - String metadata = in.readOptionalString(); - return new Interaction(id, timestamp, conversationId, input, promptTemplate, response, origin, metadata); + String additionalInfo = in.readOptionalString(); + return new Interaction(id, createTime, conversationId, input, promptTemplate, response, origin, additionalInfo); } @Override public void writeTo(StreamOutput out) throws IOException { out.writeString(id); - out.writeInstant(timestamp); + out.writeInstant(createTime); out.writeString(conversationId); out.writeString(input); out.writeString(promptTemplate); out.writeString(response); out.writeString(origin); - out.writeOptionalString(metadata); + out.writeOptionalString(additionalInfo); } @Override @@ -119,13 +119,13 @@ public XContentBuilder toXContent(XContentBuilder builder, ToXContentObject.Para builder.startObject(); builder.field(ActionConstants.CONVERSATION_ID_FIELD, conversationId); builder.field(ActionConstants.RESPONSE_INTERACTION_ID_FIELD, id); - builder.field(ConversationalIndexConstants.INTERACTIONS_TIMESTAMP_FIELD, timestamp); + builder.field(ConversationalIndexConstants.INTERACTIONS_CREATE_TIME_FIELD, createTime); builder.field(ConversationalIndexConstants.INTERACTIONS_INPUT_FIELD, input); builder.field(ConversationalIndexConstants.INTERACTIONS_PROMPT_TEMPLATE_FIELD, promptTemplate); builder.field(ConversationalIndexConstants.INTERACTIONS_RESPONSE_FIELD, response); builder.field(ConversationalIndexConstants.INTERACTIONS_ORIGIN_FIELD, origin); - if(metadata != null) { - builder.field(ConversationalIndexConstants.INTERACTIONS_METADATA_FIELD, metadata); + if(additionalInfo != null) { + builder.field(ConversationalIndexConstants.INTERACTIONS_ADDITIONAL_INFO_FIELD, additionalInfo); } builder.endObject(); return builder; @@ -137,13 +137,13 @@ public boolean equals(Object other) { other instanceof Interaction && ((Interaction) other).id.equals(this.id) && ((Interaction) other).conversationId.equals(this.conversationId) && - ((Interaction) other).timestamp.equals(this.timestamp) && + ((Interaction) other).createTime.equals(this.createTime) && ((Interaction) other).input.equals(this.input) && ((Interaction) other).promptTemplate.equals(this.promptTemplate) && ((Interaction) other).response.equals(this.response) && ((Interaction) other).origin.equals(this.origin) && - ( (((Interaction) other).metadata == null && this.metadata == null) || - ((Interaction) other).metadata.equals(this.metadata)) + ( (((Interaction) other).additionalInfo == null && this.additionalInfo == null) || + ((Interaction) other).additionalInfo.equals(this.additionalInfo)) ); } @@ -152,12 +152,12 @@ public String toString() { return "Interaction{" + "id=" + id + ",cid=" + conversationId - + ",timestamp=" + timestamp + + ",create_time=" + createTime + ",origin=" + origin + ",input=" + input + ",promt_template=" + promptTemplate + ",response=" + response - + ",metadata=" + metadata + + ",additional_info=" + additionalInfo + "}"; } diff --git a/conversational-memory/src/main/java/org/opensearch/ml/memory/ConversationalMemoryHandler.java b/conversational-memory/src/main/java/org/opensearch/ml/memory/ConversationalMemoryHandler.java index a2938273b4..5b5e68933a 100644 --- a/conversational-memory/src/main/java/org/opensearch/ml/memory/ConversationalMemoryHandler.java +++ b/conversational-memory/src/main/java/org/opensearch/ml/memory/ConversationalMemoryHandler.java @@ -63,7 +63,7 @@ public interface ConversationalMemoryHandler { * @param promptTemplate the prompt template used for this interaction * @param response the Gen AI response for this interaction * @param origin the name of the GenAI agent in this interaction - * @param metadata additional inofrmation used in constructing the LLM prompt + * @param additionalInfo additional inofrmation used in constructing the LLM prompt * @param listener gets the ID of the new interaction */ public void createInteraction( @@ -72,7 +72,7 @@ public void createInteraction( String promptTemplate, String response, String origin, - String metadata, + String additionalInfo, ActionListener listener ); @@ -83,7 +83,7 @@ public void createInteraction( * @param promptTemplate the prompt template used in this interaction * @param response the Gen AI response for this interaction * @param origin the name of the GenAI agent in this interaction - * @param metadata arbitrary JSON string of extra stuff + * @param additionalInfo additional inofrmation used in constructing the LLM prompt * @return ActionFuture for the interactionId of the new interaction */ public ActionFuture createInteraction( @@ -91,7 +91,7 @@ public ActionFuture createInteraction( String input, String promptTemplate, String response, - String origin, + String additionalInfo, String metadata ); diff --git a/conversational-memory/src/main/java/org/opensearch/ml/memory/action/conversation/CreateInteractionRequest.java b/conversational-memory/src/main/java/org/opensearch/ml/memory/action/conversation/CreateInteractionRequest.java index 5a49cd54f7..52344b3792 100644 --- a/conversational-memory/src/main/java/org/opensearch/ml/memory/action/conversation/CreateInteractionRequest.java +++ b/conversational-memory/src/main/java/org/opensearch/ml/memory/action/conversation/CreateInteractionRequest.java @@ -48,7 +48,7 @@ public class CreateInteractionRequest extends ActionRequest { @Getter private String origin; @Getter - private String metadata; + private String additionalInfo; /** * Constructor @@ -62,7 +62,7 @@ public CreateInteractionRequest(StreamInput in) throws IOException { this.promptTemplate = in.readString(); this.response = in.readString(); this.origin = in.readOptionalString(); - this.metadata = in.readOptionalString(); + this.additionalInfo = in.readOptionalString(); } @Override @@ -73,7 +73,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeString(promptTemplate); out.writeString(response); out.writeOptionalString(origin); - out.writeOptionalString(metadata); + out.writeOptionalString(additionalInfo); } @Override @@ -98,8 +98,8 @@ public static CreateInteractionRequest fromRestRequest(RestRequest request) thro String prmpt = body.get(ActionConstants.PROMPT_TEMPLATE_FIELD); String rsp = body.get(ActionConstants.AI_RESPONSE_FIELD); String ogn = body.get(ActionConstants.RESPONSE_ORIGIN_FIELD); - String metadata = body.get(ActionConstants.METADATA_FIELD); - return new CreateInteractionRequest(cid, inp, prmpt, rsp, ogn, metadata); + String addinf = body.get(ActionConstants.ADDITIONAL_INFO_FIELD); + return new CreateInteractionRequest(cid, inp, prmpt, rsp, ogn, addinf); } } diff --git a/conversational-memory/src/main/java/org/opensearch/ml/memory/action/conversation/CreateInteractionTransportAction.java b/conversational-memory/src/main/java/org/opensearch/ml/memory/action/conversation/CreateInteractionTransportAction.java index 5943719e66..2fdd994294 100644 --- a/conversational-memory/src/main/java/org/opensearch/ml/memory/action/conversation/CreateInteractionTransportAction.java +++ b/conversational-memory/src/main/java/org/opensearch/ml/memory/action/conversation/CreateInteractionTransportAction.java @@ -65,14 +65,14 @@ protected void doExecute(Task task, CreateInteractionRequest request, ActionList String rsp = request.getResponse(); String ogn = request.getOrigin(); String prompt = request.getPromptTemplate(); - String metadata = request.getMetadata(); + String additionalInfo = request.getAdditionalInfo(); try (ThreadContext.StoredContext context = client.threadPool().getThreadContext().newStoredContext(true)) { ActionListener internalListener = ActionListener.runBefore(actionListener, () -> context.restore()); ActionListener al = ActionListener .wrap(iid -> { internalListener.onResponse(new CreateInteractionResponse(iid)); }, e -> { internalListener.onFailure(e); }); - cmHandler.createInteraction(cid, inp, prompt, rsp, ogn, metadata, al); + cmHandler.createInteraction(cid, inp, prompt, rsp, ogn, additionalInfo, al); } catch (Exception e) { log.error(e.toString()); actionListener.onFailure(e); diff --git a/conversational-memory/src/main/java/org/opensearch/ml/memory/index/InteractionsIndex.java b/conversational-memory/src/main/java/org/opensearch/ml/memory/index/InteractionsIndex.java index 0680639e71..bb71777d27 100644 --- a/conversational-memory/src/main/java/org/opensearch/ml/memory/index/InteractionsIndex.java +++ b/conversational-memory/src/main/java/org/opensearch/ml/memory/index/InteractionsIndex.java @@ -146,9 +146,9 @@ public void createInteraction( promptTemplate, ConversationalIndexConstants.INTERACTIONS_RESPONSE_FIELD, response, - ConversationalIndexConstants.INTERACTIONS_METADATA_FIELD, + ConversationalIndexConstants.INTERACTIONS_ADDITIONAL_INFO_FIELD, metadata, - ConversationalIndexConstants.INTERACTIONS_TIMESTAMP_FIELD, + ConversationalIndexConstants.INTERACTIONS_CREATE_TIME_FIELD, timestamp ); try (ThreadContext.StoredContext threadContext = client.threadPool().getThreadContext().newStoredContext(true)) { @@ -236,7 +236,7 @@ void innerGetInteractions(String conversationId, int from, int maxResults, Actio TermQueryBuilder builder = new TermQueryBuilder(ConversationalIndexConstants.INTERACTIONS_CONVERSATION_ID_FIELD, conversationId); request.source().query(builder); request.source().from(from).size(maxResults); - request.source().sort(ConversationalIndexConstants.INTERACTIONS_TIMESTAMP_FIELD, SortOrder.DESC); + request.source().sort(ConversationalIndexConstants.INTERACTIONS_CREATE_TIME_FIELD, SortOrder.DESC); try (ThreadContext.StoredContext threadContext = client.threadPool().getThreadContext().stashContext()) { ActionListener> internalListener = ActionListener.runBefore(listener, () -> threadContext.restore()); ActionListener al = ActionListener.wrap(response -> { diff --git a/conversational-memory/src/main/java/org/opensearch/ml/memory/index/OpenSearchConversationalMemoryHandler.java b/conversational-memory/src/main/java/org/opensearch/ml/memory/index/OpenSearchConversationalMemoryHandler.java index 427f9376e1..9d03b4e62c 100644 --- a/conversational-memory/src/main/java/org/opensearch/ml/memory/index/OpenSearchConversationalMemoryHandler.java +++ b/conversational-memory/src/main/java/org/opensearch/ml/memory/index/OpenSearchConversationalMemoryHandler.java @@ -102,7 +102,7 @@ public ActionFuture createConversation(String name) { * @param promptTemplate the prompt template used for this interaction * @param response the Gen AI response for this interaction * @param origin the name of the GenAI agent in this interaction - * @param metadata additional inofrmation used in constructing the LLM prompt + * @param additionalInfo additional inofrmation used in constructing the LLM prompt * @param listener gets the ID of the new interaction */ public void createInteraction( @@ -111,11 +111,11 @@ public void createInteraction( String promptTemplate, String response, String origin, - String metadata, + String additionalInfo, ActionListener listener ) { Instant time = Instant.now(); - interactionsIndex.createInteraction(conversationId, input, promptTemplate, response, origin, metadata, time, listener); + interactionsIndex.createInteraction(conversationId, input, promptTemplate, response, origin, additionalInfo, time, listener); } /** @@ -125,7 +125,7 @@ public void createInteraction( * @param promptTemplate the prompt template used in this interaction * @param response the Gen AI response for this interaction * @param origin the name of the GenAI agent in this interaction - * @param metadata arbitrary JSON string of extra stuff + * @param additionalInfo additional inofrmation used in constructing the LLM prompt * @return ActionFuture for the interactionId of the new interaction */ public ActionFuture createInteraction( @@ -134,10 +134,10 @@ public ActionFuture createInteraction( String promptTemplate, String response, String origin, - String metadata + String additionalInfo ) { PlainActionFuture fut = PlainActionFuture.newFuture(); - createInteraction(conversationId, input, promptTemplate, response, origin, metadata, fut); + createInteraction(conversationId, input, promptTemplate, response, origin, additionalInfo, fut); return fut; } @@ -147,7 +147,7 @@ public ActionFuture createInteraction( * @param listener gets the interactionId of the newly created interaction */ public void createInteraction(InteractionBuilder builder, ActionListener listener) { - builder.timestamp(Instant.now()); + builder.createTime(Instant.now()); Interaction interaction = builder.build(); interactionsIndex .createInteraction( @@ -156,8 +156,8 @@ public void createInteraction(InteractionBuilder builder, ActionListener interaction.getPromptTemplate(), interaction.getResponse(), interaction.getOrigin(), - interaction.getMetadata(), - interaction.getTimestamp(), + interaction.getAdditionalInfo(), + interaction.getCreateTime(), listener ); } diff --git a/conversational-memory/src/test/java/org/opensearch/ml/memory/action/conversation/CreateInteractionRequestTests.java b/conversational-memory/src/test/java/org/opensearch/ml/memory/action/conversation/CreateInteractionRequestTests.java index d731b3ed6e..cf027aef79 100644 --- a/conversational-memory/src/test/java/org/opensearch/ml/memory/action/conversation/CreateInteractionRequestTests.java +++ b/conversational-memory/src/test/java/org/opensearch/ml/memory/action/conversation/CreateInteractionRequestTests.java @@ -84,7 +84,7 @@ public void testFromRestRequest() throws IOException { "response", ActionConstants.RESPONSE_ORIGIN_FIELD, "origin", - ActionConstants.METADATA_FIELD, + ActionConstants.ADDITIONAL_INFO_FIELD, "metadata" ); RestRequest rrequest = new FakeRestRequest.Builder(NamedXContentRegistry.EMPTY) @@ -98,6 +98,6 @@ public void testFromRestRequest() throws IOException { assert (request.getPromptTemplate().equals("pt")); assert (request.getResponse().equals("response")); assert (request.getOrigin().equals("origin")); - assert (request.getMetadata().equals("metadata")); + assert (request.getAdditionalInfo().equals("metadata")); } } diff --git a/conversational-memory/src/test/java/org/opensearch/ml/memory/action/conversation/GetInteractionsResponseTests.java b/conversational-memory/src/test/java/org/opensearch/ml/memory/action/conversation/GetInteractionsResponseTests.java index 38779a85c6..bbd17b2603 100644 --- a/conversational-memory/src/test/java/org/opensearch/ml/memory/action/conversation/GetInteractionsResponseTests.java +++ b/conversational-memory/src/test/java/org/opensearch/ml/memory/action/conversation/GetInteractionsResponseTests.java @@ -73,7 +73,7 @@ public void testToXContent_MoreTokens() throws IOException { response.toXContent(builder, ToXContent.EMPTY_PARAMS); String result = BytesReference.bytes(builder).utf8ToString(); String expected = "{\"interactions\":[{\"conversation_id\":\"cid\",\"interaction_id\":\"id0\",\"create_time\":\"" - + interaction.getTimestamp() + + interaction.getCreateTime() + "\",\"input\":\"input\",\"prompt_template\":\"pt\",\"response\":\"response\",\"origin\":\"origin\",\"additional_info\":\"metadata\"}],\"next_token\":2}"; log.info(result); log.info(expected); @@ -90,7 +90,7 @@ public void testToXContent_NoMoreTokens() throws IOException { response.toXContent(builder, ToXContent.EMPTY_PARAMS); String result = BytesReference.bytes(builder).utf8ToString(); String expected = "{\"interactions\":[{\"conversation_id\":\"cid\",\"interaction_id\":\"id0\",\"create_time\":\"" - + interaction.getTimestamp() + + interaction.getCreateTime() + "\",\"input\":\"input\",\"prompt_template\":\"pt\",\"response\":\"response\",\"origin\":\"origin\",\"additional_info\":\"metadata\"}]}"; log.info(result); log.info(expected); diff --git a/conversational-memory/src/test/java/org/opensearch/ml/memory/index/OpenSearchConversationalMemoryHandlerTests.java b/conversational-memory/src/test/java/org/opensearch/ml/memory/index/OpenSearchConversationalMemoryHandlerTests.java index 0e05b16e85..e39513d2d8 100644 --- a/conversational-memory/src/test/java/org/opensearch/ml/memory/index/OpenSearchConversationalMemoryHandlerTests.java +++ b/conversational-memory/src/test/java/org/opensearch/ml/memory/index/OpenSearchConversationalMemoryHandlerTests.java @@ -101,7 +101,7 @@ public void testCreateInteraction_FromBuilder_Success() { .origin("origin") .response("rsp") .promptTemplate("pt") - .metadata("meta"); + .additionalInfo("meta"); @SuppressWarnings("unchecked") ActionListener createInteractionListener = mock(ActionListener.class); cmHandler.createInteraction(builder, createInteractionListener); @@ -125,7 +125,7 @@ public void testCreateInteraction_FromBuilder_Future() { .input("inp") .response("rsp") .promptTemplate("pt") - .metadata("meta"); + .additionalInfo("meta"); ActionFuture result = cmHandler.createInteraction(builder); assert (result.actionGet(200).equals("iid")); } diff --git a/plugin/src/test/java/org/opensearch/ml/rest/RestMemoryCreateInteractionActionIT.java b/plugin/src/test/java/org/opensearch/ml/rest/RestMemoryCreateInteractionActionIT.java index 7265c7d9e5..32f2b484dd 100644 --- a/plugin/src/test/java/org/opensearch/ml/rest/RestMemoryCreateInteractionActionIT.java +++ b/plugin/src/test/java/org/opensearch/ml/rest/RestMemoryCreateInteractionActionIT.java @@ -48,7 +48,7 @@ public void testCreateInteraction() throws IOException { "origin", ActionConstants.PROMPT_TEMPLATE_FIELD, "promtp template", - ActionConstants.METADATA_FIELD, + ActionConstants.ADDITIONAL_INFO_FIELD, "some metadata" ); Response response = TestHelper diff --git a/plugin/src/test/java/org/opensearch/ml/rest/RestMemoryCreateInteractionActionTests.java b/plugin/src/test/java/org/opensearch/ml/rest/RestMemoryCreateInteractionActionTests.java index e077d843ff..ced83f730a 100644 --- a/plugin/src/test/java/org/opensearch/ml/rest/RestMemoryCreateInteractionActionTests.java +++ b/plugin/src/test/java/org/opensearch/ml/rest/RestMemoryCreateInteractionActionTests.java @@ -71,7 +71,7 @@ public void testPrepareRequest() throws Exception { "response", ActionConstants.RESPONSE_ORIGIN_FIELD, "origin", - ActionConstants.METADATA_FIELD, + ActionConstants.ADDITIONAL_INFO_FIELD, "metadata" ); RestMemoryCreateInteractionAction action = new RestMemoryCreateInteractionAction(); @@ -92,6 +92,6 @@ public void testPrepareRequest() throws Exception { assert (req.getPromptTemplate().equals("pt")); assert (req.getResponse().equals("response")); assert (req.getOrigin().equals("origin")); - assert (req.getMetadata().equals("metadata")); + assert (req.getAdditionalInfo().equals("metadata")); } } diff --git a/plugin/src/test/java/org/opensearch/ml/rest/RestMemoryDeleteConversationActionIT.java b/plugin/src/test/java/org/opensearch/ml/rest/RestMemoryDeleteConversationActionIT.java index 5948b1dd70..f33e163b67 100644 --- a/plugin/src/test/java/org/opensearch/ml/rest/RestMemoryDeleteConversationActionIT.java +++ b/plugin/src/test/java/org/opensearch/ml/rest/RestMemoryDeleteConversationActionIT.java @@ -96,7 +96,7 @@ public void testDeleteConversation_WithInteractions() throws IOException { "origin", ActionConstants.PROMPT_TEMPLATE_FIELD, "promtp template", - ActionConstants.METADATA_FIELD, + ActionConstants.ADDITIONAL_INFO_FIELD, "some metadata" ); Response ciresponse = TestHelper diff --git a/plugin/src/test/java/org/opensearch/ml/rest/RestMemoryGetInteractionsActionIT.java b/plugin/src/test/java/org/opensearch/ml/rest/RestMemoryGetInteractionsActionIT.java index 0da3914ec0..a4ee6118d3 100644 --- a/plugin/src/test/java/org/opensearch/ml/rest/RestMemoryGetInteractionsActionIT.java +++ b/plugin/src/test/java/org/opensearch/ml/rest/RestMemoryGetInteractionsActionIT.java @@ -91,7 +91,7 @@ public void testGetInteractions_LastPage() throws IOException { "origin", ActionConstants.PROMPT_TEMPLATE_FIELD, "promtp template", - ActionConstants.METADATA_FIELD, + ActionConstants.ADDITIONAL_INFO_FIELD, "some metadata" ); Response response = TestHelper @@ -146,7 +146,7 @@ public void testGetInteractions_MorePages() throws IOException { "origin", ActionConstants.PROMPT_TEMPLATE_FIELD, "promtp template", - ActionConstants.METADATA_FIELD, + ActionConstants.ADDITIONAL_INFO_FIELD, "some metadata" ); Response response = TestHelper @@ -209,7 +209,7 @@ public void testGetInteractions_NextPage() throws IOException { "origin", ActionConstants.PROMPT_TEMPLATE_FIELD, "promtp template", - ActionConstants.METADATA_FIELD, + ActionConstants.ADDITIONAL_INFO_FIELD, "some metadata" ); Response response = TestHelper