-
Notifications
You must be signed in to change notification settings - Fork 186
code refactoring + add unit test [memory module] #4086
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
Conversation
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
065b501 to
81b2399
Compare
This is not introduced by this PR. |
rithin-pullela-aws
left a comment
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.
Reviewed the business logic files, mostly LGTM apart from very minor nitpicks.
Will review the test files in some time
| public String getId() { | ||
| return id; | ||
| } |
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.
nit: can we add @ Getter instead?
same applies for other fields as well
| BulkItemResponse[] items = bulkResponse.getItems(); | ||
| int itemIndex = 0; | ||
|
|
||
| for (int i = 0; i < results.size(); i++) { |
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.
Should we have itemIndex condition in the for loop since we are anyways skipping the operations id itemIndex is out of bounds
for (int i = 0; i < results.size() && itemIndex < items.length ; i++) {
| public void extractFactsFromConversation( | ||
| List<MessageInput> messages, | ||
| MemoryStorageConfig storageConfig, | ||
| ActionListener<List<String>> listener | ||
| ) { |
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 to understand the underlying design, do we extract facts from a bunch of messages and not a single message from the user?
| if (responseContent.startsWith("```json") && responseContent.endsWith("```")) { | ||
| responseContent = responseContent.substring(7, responseContent.length() - 3).trim(); |
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.
Nit: While this is a good way to handle the LLM output parsing, these instructions should be ideally provided in the prompt of the LLM to never output the code blocks. If the current prompt sometimes leads to such outputs, it is an indication that there is a scope of improvement in the prompt
Some resources for prompt optimization from anthropic:
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4086 +/- ##
============================================
+ Coverage 79.06% 80.89% +1.82%
- Complexity 8621 8727 +106
============================================
Files 755 760 +5
Lines 38352 38090 -262
Branches 4287 4245 -42
============================================
+ Hits 30324 30813 +489
+ Misses 6220 5442 -778
- Partials 1808 1835 +27
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@rithin-pullela-aws I'll address all your comment in the next followup. Merging to unblock @b4sjoo |
* code refactoring Signed-off-by: Dhrubo Saha <dhrubo@amazon.com> * add more unit tests and bug fix Signed-off-by: Dhrubo Saha <dhrubo@amazon.com> --------- Signed-off-by: Dhrubo Saha <dhrubo@amazon.com> (cherry picked from commit 85a3135)
Description
[code refactoring + add unit test [memory module]
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
--signoff.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.