-
Notifications
You must be signed in to change notification settings - Fork 138
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
Conversational Memory for GenAI Apps #1196
Conversational Memory for GenAI Apps #1196
Conversation
@@ -0,0 +1,31 @@ | |||
/* | |||
* Copyright Aryn, Inc 2023 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing. Are you going to keep copyright as Aryn?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just changed em to
/*
* Copyright 2023 Aryn
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ylwu-amzn I'm not sure what the right thing to do is here, since I'm not sure I can call myself an OpenSearch contributor just yet. This was @mashah 's recommendation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HenryL27 you are certainly contributor (DCO) which is covered by this generic statement:
* Copyright OpenSearch Contributors
We do not include individual contributors (individuals or organizations) afaik
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss the license header separately. I understand technically, it's part of the PR, but the more important thing here is the code. Do we have reviewers identified for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@austintlee Agree, we can go ahead and review code first. @jngz-es is reviewing now. I will also review the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi there, +1 from the AWS Open Source Program Office - many explicit copyright statements in each file incur a lot of tech debt.
OpenSearch is following the style of other projects, like the Apache Software Foundation's, to summarize copyrights belonging to the project contributors rather than list them in each source file. Source control provides the information on who has touched what should that become required. Happy to discuss with the Aryn open source leaders/program office if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Henri --
There are two scenarios to consider:
-
Company X has a feature or capability that they developed internally and would like to contribute it back to the OpenSearch community.
-
Contributors from company X are updating existing files, incrementally improving existing features, or collaborating with multiple contributors across organizations on new features.
In scenario #1, we believe it's beneficial to keep the lineage of the work. It incentivizes companies to contribute back to the community that which they've already invested in and solely own. Lineage of contribution is kept intact and easily distinguished.
In scenario #2, we agree listing all the companies and their copyright would be messy.
Our opinion is that for conversational memory, we are in scenario #1. I also believe that we've followed this model with Elastic and Open Source Connections and acknowledged contributions as such in OpenSearch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also,
I'm not sure that I understand the "tech debt" statement. Copyright statements are not code and incur no overhead.
example interaction using this:
|
Codecov Report
@@ Coverage Diff @@
## feature/conversation #1196 +/- ##
=======================================================
Coverage ? 79.04%
Complexity ? 2149
=======================================================
Files ? 172
Lines ? 8672
Branches ? 870
=======================================================
Hits ? 6855
Misses ? 1422
Partials ? 395
Flags with carried forward coverage won't be shown. Click here to find out more. |
common/src/main/java/org/opensearch/ml/common/conversational/ConversationMeta.java
Outdated
Show resolved
Hide resolved
common/src/main/java/org/opensearch/ml/common/conversational/ConversationMeta.java
Outdated
Show resolved
Hide resolved
Comparing with another pr #1195, can we keep the same style for constructors, get/set members etc. to use lombok? |
common/src/main/java/org/opensearch/ml/common/conversation/ConversationalIndexConstants.java
Outdated
Show resolved
Hide resolved
Signed-off-by: HenryL27 <hmlindeman@yahoo.com>
@HenryL27 , @austintlee Considering this is experimental feature , and your team plan to release in 2.10 which is very tight. I don't have enough time to review this PR. Approve this PR first to unblock you. For GA release, we may need another round of review. |
Ack. Can you please merge this PR? Thanks. |
* moved code over Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * added actions to MLPlugin; fixed io lib stuff Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fixed copyrights again Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fix nullptr exception in .equals Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * preserve thread context across action calls Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove MissingResourceException from CreatInteractionRequest in favor of IOException Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * move ConversationMet, Interaction, and Constants to common/conversational Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Sequentialize createInteraction to remove data race Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * allow disorder when conversations have same timestamp Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * lombokify Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add some unit testing Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Increase unit test coverage Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix naming Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * finish code coverage for actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Leave null values out of XContent per opensearch-project#1196 (comment) Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Add integration tests for rest actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Complete unit testing for Index classes Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * update build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Finish unit tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fail closed on missing convo access Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * address code review/walkthrough comments Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add prompt temlplate and metadata fields at interaction level Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * parse request body, not params, for post requests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * restructure with memory as higher-level term Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * change interaction field names timestamp -> create_time metadata -> additional_info Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix GetInteractionsResponse xcontent tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * propagate name change to variables and parameters Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean logging and fix typos Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix final convtructor according to find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * append plugin-ml- to index names Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com>
* moved code over Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * added actions to MLPlugin; fixed io lib stuff Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fixed copyrights again Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fix nullptr exception in .equals Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * preserve thread context across action calls Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove MissingResourceException from CreatInteractionRequest in favor of IOException Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * move ConversationMet, Interaction, and Constants to common/conversational Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Sequentialize createInteraction to remove data race Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * allow disorder when conversations have same timestamp Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * lombokify Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add some unit testing Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Increase unit test coverage Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix naming Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * finish code coverage for actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Leave null values out of XContent per opensearch-project#1196 (comment) Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Add integration tests for rest actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Complete unit testing for Index classes Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * update build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Finish unit tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fail closed on missing convo access Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * address code review/walkthrough comments Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add prompt temlplate and metadata fields at interaction level Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * parse request body, not params, for post requests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * restructure with memory as higher-level term Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * change interaction field names timestamp -> create_time metadata -> additional_info Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix GetInteractionsResponse xcontent tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * propagate name change to variables and parameters Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean logging and fix typos Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix final convtructor according to find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * append plugin-ml- to index names Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com>
* moved code over Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * added actions to MLPlugin; fixed io lib stuff Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fixed copyrights again Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fix nullptr exception in .equals Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * preserve thread context across action calls Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove MissingResourceException from CreatInteractionRequest in favor of IOException Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * move ConversationMet, Interaction, and Constants to common/conversational Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Sequentialize createInteraction to remove data race Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * allow disorder when conversations have same timestamp Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * lombokify Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add some unit testing Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Increase unit test coverage Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix naming Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * finish code coverage for actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Leave null values out of XContent per opensearch-project#1196 (comment) Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Add integration tests for rest actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Complete unit testing for Index classes Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * update build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Finish unit tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fail closed on missing convo access Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * address code review/walkthrough comments Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add prompt temlplate and metadata fields at interaction level Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * parse request body, not params, for post requests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * restructure with memory as higher-level term Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * change interaction field names timestamp -> create_time metadata -> additional_info Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix GetInteractionsResponse xcontent tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * propagate name change to variables and parameters Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean logging and fix typos Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix final convtructor according to find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * append plugin-ml- to index names Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com>
* moved code over Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * added actions to MLPlugin; fixed io lib stuff Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fixed copyrights again Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fix nullptr exception in .equals Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * preserve thread context across action calls Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove MissingResourceException from CreatInteractionRequest in favor of IOException Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * move ConversationMet, Interaction, and Constants to common/conversational Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Sequentialize createInteraction to remove data race Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * allow disorder when conversations have same timestamp Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * lombokify Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add some unit testing Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Increase unit test coverage Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix naming Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * finish code coverage for actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Leave null values out of XContent per opensearch-project#1196 (comment) Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Add integration tests for rest actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Complete unit testing for Index classes Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * update build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Finish unit tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fail closed on missing convo access Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * address code review/walkthrough comments Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add prompt temlplate and metadata fields at interaction level Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * parse request body, not params, for post requests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * restructure with memory as higher-level term Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * change interaction field names timestamp -> create_time metadata -> additional_info Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix GetInteractionsResponse xcontent tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * propagate name change to variables and parameters Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean logging and fix typos Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix final convtructor according to find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * append plugin-ml- to index names Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com>
* moved code over Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * added actions to MLPlugin; fixed io lib stuff Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fixed copyrights again Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fix nullptr exception in .equals Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * preserve thread context across action calls Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove MissingResourceException from CreatInteractionRequest in favor of IOException Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * move ConversationMet, Interaction, and Constants to common/conversational Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Sequentialize createInteraction to remove data race Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * allow disorder when conversations have same timestamp Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * lombokify Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add some unit testing Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Increase unit test coverage Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix naming Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * finish code coverage for actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Leave null values out of XContent per opensearch-project#1196 (comment) Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Add integration tests for rest actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Complete unit testing for Index classes Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * update build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Finish unit tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fail closed on missing convo access Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * address code review/walkthrough comments Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add prompt temlplate and metadata fields at interaction level Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * parse request body, not params, for post requests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * restructure with memory as higher-level term Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * change interaction field names timestamp -> create_time metadata -> additional_info Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix GetInteractionsResponse xcontent tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * propagate name change to variables and parameters Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean logging and fix typos Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix final convtructor according to find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * append plugin-ml- to index names Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com>
* Conversational Memory for GenAI Apps (#1196) * moved code over Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * added actions to MLPlugin; fixed io lib stuff Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fixed copyrights again Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fix nullptr exception in .equals Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * preserve thread context across action calls Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove MissingResourceException from CreatInteractionRequest in favor of IOException Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * move ConversationMet, Interaction, and Constants to common/conversational Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Sequentialize createInteraction to remove data race Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * allow disorder when conversations have same timestamp Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * lombokify Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add some unit testing Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Increase unit test coverage Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix naming Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * finish code coverage for actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Leave null values out of XContent per #1196 (comment) Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Add integration tests for rest actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Complete unit testing for Index classes Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * update build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Finish unit tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fail closed on missing convo access Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * address code review/walkthrough comments Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add prompt temlplate and metadata fields at interaction level Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * parse request body, not params, for post requests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * restructure with memory as higher-level term Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * change interaction field names timestamp -> create_time metadata -> additional_info Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix GetInteractionsResponse xcontent tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * propagate name change to variables and parameters Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean logging and fix typos Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix final convtructor according to find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * append plugin-ml- to index names Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Feature/conversation memory feature flag (#1271) * add feature flag and checks to transport actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add feature flag tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix typos for real with find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * rename conversational-memory directory to memory Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix settings.gradle with new dir name Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add feature flag checks and tests to transport layer Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix feature flag with updateConsumer Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove redundant settings update Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up feature var initialization to avoid unchecked conversion warning Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Use Search Pipeline processors, Remote Inference and HttpConnector to enable Retrieval Augmented Generation (RAG) (#1195) * Use Search Pipeline processors, Remote Inference and HttpConnector to enable Retrieval Augmented Generation (RAG) (#1150) Signed-off-by: Austin Lee <austin@aryn.ai> * Address test coverage. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix/update imports due to changes coming from core. Signed-off-by: Austin Lee <austin@aryn.ai> * Update license header. Signed-off-by: Austin Lee <austin@aryn.ai> * Address comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Use List for context fields so we can pull contexts from multiple fields when constructing contexts for LLMs. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix spotless issue. Signed-off-by: Austin Lee <austin@aryn.ai> * Update README. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix ml-client shadowJar implicit dependency issue. Signed-off-by: Austin Lee <austin@aryn.ai> * Add a wrapper client for ML predict. Signed-off-by: Austin Lee <austin@aryn.ai> * Add tests for the internal ML client. Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: Austin Lee <austin.t.lee@gmail.com> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * [Feature] Add Retrieval Augmented Generation search processors (#1275) * Put RAG pipeline behind a feature flag. Signed-off-by: Austin Lee <austin@aryn.ai> * Add support for chat history in RAG using the Conversational Memory API Signed-off-by: Austin Lee <austin@aryn.ai> * Fix spotless Signed-off-by: Austin Lee <austin@aryn.ai> * Fix RAG feature flag enablement. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments and suggestions. Signed-off-by: Austin Lee <austin@aryn.ai> * Address comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Add unit tests for MachineLearningPlugin Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Allow RAG pipeline feature flag to be enabled and disabled dynamically (#1293) * Allow RAG pipeline feature flag to be enabled and disabled dynamically. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Add negative test cases for RAG feature flag being turned off. Signed-off-by: Austin Lee <austin@aryn.ai> * Improve error checking. Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: Austin Lee <austin.t.lee@gmail.com> Co-authored-by: Austin Lee <austin.t.lee@gmail.com>
* Conversational Memory for GenAI Apps (#1196) * moved code over Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * added actions to MLPlugin; fixed io lib stuff Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fixed copyrights again Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fix nullptr exception in .equals Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * preserve thread context across action calls Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove MissingResourceException from CreatInteractionRequest in favor of IOException Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * move ConversationMet, Interaction, and Constants to common/conversational Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Sequentialize createInteraction to remove data race Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * allow disorder when conversations have same timestamp Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * lombokify Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add some unit testing Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Increase unit test coverage Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix naming Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * finish code coverage for actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Leave null values out of XContent per #1196 (comment) Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Add integration tests for rest actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Complete unit testing for Index classes Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * update build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Finish unit tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fail closed on missing convo access Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * address code review/walkthrough comments Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add prompt temlplate and metadata fields at interaction level Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * parse request body, not params, for post requests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * restructure with memory as higher-level term Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * change interaction field names timestamp -> create_time metadata -> additional_info Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix GetInteractionsResponse xcontent tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * propagate name change to variables and parameters Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean logging and fix typos Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix final convtructor according to find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * append plugin-ml- to index names Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Feature/conversation memory feature flag (#1271) * add feature flag and checks to transport actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add feature flag tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix typos for real with find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * rename conversational-memory directory to memory Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix settings.gradle with new dir name Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add feature flag checks and tests to transport layer Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix feature flag with updateConsumer Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove redundant settings update Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up feature var initialization to avoid unchecked conversion warning Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Use Search Pipeline processors, Remote Inference and HttpConnector to enable Retrieval Augmented Generation (RAG) (#1195) * Use Search Pipeline processors, Remote Inference and HttpConnector to enable Retrieval Augmented Generation (RAG) (#1150) Signed-off-by: Austin Lee <austin@aryn.ai> * Address test coverage. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix/update imports due to changes coming from core. Signed-off-by: Austin Lee <austin@aryn.ai> * Update license header. Signed-off-by: Austin Lee <austin@aryn.ai> * Address comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Use List for context fields so we can pull contexts from multiple fields when constructing contexts for LLMs. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix spotless issue. Signed-off-by: Austin Lee <austin@aryn.ai> * Update README. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix ml-client shadowJar implicit dependency issue. Signed-off-by: Austin Lee <austin@aryn.ai> * Add a wrapper client for ML predict. Signed-off-by: Austin Lee <austin@aryn.ai> * Add tests for the internal ML client. Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: Austin Lee <austin.t.lee@gmail.com> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * [Feature] Add Retrieval Augmented Generation search processors (#1275) * Put RAG pipeline behind a feature flag. Signed-off-by: Austin Lee <austin@aryn.ai> * Add support for chat history in RAG using the Conversational Memory API Signed-off-by: Austin Lee <austin@aryn.ai> * Fix spotless Signed-off-by: Austin Lee <austin@aryn.ai> * Fix RAG feature flag enablement. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments and suggestions. Signed-off-by: Austin Lee <austin@aryn.ai> * Address comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Add unit tests for MachineLearningPlugin Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Allow RAG pipeline feature flag to be enabled and disabled dynamically (#1293) * Allow RAG pipeline feature flag to be enabled and disabled dynamically. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Add negative test cases for RAG feature flag being turned off. Signed-off-by: Austin Lee <austin@aryn.ai> * Improve error checking. Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: Austin Lee <austin.t.lee@gmail.com> Co-authored-by: Austin Lee <austin.t.lee@gmail.com> (cherry picked from commit 1112612)
* Conversational Memory for GenAI Apps (#1196) * moved code over Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * added actions to MLPlugin; fixed io lib stuff Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fixed copyrights again Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fix nullptr exception in .equals Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * preserve thread context across action calls Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove MissingResourceException from CreatInteractionRequest in favor of IOException Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * move ConversationMet, Interaction, and Constants to common/conversational Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Sequentialize createInteraction to remove data race Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * allow disorder when conversations have same timestamp Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * lombokify Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add some unit testing Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Increase unit test coverage Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix naming Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * finish code coverage for actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Leave null values out of XContent per #1196 (comment) Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Add integration tests for rest actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Complete unit testing for Index classes Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * update build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Finish unit tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fail closed on missing convo access Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * address code review/walkthrough comments Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add prompt temlplate and metadata fields at interaction level Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * parse request body, not params, for post requests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * restructure with memory as higher-level term Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * change interaction field names timestamp -> create_time metadata -> additional_info Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix GetInteractionsResponse xcontent tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * propagate name change to variables and parameters Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean logging and fix typos Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix final convtructor according to find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * append plugin-ml- to index names Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Feature/conversation memory feature flag (#1271) * add feature flag and checks to transport actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add feature flag tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix typos for real with find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * rename conversational-memory directory to memory Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix settings.gradle with new dir name Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add feature flag checks and tests to transport layer Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix feature flag with updateConsumer Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove redundant settings update Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up feature var initialization to avoid unchecked conversion warning Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Use Search Pipeline processors, Remote Inference and HttpConnector to enable Retrieval Augmented Generation (RAG) (#1195) * Use Search Pipeline processors, Remote Inference and HttpConnector to enable Retrieval Augmented Generation (RAG) (#1150) Signed-off-by: Austin Lee <austin@aryn.ai> * Address test coverage. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix/update imports due to changes coming from core. Signed-off-by: Austin Lee <austin@aryn.ai> * Update license header. Signed-off-by: Austin Lee <austin@aryn.ai> * Address comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Use List for context fields so we can pull contexts from multiple fields when constructing contexts for LLMs. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix spotless issue. Signed-off-by: Austin Lee <austin@aryn.ai> * Update README. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix ml-client shadowJar implicit dependency issue. Signed-off-by: Austin Lee <austin@aryn.ai> * Add a wrapper client for ML predict. Signed-off-by: Austin Lee <austin@aryn.ai> * Add tests for the internal ML client. Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: Austin Lee <austin.t.lee@gmail.com> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * [Feature] Add Retrieval Augmented Generation search processors (#1275) * Put RAG pipeline behind a feature flag. Signed-off-by: Austin Lee <austin@aryn.ai> * Add support for chat history in RAG using the Conversational Memory API Signed-off-by: Austin Lee <austin@aryn.ai> * Fix spotless Signed-off-by: Austin Lee <austin@aryn.ai> * Fix RAG feature flag enablement. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments and suggestions. Signed-off-by: Austin Lee <austin@aryn.ai> * Address comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Add unit tests for MachineLearningPlugin Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Allow RAG pipeline feature flag to be enabled and disabled dynamically (#1293) * Allow RAG pipeline feature flag to be enabled and disabled dynamically. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Add negative test cases for RAG feature flag being turned off. Signed-off-by: Austin Lee <austin@aryn.ai> * Improve error checking. Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: Austin Lee <austin.t.lee@gmail.com> Co-authored-by: Austin Lee <austin.t.lee@gmail.com> (cherry picked from commit 1112612) Co-authored-by: HenryL27 <hmlindeman@yahoo.com>
* Conversational Memory for GenAI Apps (opensearch-project#1196) * moved code over Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * added actions to MLPlugin; fixed io lib stuff Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fixed copyrights again Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fix nullptr exception in .equals Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * preserve thread context across action calls Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove MissingResourceException from CreatInteractionRequest in favor of IOException Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * move ConversationMet, Interaction, and Constants to common/conversational Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Sequentialize createInteraction to remove data race Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * allow disorder when conversations have same timestamp Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * lombokify Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add some unit testing Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Increase unit test coverage Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix naming Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * finish code coverage for actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Leave null values out of XContent per opensearch-project#1196 (comment) Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Add integration tests for rest actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Complete unit testing for Index classes Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * update build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Finish unit tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fail closed on missing convo access Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * address code review/walkthrough comments Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add prompt temlplate and metadata fields at interaction level Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * parse request body, not params, for post requests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * restructure with memory as higher-level term Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * change interaction field names timestamp -> create_time metadata -> additional_info Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix GetInteractionsResponse xcontent tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * propagate name change to variables and parameters Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean logging and fix typos Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix final convtructor according to find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * append plugin-ml- to index names Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Feature/conversation memory feature flag (opensearch-project#1271) * add feature flag and checks to transport actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add feature flag tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix typos for real with find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * rename conversational-memory directory to memory Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix settings.gradle with new dir name Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add feature flag checks and tests to transport layer Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix feature flag with updateConsumer Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove redundant settings update Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up feature var initialization to avoid unchecked conversion warning Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Use Search Pipeline processors, Remote Inference and HttpConnector to enable Retrieval Augmented Generation (RAG) (opensearch-project#1195) * Use Search Pipeline processors, Remote Inference and HttpConnector to enable Retrieval Augmented Generation (RAG) (opensearch-project#1150) Signed-off-by: Austin Lee <austin@aryn.ai> * Address test coverage. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix/update imports due to changes coming from core. Signed-off-by: Austin Lee <austin@aryn.ai> * Update license header. Signed-off-by: Austin Lee <austin@aryn.ai> * Address comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Use List for context fields so we can pull contexts from multiple fields when constructing contexts for LLMs. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix spotless issue. Signed-off-by: Austin Lee <austin@aryn.ai> * Update README. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix ml-client shadowJar implicit dependency issue. Signed-off-by: Austin Lee <austin@aryn.ai> * Add a wrapper client for ML predict. Signed-off-by: Austin Lee <austin@aryn.ai> * Add tests for the internal ML client. Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: Austin Lee <austin.t.lee@gmail.com> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * [Feature] Add Retrieval Augmented Generation search processors (opensearch-project#1275) * Put RAG pipeline behind a feature flag. Signed-off-by: Austin Lee <austin@aryn.ai> * Add support for chat history in RAG using the Conversational Memory API Signed-off-by: Austin Lee <austin@aryn.ai> * Fix spotless Signed-off-by: Austin Lee <austin@aryn.ai> * Fix RAG feature flag enablement. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments and suggestions. Signed-off-by: Austin Lee <austin@aryn.ai> * Address comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Add unit tests for MachineLearningPlugin Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Allow RAG pipeline feature flag to be enabled and disabled dynamically (opensearch-project#1293) * Allow RAG pipeline feature flag to be enabled and disabled dynamically. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Add negative test cases for RAG feature flag being turned off. Signed-off-by: Austin Lee <austin@aryn.ai> * Improve error checking. Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: Austin Lee <austin.t.lee@gmail.com> Co-authored-by: Austin Lee <austin.t.lee@gmail.com> Signed-off-by: HenryL27 <hmlindeman@yahoo.com>
* Conversational Memory for GenAI Apps (opensearch-project#1196) * moved code over Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * added actions to MLPlugin; fixed io lib stuff Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fixed copyrights again Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fix nullptr exception in .equals Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * preserve thread context across action calls Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove MissingResourceException from CreatInteractionRequest in favor of IOException Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * move ConversationMet, Interaction, and Constants to common/conversational Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Sequentialize createInteraction to remove data race Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * allow disorder when conversations have same timestamp Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * lombokify Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add some unit testing Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Increase unit test coverage Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix naming Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * finish code coverage for actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Leave null values out of XContent per opensearch-project#1196 (comment) Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Add integration tests for rest actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Complete unit testing for Index classes Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * update build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Finish unit tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fail closed on missing convo access Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * address code review/walkthrough comments Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add prompt temlplate and metadata fields at interaction level Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * parse request body, not params, for post requests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * restructure with memory as higher-level term Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * change interaction field names timestamp -> create_time metadata -> additional_info Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix GetInteractionsResponse xcontent tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * propagate name change to variables and parameters Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean logging and fix typos Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix final convtructor according to find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * append plugin-ml- to index names Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Feature/conversation memory feature flag (opensearch-project#1271) * add feature flag and checks to transport actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add feature flag tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix typos for real with find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * rename conversational-memory directory to memory Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix settings.gradle with new dir name Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add feature flag checks and tests to transport layer Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix feature flag with updateConsumer Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove redundant settings update Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up feature var initialization to avoid unchecked conversion warning Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Use Search Pipeline processors, Remote Inference and HttpConnector to enable Retrieval Augmented Generation (RAG) (opensearch-project#1195) * Use Search Pipeline processors, Remote Inference and HttpConnector to enable Retrieval Augmented Generation (RAG) (opensearch-project#1150) Signed-off-by: Austin Lee <austin@aryn.ai> * Address test coverage. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix/update imports due to changes coming from core. Signed-off-by: Austin Lee <austin@aryn.ai> * Update license header. Signed-off-by: Austin Lee <austin@aryn.ai> * Address comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Use List for context fields so we can pull contexts from multiple fields when constructing contexts for LLMs. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix spotless issue. Signed-off-by: Austin Lee <austin@aryn.ai> * Update README. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix ml-client shadowJar implicit dependency issue. Signed-off-by: Austin Lee <austin@aryn.ai> * Add a wrapper client for ML predict. Signed-off-by: Austin Lee <austin@aryn.ai> * Add tests for the internal ML client. Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: Austin Lee <austin.t.lee@gmail.com> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * [Feature] Add Retrieval Augmented Generation search processors (opensearch-project#1275) * Put RAG pipeline behind a feature flag. Signed-off-by: Austin Lee <austin@aryn.ai> * Add support for chat history in RAG using the Conversational Memory API Signed-off-by: Austin Lee <austin@aryn.ai> * Fix spotless Signed-off-by: Austin Lee <austin@aryn.ai> * Fix RAG feature flag enablement. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments and suggestions. Signed-off-by: Austin Lee <austin@aryn.ai> * Address comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Add unit tests for MachineLearningPlugin Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Allow RAG pipeline feature flag to be enabled and disabled dynamically (opensearch-project#1293) * Allow RAG pipeline feature flag to be enabled and disabled dynamically. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Add negative test cases for RAG feature flag being turned off. Signed-off-by: Austin Lee <austin@aryn.ai> * Improve error checking. Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: Austin Lee <austin.t.lee@gmail.com> Co-authored-by: Austin Lee <austin.t.lee@gmail.com> (cherry picked from commit 1112612) Signed-off-by: HenryL27 <hmlindeman@yahoo.com>
* Feature/conversation backport to 2.x (#1286) * Conversational Memory for GenAI Apps (#1196) * moved code over Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * added actions to MLPlugin; fixed io lib stuff Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fixed copyrights again Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fix nullptr exception in .equals Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * preserve thread context across action calls Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove MissingResourceException from CreatInteractionRequest in favor of IOException Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * move ConversationMet, Interaction, and Constants to common/conversational Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Sequentialize createInteraction to remove data race Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * allow disorder when conversations have same timestamp Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * lombokify Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add some unit testing Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Increase unit test coverage Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix naming Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * finish code coverage for actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Leave null values out of XContent per #1196 (comment) Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Add integration tests for rest actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Complete unit testing for Index classes Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * update build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Finish unit tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Fail closed on missing convo access Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * address code review/walkthrough comments Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add prompt temlplate and metadata fields at interaction level Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * parse request body, not params, for post requests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * restructure with memory as higher-level term Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up build.gradle Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * change interaction field names timestamp -> create_time metadata -> additional_info Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix GetInteractionsResponse xcontent tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * propagate name change to variables and parameters Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean logging and fix typos Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix final convtructor according to find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * append plugin-ml- to index names Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Feature/conversation memory feature flag (#1271) * add feature flag and checks to transport actions Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * add feature flag tests Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix typos for real with find-and-replace Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * rename conversational-memory directory to memory Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix settings.gradle with new dir name Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * re-add feature flag checks and tests to transport layer Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix feature flag with updateConsumer Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * remove redundant settings update Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * clean up feature var initialization to avoid unchecked conversion warning Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Use Search Pipeline processors, Remote Inference and HttpConnector to enable Retrieval Augmented Generation (RAG) (#1195) * Use Search Pipeline processors, Remote Inference and HttpConnector to enable Retrieval Augmented Generation (RAG) (#1150) Signed-off-by: Austin Lee <austin@aryn.ai> * Address test coverage. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix/update imports due to changes coming from core. Signed-off-by: Austin Lee <austin@aryn.ai> * Update license header. Signed-off-by: Austin Lee <austin@aryn.ai> * Address comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Use List for context fields so we can pull contexts from multiple fields when constructing contexts for LLMs. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix spotless issue. Signed-off-by: Austin Lee <austin@aryn.ai> * Update README. Signed-off-by: Austin Lee <austin@aryn.ai> * Fix ml-client shadowJar implicit dependency issue. Signed-off-by: Austin Lee <austin@aryn.ai> * Add a wrapper client for ML predict. Signed-off-by: Austin Lee <austin@aryn.ai> * Add tests for the internal ML client. Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: Austin Lee <austin.t.lee@gmail.com> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * [Feature] Add Retrieval Augmented Generation search processors (#1275) * Put RAG pipeline behind a feature flag. Signed-off-by: Austin Lee <austin@aryn.ai> * Add support for chat history in RAG using the Conversational Memory API Signed-off-by: Austin Lee <austin@aryn.ai> * Fix spotless Signed-off-by: Austin Lee <austin@aryn.ai> * Fix RAG feature flag enablement. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments and suggestions. Signed-off-by: Austin Lee <austin@aryn.ai> * Address comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Add unit tests for MachineLearningPlugin Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * Allow RAG pipeline feature flag to be enabled and disabled dynamically (#1293) * Allow RAG pipeline feature flag to be enabled and disabled dynamically. Signed-off-by: Austin Lee <austin@aryn.ai> * Address review comments. Signed-off-by: Austin Lee <austin@aryn.ai> * Add negative test cases for RAG feature flag being turned off. Signed-off-by: Austin Lee <austin@aryn.ai> * Improve error checking. Signed-off-by: Austin Lee <austin@aryn.ai> --------- Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * apply spotless Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: Austin Lee <austin.t.lee@gmail.com> Co-authored-by: Austin Lee <austin.t.lee@gmail.com> (cherry picked from commit 1112612) Signed-off-by: HenryL27 <hmlindeman@yahoo.com> * fix http library version Signed-off-by: HenryL27 <hmlindeman@yahoo.com> --------- Signed-off-by: HenryL27 <hmlindeman@yahoo.com> Signed-off-by: Austin Lee <austin@aryn.ai> Signed-off-by: Austin Lee <austin.t.lee@gmail.com> Co-authored-by: Austin Lee <austin.t.lee@gmail.com>
Description
Implements conversational memory API using OpenSearch index
Potential organizational tweaks - feedback requested:
conversational/action/
toplugin/action/
: keeping all the actions together (ofc the rest actions go to the rest directory)ConversationalMemoryHandler
toConversationalMemory
: to draw a clearer distinction between memory in the abstract and the physical memory - might be more obvious that multiple backends could be hereconversational/index/
toconversational/storage/index
: again, to allow room for additional backend CM storage options (DDB, Redis, etc)ConversationMeta
toConversation
: is the Meta part redundant?Issues Resolved
#1150
Design
We provide an API for handling conversational memory. First, I will define conversational memory. Then I will provide a description of the transport-layer implementation. Finally, a description of the storage-layer implementation.
Conversational Memory
common/.../conversational/
The purpose of conversational memory is to store context of conversations had between an end-user and a LLM. Chatbots need to remember what has been said in a conversation prior to any new interactions; otherwise their statements will be completely ungrounded - for example, they might have no idea what a pronoun is referring to and be unable to reason effectively.
We consider two objects: a Conversation and an Interaction. A conversation is, essentially, a list of interactions. An interaction is a pair of messages, an "input" from the end-user and a "response" from the LLM. We add a bunch of additional data to these objects, to enable better analytics, explainability, etc.
Conversations also know about:
They also have an optional name field, so that an end-user can easily pick up a conversation from a moth or so ago.
Interactions, in addition the the input-response pair, know about:
Transport Layer
conversational-memory/.../action/
We implement 5 OpenSearch Actions for handling conversations: CreateConversation, CreateInteraction, GetConversations, GetInteractions, and DeleteConversation. Each Action follows the (as far as I can tell) standard OpenSearch pattern of [Action, Request, Response, TransportAction, RestAction].
CreateConversation
: Given an optional name for the conversation, create a new conversation object and return the id. If the security plugin is enabled and the user is a secure user (not admin) then the username also gets written into the conversation object.GetConversations
: Given nothing, return the list of conversations that this user has access to. If no security or admin user, this is the list of all conversations, sorted by recency of the last time they were added to. Note that the conversations returned do not include the interactions that go with. This is paginated - by default we return 10 conversations but this can be bumped. If there are more conversations than the 10 returned we also return a pagination token for the next page (which at the moment is just a "from" position integer because of how OS does pagination in search requests)GetInteractions
: Given a conversation id (retrieved either from CreateConversation or GetConversation), return all the interactions that belong to that conversation, sorted most recent to oldest. This is also paginated in the same way as GetConversations. If the user does not have access to the conversation they are requesting, we don't return any interactions.CreateInteraction
: Write an interaction into memory. This takes as input everything the Interaction needs to know about: input, response, prompt, conversation id, agent, metadata. The timestamp is generated here. Also, update the corresponding conversation object - bump the number of interactions, update the most recent hit time. Again, if the user has no access to the conversation they're trying to add to, we disallow this. Return the id of the new interaction.DeleteConversation
: Given a conversation id, delete it and all of its interactions from memory. Don't if the user doesn't have access.The "TransportAction" versions of these actions use a ConversationalMemoryHandler, which is a storage-layer interface that performs all of these operations. I've implemented an OpenSearch version of ConversationalMemoryHandler, but it should be possible to write implementations for other databases as well.
Storage Layer
conversational-memory/.../index/
We use OpenSearch as the storage for conversational memory. It seemed natural, since we're in OpenSearch. We use 2 indices: one for the high-level conversation objects (which we call "ConversationMeta") and one for interactions. The bulk of the work here is translating the Transport Layer operations into OpenSearch client operations.
CreateConversation
: this just becomes an index request, creating a new "ConversationMeta" object in the.plugins-ml-conversation-meta
index. If security is enabled, we read the user info from the ThreadContext.GetConversations
: depending on whether there is security involved, this is a Search request with either a TermQuery (matching user from ThreadContext to user in indexed documents) or a MatchAllQuery. Also, use OpenSearch to do the sorting too.GetInteractions
: first check if the user has access to the conversation by Getting the ConversationMeta object from the.plugins-ml-conversation-meta
index, then (if yes) execute a TermQuery search request looking for Interactions with the correct conversation id. Use OS to sort by time.CreateInteraction
: First, check that the user has access to the conversation with a get request. Then, (if yes) update the ConversationMeta object with the new time and a bump to the conversation length. Also, index a new Interaction object.DeleteConversation
: First, check that the user has access to the conversation with a get request. Then, (if yes), delete the ConversationMeta from its index. Also, gather all of the interactions in that conversation with consecutive getInteractions calls, and finally Bulk delete them all.Index Schemae
ConversationMeta Index
.plugins-ml-conversation-meta
Interactions Index
.plugins-ml-conversation-interactions
Security
For now, we keep conversations at the
private
resource-level security mode, i.e. only the owner and admin have access to a conversation. At the conversation level, we write the username of the user who created it (pulling from the variable in thread context created by the security plugin). See the storage layer details for how this interacts with the various actions we're introducing. There are a lot of hard problems when you start trying to bring conversations to arestricted
access level - unlike models, the user can directly add information to a conversation, some of which may be private. So for now we leave all conversations at private access level.Security Concerns
Theoretically, the user can write whatever they like into this storage. Credit card info, social security numbers, personal medical information, etc. Hence the blanket "private mode" over all conversations. One potential issue is that the admin's username is null - their conversations will not have a 'user' field. We list conversations by a TermQuery (over the user) or MatchAllQuery depending on who's doing the asking, but if the TermQuery returns documents that don't have that field then the admin's conversationMetas are public.
When deleting a conversation, it is possible for the conversationMeta to be deleted but not all of the interactions. In this case, we deny anyone access to the orphaned interactions, but they stick around forever (or at least until the admin goes and manually cleans them up). If you can automate that particular fail case then you can probably cause some problems.
I'll also add that the logic for deleting all the interactions of a conversation is fairly complicated, so I'd like someone to look it over.
Sample Rest API calls
Future work (not this PR)
GetConversation
API (and I guessGetInteraction
)_search
endpointCheck List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.