-
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
Add search and singular APIs to conversation memory #1504
Conversation
failed expected flakies in linux (20)
and these integtests in windows (20)
all unrelated to this PR |
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.
I think you can reduce a lot of duplicate code (constructors and doExecute routines, e.g.) by using a base class and an interface with default method.
...in/java/org/opensearch/ml/memory/action/conversation/SearchConversationsTransportAction.java
Outdated
Show resolved
Hide resolved
...ain/java/org/opensearch/ml/memory/action/conversation/SearchInteractionsTransportAction.java
Outdated
Show resolved
Hide resolved
newQuery.must(originalQuery); | ||
newQuery.must(new TermQueryBuilder(ConversationalIndexConstants.INTERACTIONS_CONVERSATION_ID_FIELD, conversationId)); | ||
request.source().query(newQuery); | ||
client.admin().indices().refresh(Requests.refreshRequest(indexName), ActionListener.wrap(refreshResponse -> { |
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.
Is 'refresh' necessary? Does it force OpenSearch to do something every time or is it smart enough not to do anything if the index hasn't changed.
memory/src/main/java/org/opensearch/ml/memory/index/InteractionsIndex.java
Outdated
Show resolved
Hide resolved
if (!clusterService.state().metadata().hasIndex(indexName)) { | ||
listener.onFailure(new IndexNotFoundException("cannot get interaction since the interactions index does not exist", indexName)); | ||
return; | ||
} |
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.
Wouldn't OS throw this error anyway when you execute the Get request below?
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.
sure, but this way I shortcut the access control request
memory/src/main/java/org/opensearch/ml/memory/index/ConversationMetaIndex.java
Outdated
Show resolved
Hide resolved
@jngz-es @dhrubo-os @ylwu-amzn or someone can I get some eyes on this? Thanks |
@Zhangxunmt @ylwu-amzn this PR for memory search API |
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 , I downloaded this PR and looks like there are still tests compile errors. Can you please update the tests and pass the CI?
Signed-off-by: HenryL27 <[email protected]>
Signed-off-by: HenryL27 <[email protected]>
Signed-off-by: HenryL27 <[email protected]>
Signed-off-by: HenryL27 <[email protected]>
Signed-off-by: HenryL27 <[email protected]>
Signed-off-by: HenryL27 <[email protected]>
Signed-off-by: HenryL27 <[email protected]>
Signed-off-by: HenryL27 <[email protected]>
Signed-off-by: HenryL27 <[email protected]>
Signed-off-by: HenryL27 <[email protected]>
Signed-off-by: HenryL27 <[email protected]>
Signed-off-by: HenryL27 <[email protected]>
Signed-off-by: HenryL27 <[email protected]>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1504 +/- ##
============================================
+ Coverage 80.83% 81.19% +0.36%
- Complexity 4215 4335 +120
============================================
Files 404 421 +17
Lines 16977 17303 +326
Branches 1818 1829 +11
============================================
+ Hits 13723 14049 +326
+ Misses 2539 2537 -2
- Partials 715 717 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@Zhangxunmt rebased for gradle/java/lombok update. Failing CI tests are known flaky tests, not introduced by this PR. Can you try again? Thanks |
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.
LGTM
* add searchConversation Signed-off-by: HenryL27 <[email protected]> * add searchinteractions Signed-off-by: HenryL27 <[email protected]> * add searchConversationsITTests Signed-off-by: HenryL27 <[email protected]> * add searchInteractionsITTests Signed-off-by: HenryL27 <[email protected]> * add unit tests for storage-layer search Signed-off-by: HenryL27 <[email protected]> * add Search transport actions and tests Signed-off-by: HenryL27 <[email protected]> * add rest search actions Signed-off-by: HenryL27 <[email protected]> * add search rest actions Signed-off-by: HenryL27 <[email protected]> * Add singular get actions at storage layer Signed-off-by: HenryL27 <[email protected]> * Add OpenSearhMemoryHandler unit tests for singular get Signed-off-by: HenryL27 <[email protected]> * Add singular get transport layer Signed-off-by: HenryL27 <[email protected]> * add singular get rest actions Signed-off-by: HenryL27 <[email protected]> * fix async return value problem Signed-off-by: HenryL27 <[email protected]> * address esay PR comments Signed-off-by: HenryL27 <[email protected]> --------- Signed-off-by: HenryL27 <[email protected]> (cherry picked from commit adc7da0)
…ct#1504) * add searchConversation Signed-off-by: HenryL27 <[email protected]> * add searchinteractions Signed-off-by: HenryL27 <[email protected]> * add searchConversationsITTests Signed-off-by: HenryL27 <[email protected]> * add searchInteractionsITTests Signed-off-by: HenryL27 <[email protected]> * add unit tests for storage-layer search Signed-off-by: HenryL27 <[email protected]> * add Search transport actions and tests Signed-off-by: HenryL27 <[email protected]> * add rest search actions Signed-off-by: HenryL27 <[email protected]> * add search rest actions Signed-off-by: HenryL27 <[email protected]> * Add singular get actions at storage layer Signed-off-by: HenryL27 <[email protected]> * Add OpenSearhMemoryHandler unit tests for singular get Signed-off-by: HenryL27 <[email protected]> * Add singular get transport layer Signed-off-by: HenryL27 <[email protected]> * add singular get rest actions Signed-off-by: HenryL27 <[email protected]> * fix async return value problem Signed-off-by: HenryL27 <[email protected]> * address esay PR comments Signed-off-by: HenryL27 <[email protected]> --------- Signed-off-by: HenryL27 <[email protected]>
…1504) (#1720) * Add search and singular APIs to conversation memory (#1504) * add searchConversation Signed-off-by: HenryL27 <[email protected]> * add searchinteractions Signed-off-by: HenryL27 <[email protected]> * add searchConversationsITTests Signed-off-by: HenryL27 <[email protected]> * add searchInteractionsITTests Signed-off-by: HenryL27 <[email protected]> * add unit tests for storage-layer search Signed-off-by: HenryL27 <[email protected]> * add Search transport actions and tests Signed-off-by: HenryL27 <[email protected]> * add rest search actions Signed-off-by: HenryL27 <[email protected]> * add search rest actions Signed-off-by: HenryL27 <[email protected]> * Add singular get actions at storage layer Signed-off-by: HenryL27 <[email protected]> * Add OpenSearhMemoryHandler unit tests for singular get Signed-off-by: HenryL27 <[email protected]> * Add singular get transport layer Signed-off-by: HenryL27 <[email protected]> * add singular get rest actions Signed-off-by: HenryL27 <[email protected]> * fix async return value problem Signed-off-by: HenryL27 <[email protected]> * address esay PR comments Signed-off-by: HenryL27 <[email protected]> --------- Signed-off-by: HenryL27 <[email protected]> * fix apache http version Signed-off-by: HenryL27 <[email protected]> --------- Signed-off-by: HenryL27 <[email protected]>
…ct#1504) * add searchConversation Signed-off-by: HenryL27 <[email protected]> * add searchinteractions Signed-off-by: HenryL27 <[email protected]> * add searchConversationsITTests Signed-off-by: HenryL27 <[email protected]> * add searchInteractionsITTests Signed-off-by: HenryL27 <[email protected]> * add unit tests for storage-layer search Signed-off-by: HenryL27 <[email protected]> * add Search transport actions and tests Signed-off-by: HenryL27 <[email protected]> * add rest search actions Signed-off-by: HenryL27 <[email protected]> * add search rest actions Signed-off-by: HenryL27 <[email protected]> * Add singular get actions at storage layer Signed-off-by: HenryL27 <[email protected]> * Add OpenSearhMemoryHandler unit tests for singular get Signed-off-by: HenryL27 <[email protected]> * Add singular get transport layer Signed-off-by: HenryL27 <[email protected]> * add singular get rest actions Signed-off-by: HenryL27 <[email protected]> * fix async return value problem Signed-off-by: HenryL27 <[email protected]> * address esay PR comments Signed-off-by: HenryL27 <[email protected]> --------- Signed-off-by: HenryL27 <[email protected]>
Description
Adds search and singular apis to conversation memory as per this spec
The lower level architecture is identical to the rest of the conversation memory architecture - conversations index + interactions index; private-mode security. APIs are basically just wrappers around normal OpenSearch document APIs
Issues Resolved
#1268
Check 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.