Skip to content

make memory optional in conversational agent #3626

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jngz-es
Copy link
Collaborator

@jngz-es jngz-es commented Mar 5, 2025

Description

Related Issues

#3614

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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.

Sorry, something went wrong.

@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env March 5, 2025 05:17 — with GitHub Actions Inactive
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 5, 2025 05:17 — with GitHub Actions Failure
@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env March 5, 2025 05:17 — with GitHub Actions Inactive
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 5, 2025 05:17 — with GitHub Actions Error
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 5, 2025 18:19 — with GitHub Actions Failure
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 5, 2025 18:19 — with GitHub Actions Error
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 5, 2025 19:08 — with GitHub Actions Error
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 5, 2025 19:08 — with GitHub Actions Failure
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 5, 2025 19:45 — with GitHub Actions Error
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 5, 2025 19:45 — with GitHub Actions Failure
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 5, 2025 21:02 — with GitHub Actions Error
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 5, 2025 21:02 — with GitHub Actions Failure
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 6, 2025 00:11 — with GitHub Actions Failure
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 6, 2025 00:11 — with GitHub Actions Error
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 6, 2025 19:12 — with GitHub Actions Failure
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 6, 2025 19:12 — with GitHub Actions Error
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 6, 2025 21:49 — with GitHub Actions Error
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 6, 2025 21:49 — with GitHub Actions Failure
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 8, 2025 01:23 — with GitHub Actions Error
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 8, 2025 22:31 — with GitHub Actions Error
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 8, 2025 22:31 — with GitHub Actions Failure
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 8, 2025 23:30 — with GitHub Actions Error
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env March 8, 2025 23:30 — with GitHub Actions Failure
)
.build()
);
if (!StringUtils.isEmpty(sessionId)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's inverse this? if (StringUtils.isEmpty()) { return emptyList; }

Comment on lines +229 to +326
List<ModelTensors> traceTensors = (conversationIndexMemory == null)
? new ArrayList<>()
: createModelTensors(sessionId, parentInteractionId);
Copy link
Contributor

@pyek-bot pyek-bot Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about passing conversationIndexMemory to this method and returning empty list rather than using ternary operator here?

*ignore, seems like it will affect a lot of other methods using this

@@ -121,12 +122,17 @@ public MLChatAgentRunner(

@Override
public void run(MLAgent mlAgent, Map<String, String> params, ActionListener<Object> listener) {
String memoryType = mlAgent.getMemory().getType();
String memoryType = mlAgent.getMemory() == null ? null : mlAgent.getMemory().getType();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the current behavior throw NPE here? wondering if there is some validation in the REST/Transport layer to check for memory, didn't see any tho

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Memory is created by default in MLAgentExecutor right? so should we change some code there as well

@jngz-es jngz-es force-pushed the optional_memory branch 2 times, most recently from d2aa325 to 832dfb9 Compare June 11, 2025 18:23
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env June 11, 2025 18:24 — with GitHub Actions Failure
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env June 11, 2025 18:24 — with GitHub Actions Failure
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env June 11, 2025 18:24 — with GitHub Actions Failure
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env June 11, 2025 18:24 — with GitHub Actions Error
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env June 11, 2025 18:27 — with GitHub Actions Error
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env June 11, 2025 18:27 — with GitHub Actions Error
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env June 11, 2025 18:27 — with GitHub Actions Failure
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env June 11, 2025 18:27 — with GitHub Actions Failure

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Signed-off-by: Jing Zhang <[email protected]>
@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env June 11, 2025 18:54 — with GitHub Actions Inactive
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env June 11, 2025 18:54 — with GitHub Actions Error
@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env June 11, 2025 18:54 — with GitHub Actions Inactive
@jngz-es jngz-es had a problem deploying to ml-commons-cicd-env June 11, 2025 18:54 — with GitHub Actions Failure
Copy link

codecov bot commented Jun 11, 2025

Codecov Report

Attention: Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.

Project coverage is 80.39%. Comparing base (50bcbda) to head (e48cad3).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../ml/engine/algorithms/agent/MLChatAgentRunner.java 88.23% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3626      +/-   ##
============================================
+ Coverage     80.28%   80.39%   +0.11%     
- Complexity     7821     7913      +92     
============================================
  Files           683      693      +10     
  Lines         34519    34847     +328     
  Branches       3840     3875      +35     
============================================
+ Hits          27714    28016     +302     
+ Misses         5099     5097       -2     
- Partials       1706     1734      +28     
Flag Coverage Δ
ml-commons 80.39% <88.23%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env June 11, 2025 19:57 — with GitHub Actions Inactive
@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env June 11, 2025 19:57 — with GitHub Actions Inactive
@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env June 11, 2025 20:50 — with GitHub Actions Inactive
@jngz-es jngz-es temporarily deployed to ml-commons-cicd-env June 11, 2025 20:50 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants