Skip to content

Conversation

@pyek-bot
Copy link
Collaborator

@pyek-bot pyek-bot commented Aug 27, 2025

Description

Fixes the following issues:

  1. When the LLM responds with empty content, then there is no actual string to be processed. This by default falls back to tool use, however in tool use block we do a .getFirst().get() assuming there is a tool use block in the response. This PR adds a simple check to avoid such NPEs. Look at [BUG] ChatAgent fails while parsing LLMOutput #4136 for more details. There is another issue where the LLM responds with tool_use but no tool use block, for this we need to raise a ticket to the bedrock team.
  2. When steps returned by LLM contains a , the parsing breaks. This is due to a double conversion of json array to string and string to array. This has been fixed in this PR by directly returning the original json.
  3. When tool parameters contain nested json, the extractInputParameters method fails due to expecting a Map<String, String> . This has been fixed and the exception made clearer as we fall back to string by default.

For more details look at the issues mentioned below

Related Issues

Resolves #4135
Resolves #4137
Partially resolves #4136

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.

…jsons

Signed-off-by: Pavan Yekbote <pybot@amazon.com>
@pyek-bot pyek-bot temporarily deployed to ml-commons-cicd-env-require-approval August 27, 2025 00:48 — with GitHub Actions Inactive
@pyek-bot pyek-bot temporarily deployed to ml-commons-cicd-env-require-approval August 27, 2025 00:48 — with GitHub Actions Inactive
@pyek-bot pyek-bot had a problem deploying to ml-commons-cicd-env-require-approval August 27, 2025 00:48 — with GitHub Actions Error
@pyek-bot pyek-bot had a problem deploying to ml-commons-cicd-env-require-approval August 27, 2025 00:48 — with GitHub Actions Failure
@pyek-bot pyek-bot requested a review from sam-herman as a code owner September 2, 2025 19:39
@pyek-bot pyek-bot temporarily deployed to ml-commons-cicd-env September 3, 2025 17:48 — with GitHub Actions Inactive
@pyek-bot pyek-bot temporarily deployed to ml-commons-cicd-env September 3, 2025 17:48 — with GitHub Actions Inactive
@pyek-bot pyek-bot temporarily deployed to ml-commons-cicd-env September 3, 2025 17:48 — with GitHub Actions Inactive
@pyek-bot pyek-bot temporarily deployed to ml-commons-cicd-env September 3, 2025 17:48 — with GitHub Actions Inactive
@codecov
Copy link

codecov bot commented Sep 3, 2025

Codecov Report

❌ Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.85%. Comparing base (45002a7) to head (117806f).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...nsearch/ml/engine/algorithms/agent/AgentUtils.java 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4138      +/-   ##
============================================
+ Coverage     81.81%   81.85%   +0.03%     
- Complexity     8866     8870       +4     
============================================
  Files           762      762              
  Lines         38167    38169       +2     
  Branches       4264     4266       +2     
============================================
+ Hits          31228    31243      +15     
+ Misses         5111     5098      -13     
  Partials       1828     1828              
Flag Coverage Δ
ml-commons 81.85% <94.11%> (+0.03%) ⬆️

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.

@pyek-bot pyek-bot temporarily deployed to ml-commons-cicd-env September 3, 2025 18:52 — with GitHub Actions Inactive
@pyek-bot pyek-bot temporarily deployed to ml-commons-cicd-env September 3, 2025 18:52 — with GitHub Actions Inactive
Copy link
Contributor

@akolarkunnu akolarkunnu left a comment

Choose a reason for hiding this comment

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

LGTM

@Zhangxunmt Zhangxunmt merged commit 667be7e into opensearch-project:main Sep 4, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

5 participants